Fluorescence#
- class deeptrack.optics.Fluorescence(NA: float | Callable[[...], float] = 0.7, wavelength: float | Callable[[...], float] = 6.6e-07, magnification: float | Callable[[...], float] = 10, resolution: float | Tuple[float, ...] | List[float] | ndarray | Callable[[...], float | Tuple[float, ...] | List[float] | ndarray] = 1e-06, refractive_index_medium: float | Callable[[...], float] = 1.33, padding: Tuple[int, ...] | List[int] | ndarray | Callable[[...], Tuple[int, ...] | List[int] | ndarray] = (10, 10, 10, 10), output_region: Tuple[int, ...] | List[int] | ndarray | Callable[[...], Tuple[int, ...] | List[int] | ndarray] = (0, 0, 128, 128), pupil: Feature | None = None, illumination: Feature | None = None, upscale: int = 1, **kwargs: Dict[str, Any])#
Bases:
OpticsOptical device for fluorescent imaging.
The Fluorescence class simulates the imaging process in fluorescence microscopy by creating a discretized volume where each pixel represents the intensity of light emitted by fluorophores in the sample. It extends the Optics class to include fluorescence-specific functionalities.
Parameters#
- NA: float
Numerical aperture of the optical system.
- wavelength: float
Emission wavelength of the fluorescent light (in meters).
- magnification: float
Magnification of the optical system.
- resolution: array_like[float (, float, float)]
Pixel spacing in the camera. Optionally includes the z-direction.
- refractive_index_medium: float
Refractive index of the imaging medium.
- padding: array_like[int, int, int, int]
Padding applied to the sample volume to reduce edge effects.
- output_region: array_like[int, int, int, int], optional
Region of the output image to extract (x, y, width, height). If None, returns the full image.
- pupil: Feature, optional
A feature set defining the pupil function at focus. The input is the unaberrated pupil.
- illumination: Feature, optional
A feature set defining the illumination source.
- upscale: int, optional
Scaling factor for the resolution of the optical system.
**kwargs: Dict[str, Any]
Attributes#
- __gpu_compatible__: bool
Indicates whether the class supports GPU acceleration.
- NA: float
Numerical aperture of the optical system.
- wavelength: float
Emission wavelength of the fluorescent light (in meters).
- magnification: float
Magnification of the optical system.
- resolution: array_like[float (, float, float)]
Pixel spacing in the camera. Optionally includes the z-direction.
- refractive_index_medium: float
Refractive index of the imaging medium.
- padding: array_like[int, int, int, int]
Padding applied to the sample volume to reduce edge effects.
- output_region: array_like[int, int, int, int]
Region of the output image to extract (x, y, width, height).
- voxel_size: function
Function returning the voxel size of the optical system.
- pixel_size: function
Function returning the pixel size of the optical system.
- upscale: int
Scaling factor for the resolution of the optical system.
- limits: array_like[int, int]
Limits of the volume to be imaged.
- fields: list[Feature]
List of fields to be imaged
Methods#
- get(illuminated_volume: array_like[complex], limits: array_like[int, int], **kwargs: Dict[str, Any]) -> Image
Simulates the imaging process using a fluorescence microscope.
Examples#
Create a Fluorescence instance:
>>> import deeptrack as dt
>>> optics = dt.Fluorescence( ... NA=1.4, wavelength=0.52e-6, magnification=60, ... ) >>> print(optics.NA()) 1.4
Methods Summary
get(illuminated_volume, limits, **kwargs)Simulates the imaging process using a fluorescence microscope.
Methods Documentation
- get(illuminated_volume: Tuple[complex, ...] | List[complex] | ndarray, limits: Tuple[int, ...] | List[int] | ndarray, **kwargs: Dict[str, Any]) Image#
Simulates the imaging process using a fluorescence microscope.
This method convolves the 3D illuminated volume with a pupil function to generate a 2D image projection.
Parameters#
- illuminated_volume: array_like[complex]
The illuminated 3D volume to be imaged.
- limits: array_like[int, int]
Boundaries of the illuminated volume in each dimension.
- **kwargs: Dict[str, Any]
Additional properties for the imaging process, such as: - ‘padding’: Padding to apply to the sample. - ‘output_region’: Specific region to extract from the image.
Returns#
- Image: Image
A 2D image object representing the fluorescence projection.
Notes#
Empty slices in the volume are skipped for performance optimization.
The pupil function incorporates defocus effects based on z-slice.
Examples#
Simulate imaging a volume:
>>> import deeptrack as dt >>> import numpy as np
>>> optics = dt.Fluorescence( ... NA=1.4, wavelength=0.52e-6, magnification=60, ... ) >>> volume = dt.Image(np.ones((128, 128, 10), dtype=complex)) >>> limits = np.array([[0, 128], [0, 128], [0, 10]]) >>> properties = optics.properties() >>> filtered_properties = { ... k: v for k, v in properties.items() ... if k in {"padding", "output_region", "NA", ... "wavelength", "refractive_index_medium"} ... } >>> image = optics.get(volume, limits, **filtered_properties) >>> print(image.shape) (128, 128, 1)