manoharan-lab / holopy

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

HoloPy for Off-Axis Configurations #349

Closed parkercoye closed 4 years ago

parkercoye commented 4 years ago

I want to simulate an off-axis digital holography setup to try and reconstruct an image, but I noticed that Holopy uses an In-line (Gabor) configuration. Is it possible to configure HoloPy for an off-axis configuration? If not, could I still use it to reconstruct the image from an interference pattern generated with Off-Axis DH, or would I get incorrect results?

jeromefung commented 4 years ago

HoloPy doesn't natively support off-axis holography, although I did use HoloPy to help a collaborator analyze some off-axis holograms about a year ago. In brief, you can use hp.propagate() to perform the Rayleigh-Sommerfeld propagation you need to do perform reconstruction, but there's a bunch of preprocessing you'll need to do yourself.

In particular, you'll first need to Fourier-transform your hologram and select the portion that corresponds to the real image (using some kind of smooth cutoff, like a Hamming window, to avoid artifacts). Then you'll need to shift the selection (in the Fourier domain) back to k_x = k_y = 0 and take the inverse FT. This image can now be reconstructed using hp.propagate(). Fortunately, everything you need is in the numpy standard libraries.

Does that help? If you're interested, perhaps we might consider adding native off-axis functionality in a future release.

barkls commented 4 years ago

@briandleahy has also thought about off-axis holography, and may have something to contribute.

briandleahy commented 4 years ago

Hey @parkercoye ,

As @jeromefung says, right now holopy does not really support off-axis holography, although this is something that I think is interesting.

Regarding simulating an off-axis setup, there are a few subtleties if you want to get all the details right. For models which basically ignore the lens (i.e. most of holopy),

If you want to quantitatively describe the effects of the lens (i.e. using the new MieLens() or the upcoming Lens()scattering theories), then things are even more complicated.

That being said, holopy does provide ways to calculate the scattering matrix and the full scattered fields at arbitrary points. So it is definitely possible to use holopy as a tool to calculate off-axis holograms, but you will have to figure out some of the physics and write some of the code yourself.

Hope that helps.

vnmanoharan commented 4 years ago

Hi @parkercoye - Just to clarify, @briandleahy's comment addresses your first question about simulating the hologram. @jeromefung's comment addresses your second question about reconstruction. Reconstruction is a bit more straightforward than simulation is for the off-axis setup.

colepfwoerner commented 4 years ago

Hello,

I'm a researcher working with @parkercoye on off-axis holography.

Since this discussion, we've started developing our own code for scattering off of complicated 3d objects. We now plan to use HoloPy for reconstruction only. I am wonder about what @jeromefung meant.

Namely: when you say "real image" do you mean "actual image" or "real part of a complex image", are you refering to the twin image introduced during the process of interference in holography? Is that shift you are talking about just the numpy.fft.fftshift()?

jeromefung commented 4 years ago

Hi @colepfwoerner and @parkercoye -- by "real image" I mean the thing that is not the twin image. (You need to retain both the real and imaginary parts of the Fourier transform.) The shift I referred to is also an actual shift in the data (e.g., what values are associated with what spatial frequencies). numpy.fft.fftshift() changes only the order in which the values appear.

While it's certainly not the seminal work, I think Fig. 5 of this paper by Nguyen et al. does a good job illustrating what you need to do to reconstruct an off-axis hologram, including all the steps I mentioned. (They call the twin image the "virtual image," and what you can use HoloPy for is going from the filtered and center-shifted Fourier transform to the reconstruction you want, as in panel e.) If you want a more authoritative reference on hologram reconstruction (including the off-axis case and with references to original literature), I would suggest the Handbook of Holographic Inteferometry by Thomas Kreis.