holopy.propagation package

Module contents

holopy.propagation.convolution_propagation module

Code to propagate objects/waves using scattering models.

propagate(data, d, medium_index=None, illum_wavelen=None, cfsp=0, gradient_filter=False)

Propagates a hologram along the optical axis

Parameters:
  • data (Image or VectorGrid) – Hologram to propagate
  • d (float or list of floats) – Distance to propagate, in meters, or desired schema. A list tells to propagate to several distances and return the volume
  • cfsp (integer (optional)) – cascaded free-space propagation factor. If this is an integer > 0, the transfer function G will be calculated at d/csf and the value returned will be G**csf. This helps avoid artifacts related to the limited window of the transfer function
  • gradient_filter (float) – For each distance, compute a second propagation a distance gradient_filter away and subtract. This enhances contrast of rapidly varying features
Returns:

data – The hologram progagated to a distance d from its current location.

Return type:

Image or Volume

trans_func(schema, d, med_wavelen, cfsp=0, gradient_filter=0)

Calculates the optical transfer function to use in reconstruction

This routine uses the analytical form of the transfer function found in in Kreis [1]. It can optionally do cascaded free-space propagation for greater accuracy [2], although the code will run slightly more slowly.

Parameters:
  • shape ((int, int)) – maximum dimensions of the transfer function
  • spacing ((float, float)) – the spacing between points is the grid to calculate
  • wavelen (float) – the wavelength in the medium you are propagating through
  • d (float or list of floats) – reconstruction distance. If list or array, this function will return an array of transfer functions, one for each distance
  • cfsp (integer (optional)) – cascaded free-space propagation factor. If this is an integer > 0, the transfer function G will be calculated at d/csf and the value returned will be G**csf.
  • gradient_filter (float (optional)) – Subtract a second transfer function a distance gradient_filter from each z
Returns:

trans_func – The calculated transfer function. This will be at most as large as shape, but may be smaller if the frequencies outside that are zero

Return type:

np.ndarray

References

[1]Kreis, Handbook of Holographic Interferometry (Wiley, 2005), equation 3.79 (page 116)
[2]Kreis, Optical Engineering 41(8):1829, section 5

holopy.propagation.point_source_propagate module

interpolate2D(data, i, j, fill=None)

Interpolates values from a 2D array (data) given non-integer indecies i and j. If [i,j] is outside of the shape of data, fill is returned. If fill=None, the value of the closest edge pixel to (i,j) is used.

ps_propagate(data, d, L, beam_c, out_schema=None)

Propagates light back through a hologram that was taken using a diverging reference beam. Only propagation through media with refractive index 1 is supported. This is a wrapper function for ps_propagate_plane() This function can handle a single reconstruction plane or a volume.

Based on the algorithm described in Manfred H. Jericho and H. Jurgen Kreuzer, “Point Source Digital In-Line Holographic Microscopy,” Chapter 1 of Coherent Light Microscopy, Springer, 2010. http://link.springer.com/chapter/10.1007%2F978-3-642-15813-1_1

data is a holopy Xarray. It is the hologram to reconstruct. Must be square. The pixel spacing must also be square. d = distance from pinhole to reconstructed image, in meters (this is z in Jericho and Kreuzer). Can be a scalar or a 1D list or array. L = distance from screen to pinhole, in meters beam_c = [x,y] coodinates of beam center, in pixels out_schema = size of output image and pixel spacing, default is the schema of data.

returns an image(volume) corresponding to the reconstruction at plane(s) d.

ps_propagate_plane(data, d, L, beam_c, out_schema=None, old_Ip=False)

Propagates light back through a hologram that was taken using a diverging reference beam. Propataion can be to one plane only. Only propagation through media with refractive index 1 is supported.

Based on the algorithm described in Manfred H. Jericho and H. Jurgen Kreuzer, “Point Source Digital In-Line Holographic Microscopy,” Chapter 1 of Coherent Light Microscopy, Springer, 2010. http://link.springer.com/chapter/10.1007%2F978-3-642-15813-1_1

data is a holopy Xarray. It is the hologram to reconstruct. Must be square. The pixel spacing must also be square. d = distance from pinhole to reconstructed image, in meters (this is z in Jericho and Kreuzer). Must be a scalar. L = distance from screen to pinhole, in meters beam_c = [x,y] coodinates of beam center, in pixels out_schema = size of output image and pixel spacing, default is the schema of data. if Ip == True, returns Ip to be used on calculations in the stack if Ip == False compute reconstructed image as normal if Ip is an image, use this to speed up calculations

returns an image(volume) corresponding to the reconstruction at plane(s) d.