Mathematics for electron microscopy: fundamental methods toward automatic real-time image processing and 3D model analysis