manoharan-lab / holopy

Hologram processing and light scattering in python
GNU General Public License v3.0
131 stars 50 forks source link

Hologram generation and reconstruction for large scatterers #363

Closed arthudubois closed 4 years ago

arthudubois commented 4 years ago

Hi, I'm trying to generates holograms and reconstructions for one sphere with a radius ~50 µm. My detector is shape = (200, 200), spacing = 5. The hologram with a sphere at (500, 500, 500) looks like this with illumination at 0.532µm : Figure_1 But the reconstruction with zstack = np.linspace(250, 750, 201) seems strange : Figure_2 Figure_2_500 Figure_2_700 It seems that the reconstructed slices are all the same.

For small particles the results seem corrects but starting from 5µm radius the reconstructions are strange, like above

briandleahy commented 4 years ago

Hi @arthudubois ,

Well, the calculations may be problematic, but at least they make beautiful images!! :smile:

I think you are seeing aliasing, from the large pixel spacing on your detector. If I run:

from holopy.scattering import Sphere, Mie, calc_holo
from holopy import detector_grid 

sphere = Sphere(center=(500, 500, 500), n=1.59, r=50)
detector = detector_grid(shape=(200, 200), spacing=5.0)

holo = calc_holo(
    detector, sphere, medium_index=1.33, illum_wavelen=0.532,
    illum_polarization=(1, 0))

then I get basically the exact same plot you had above. But if I zoom in by a factor of 10, calculating at more pixels, like so,

detector_zoom = detector_grid(shape=(200, 200), spacing=0.50)          
sphere_zoom = Sphere(center=(50, 50, 500), n=1.59, r=50)               

holo_zoom = calc_holo(
    detector_zoom, sphere_zoom, medium_index=1.33,
    illum_wavelen=0.532, llum_polarization=(1, 0))

then I get this much more reasonable image:

zoomed-hologram

The problem with your original image is that your pixel sampling density is far too low to see the structure in the hologram, so you just see the aliasing effect. Doing a reconstruction likewise fails because input to the reconstruction calculation isn't sampled densely enough.

If you do want to reconstruct, I would calculate the hologram at a much higher pixel density (something like 0.5 um / pixel). This will take a long time; be forewarned.

As an aside,

Let me know if that helped,

arthudubois commented 4 years ago

Hi @briandleahy Thanks a lot for your help. Generation with a x10 zoom works perfectly but the reconstruction is still strange. I tried to increase pixel density and got this result :

from holopy.scattering import Sphere, Mie, calc_holo
from holopy import detector_grid 
import numpy as np

sphere = Sphere(center=(50, 00, 500), n=1.4, r=50)
detector = detector_grid(shape=(1000, 1000), spacing=.1)

holo = calc_holo(
    detector, sphere, medium_index=1.0, illum_wavelen=0.532,
    illum_polarization=(1, 0))
zstack = np.linspace(250, 750, 201)
rec_vol = hp.propagate(holo, zstack, medium_index=1.0, illumin_wavelen=0.532)

Figure_10_250 Figure_10_410 Figure_10_500 Figure_10_600 Is the pixel density still to low ?

For the Mie theory I manage generate hologram with sphere up to 83 µm radius (if I remember correctly) without getting an error.

barkls commented 4 years ago

Reconstruction tries to propagate the field back into various planes, but it doesn't know what the field is outside the image. This introduces artifacts in reconstructions that move inwards from the edges of the image to the center with increasing z-propagation distance. Usually the solution is to make sure the image you are reconstructing includes a large enough buffer region between the hologram of interest and the edge of the image. Here you would need to have both a high pixel density and a very large extent of the image to get reasonable reconstructions, so the computation time and memory load might be prohibitively expensive for spheres this large.