cbi_toolbox.simu.optics
The optics module provides simulations of the optics of imaging systems for microscopy
Conventions:
arrays follow the ZXY convention, with
Z : depth axis (axial, focus axis)
X : horizontal axis (lateral)
Y : vertical axis (lateral, rotation axis when relevant)
- cbi_toolbox.simu.optics.create_wf_1d(wf_object, upsampling=1, scale=1, copy=False)[source]
Create a 1D wavefront object from an existing wavefront
- Parameters:
wf_object (poppy.FresnelWavefront) – the original wavefront
upsampling (int, optional) – upsampling factor (does not change the field of view), by default 1
scale (int, optional) – zoom factor (changes the field of view), by default 1
copy (bool, optional) – return a new object, by default False
- Returns:
a 1D wavefront full of 1 with same properties as the input
- Return type:
poppy.FresnelWavefront
- cbi_toolbox.simu.optics.gaussian_psf(npix_lateral=129, npix_axial=129, pixelscale=6.35e-07, wavelength=5e-07, numerical_aperture=0.5, refraction_index=1.33)[source]
Compute an approximate PSF model based on gaussian beam propagation
Koskela, O., Montonen, T., Belay, B. et al. Gaussian Light Model in Brightfield Optical Projection Tomography. Sci Rep 9, 13934 (2019).
- Parameters:
npix_lateral (int, optional) – number of pixels in the lateral direction, by default 129
npix_axial (int, optional) – number of pixels in the axial direction, by default 129
pixelscale (float, optional) – pixelscale in meters per pixel, by default 1.3e-3/2048
wavelength (float, optional) – illumination wavelength in meters, by default 500e-9
numerical_aperture (float, optional) – objective NA, by default 0.5
refraction_index (float, optional) – imaging medium NA, by default 1.33
- Returns:
the gaussian PSF
- Return type:
array [ZXY]
- cbi_toolbox.simu.optics.openspim_illumination(wavelength=5e-07, refr_index=1.333, laser_radius=0.0012, objective_na=0.3, objective_focal=0.018, slit_opening=0.01, pixelscale=6.35e-07, npix_fov=512, npix_z=None, rel_thresh=None, simu_size=2048, oversample=16)[source]
Compute the illumination function of an OpenSPIM device
- Parameters:
wavelength (float, optional) – illumination wavelength in meters, by default 500e-9
refr_index (float, optional) – imaging medium refraction index, by default 1.333
laser_radius (float, optional) – source laser radius in meters, by default 1.2e-3
objective_na (float, optional) – illumination objective NA, by default 0.3
objective_focal (float, optional) – illumination objective focal length in meters, by default 18e-3
slit_opening (float, optional) – vertical slit opening in meters, by default 10e-3
pixelscale (float, optional) – target pixelscale in meters per pixel, by default 1.3e-3/2048
npix_fov (int, optional) – target size in pixels, by default 512
npix_z (int, optional) – target depth size in pixel, by default None (uses npix_fov)
rel_thresh (float, optional) – relative threshold to crop the beam thickness if a full row is below this theshold, all rows after are removed will be computed as compared to the maximum pixel
simu_size (int, optional) – size of the arrays used for simulation, by default 2048
oversample (int, optional) – oversampling used for the simulation (must be increased sith simu_size), by default 16
- Returns:
the illumination function
- Return type:
array [ZXY]
- cbi_toolbox.simu.optics.resample_wavefront(wf, pixelscale, npixels)[source]
Resample 1D wavefront to new pixelscale (adapted from poppy.poppy_core._resample_wavefront_pixelscale)
- Parameters:
wf (poppy.FresnelWavefront) – a 1D wavefront
pixelscale (astropy.units.[distance] / astropy.units.pixel) – target pixelscale
npixels (int) – target size in pixels
- Returns:
resampled and resized 1D wavefront
- Return type:
poppy.FresnelWavefront
- cbi_toolbox.simu.optics.wf_mix(wf1, wf2, ref=None)[source]
Compute a 2D wavefront by multiplying 2 1D wavefronts (for separable propagation)
- Parameters:
wf1 (poppy.FresnelWavefront) – a 1D wavefront
wf2 (poppy.FresnelWavefront) – a 1D wavefront
ref (poppy.FresnelWavefront, optional) – reference wavefront for the parameters of the output, by default None (wf1 will be used)
- Returns:
the 2D mixed wavefront
- Return type:
poppy.FresnelWavefront
- Raises:
ValueError – if the input wavefronts have different pixelscales
- cbi_toolbox.simu.optics.wf_to_2d(wf_object, npix=None, copy=False)[source]
Convert a 1D wavefront to 2D (for plotting only)
- Parameters:
wf_object (poppy.FresnelWavefront) – the 1D wavefront
npix (int, optional) – crop to a size of npix, by default None
copy (bool, optional) – return a new object, by default False
- Returns:
the 2D wavefront
- Return type:
poppy.FresnelWavefront