Brightfield#

class deeptrack.optics.Brightfield(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: Optics

Simulates imaging of coherently illuminated samples.

The Brightfield class models a brightfield microscopy setup, imaging samples by iteratively propagating light through a discretized volume. Each voxel in the volume represents the effective refractive index of the sample at that point. Light is propagated iteratively through Fourier space and corrected in real space.

Parameters#

illumination: Feature, optional

Feature-set representing the complex field entering the sample. Default is a uniform field with all values set to 1.

NA: float

Numerical aperture of the limiting aperture.

wavelength: float

Wavelength of the incident light in meters.

magnification: float

Magnification of the optical system.

resolution: array_like[float (, float, float)]

Pixel spacing in the camera. A third value can define the resolution in the z-direction.

refractive_index_medium: float

Refractive index of the medium.

padding: array_like[int, int, int, int]

Padding added to the sample volume to minimize edge effects.

output_region: array_like[int, int, int, int], optional

Specifies the region of the image to output (x, y, width, height). Default is None, which outputs the entire image.

pupil: Feature, optional

Feature-set defining the pupil function. The input is the unaberrated pupil.

Attributes#

__gpu_compatible__: bool

Indicates whether the class supports GPU acceleration.

__conversion_table__: ConversionTable

Table used to convert properties of the feature to desired units.

NA: float

Numerical aperture of the optical system.

wavelength: float

Wavelength of the scattered 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 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], fields: array_like[complex], **kwargs: Dict[str, Any]) -> Image` Simulates imaging with brightfield microscopy.

Examples#

Create a Brightfield instance:

>>> import deeptrack as dt
>>> optics = dt.Brightfield(NA=1.4, wavelength=0.52e-6, magnification=60)
>>> print(optics.NA())
1.4

Methods Summary

get(illuminated_volume, limits, fields, **kwargs)

Simulates imaging with brightfield microscopy.

Methods Documentation

get(illuminated_volume: Tuple[complex, ...] | List[complex] | ndarray, limits: Tuple[int, ...] | List[int] | ndarray, fields: Tuple[complex, ...] | List[complex] | ndarray, **kwargs: Dict[str, Any]) Image#

Simulates imaging with brightfield microscopy.

This method propagates light through the given volume, applying pupil functions at various defocus levels and incorporating refraction corrections in real space to produce the final brightfield image.

Parameters#

illuminated_volume: array_like[complex]

Discretized volume representing the sample to be imaged.

limits: array_like[int, int]

Boundaries of the sample volume in each dimension.

fields: array_like[complex]

Input fields to be used in the imaging process.

**kwargs: Dict[str, Any]

Additional parameters for the imaging process, including: - ‘padding’: Padding to apply to the sample volume. - ‘output_region’: Specific region to extract from the image. - ‘wavelength’: Wavelength of the light. - ‘refractive_index_medium’: Refractive index of the medium.

Returns#

Image: Image

Processed image after simulating the brightfield imaging process.

Examples#

Simulate imaging a volume:

>>> import deeptrack as dt
>>> import numpy as np
>>> optics = dt.Brightfield(
...     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]])
>>> fields = np.array([np.ones((162, 162), dtype=complex)])
>>> 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, fields, **filtered_properties)
>>> print(image.shape)
(128, 128, 1)