optics

Features for optically imaging of samples

Contains features which performs physical simulations of optical devices to create camera images of samples.

Classes

Microscope

Image a sample using an optical system.

Optics

Abstract base optics class.

Fluorescence

Optical device for fluorescenct imaging.

Brightfield

Images coherently illuminated samples.

Module classes

Brightfield

class deeptrack.optics.Brightfield(NA=0.7, wavelength=6.6e-07, magnification=1, resolution=(1e-06, 1e-06, 1e-06), refractive_index_medium=1.33, upscale=2, padding=(10, 10, 10, 10), output_region=(None, None, None, None), pupil: deeptrack.features.Feature = None, **kwargs)

Images coherently illuminated samples.

Images samples by creating a discretized volume, where each pixel represents the effective refractive index of that pixel. Light is propagated through the sample iteratively by first propagating the light in the fourier space, followed by a refractive index correction in the real space.

Parameters
  • illumination (Feature) – Feature-set resolving the complex field entering the sample. Default is a field with all values 1.

  • NA (float) – The NA of the limiting aperature.

  • wavelength (float) – The wavelength of the scattered light in meters.

  • magnification (float) – The magnification of the optical system.

  • resolution (array_like[float (, float, float)]) – The distance between pixels in the camera. A third value can be included to define the resolution in the z-direction.

  • refractive_index_medium (float) – The refractive index of the medium.

  • upscale (int) – Upscales the pupil function for a more accurate result.

  • padding (array_like[int, int, int, int]) – Pads the sample volume with zeros to avoid edge effects.

  • output_region (array_like[int, int, int, int]) – The region of the image to output (x,y,width,height). Default None returns entire image.

  • pupil (Feature) – A feature-set resolving the pupil function at focus. The feature-set receive an unaberrated pupil as input.

get(illuminated_volume, limits, **kwargs)

Convolves the image with a pupil function

Fluorescence

class deeptrack.optics.Fluorescence(NA=0.7, wavelength=6.6e-07, magnification=1, resolution=(1e-06, 1e-06, 1e-06), refractive_index_medium=1.33, upscale=2, padding=(10, 10, 10, 10), output_region=(None, None, None, None), pupil: deeptrack.features.Feature = None, **kwargs)

Optical device for fluorescenct imaging

Images samples by creating a discretized volume, where each pixel represents the intensity of the light emitted by fluorophores in the the voxel.

Parameters
  • NA (float) – The NA of the limiting aperature.

  • wavelength (float) – The wavelength of the scattered light in meters.

  • magnification (float) – The magnification of the optical system.

  • resolution (array_like[float (, float, float)]) – The distance between pixels in the camera. A third value can be included to define the resolution in the z-direction.

  • refractive_index_medium (float) – The refractive index of the medium.

  • upscale (int) – Upscales the pupil function for a more accurate result.

  • padding (array_like[int, int, int, int]) – Pads the sample volume with zeros to avoid edge effects.

  • output_region (array_like[int, int, int, int]) – The region of the image to output (x,y,width,height). Default None returns entire image.

  • pupil (Feature) – A feature-set resolving the pupil function at focus. The feature-set receive an unaberrated pupil as input.

get(illuminated_volume, limits, **kwargs)

Convolves the image with a pupil function

IlluminationGradient

class deeptrack.optics.IlluminationGradient(gradient=(0, 0), constant=0, vmin=0, vmax=inf, **kwargs)

Adds a gradient in the illumination

Parameters
  • gradient (array_like[float, float]) – Gradient of the plane to add to the amplitude of the field in pixels.

  • constant (float) – Constant value to add to the amplitude of the field.

  • vmin (float) – clips the amplitude of the field to be at least this value

  • vmax (float) – clips the amplitude of the field to be at most this value

get(image, gradient, constant, vmin, vmax, **kwargs)

Method for altering an image Abstract method that define how the feature transforms the input. The current value of all properties will be passed as keyword arguments.

Parameters
  • image (Image or List[Image]) – The Image or list of images to transform

  • **kwargs – The current value of all properties in properties as well as any global arguments.

Returns

The transformed image or list of images

Return type

Image or List[Image]

Microscope

class deeptrack.optics.Microscope(sample: deeptrack.features.Feature, objective: deeptrack.features.Feature, **kwargs)

Image a sample using an optical system.

Wraps a feature-set defining a sample and a feature-set defining the optics.

Parameters
  • sample (Feature) – A feature-set resolving a list of images describing the sample to be imaged

  • objective (Feature) – A feature-set defining the optical device that images the sample

get(image, sample, objective, **kwargs)

Method for altering an image Abstract method that define how the feature transforms the input. The current value of all properties will be passed as keyword arguments.

Parameters
  • image (Image or List[Image]) – The Image or list of images to transform

  • **kwargs – The current value of all properties in properties as well as any global arguments.

Returns

The transformed image or list of images

Return type

Image or List[Image]

Optics

class deeptrack.optics.Optics(NA=0.7, wavelength=6.6e-07, magnification=1, resolution=(1e-06, 1e-06, 1e-06), refractive_index_medium=1.33, upscale=2, padding=(10, 10, 10, 10), output_region=(None, None, None, None), pupil: deeptrack.features.Feature = None, **kwargs)

Abstract base optics class.

Provides structure and methods common for most optical devices.

Parameters
  • NA (float) – The NA of the limiting aperature.

  • wavelength (float) – The wavelength of the scattered light in meters.

  • magnification (float) – The magnification of the optical system.

  • resolution (array_like[float (, float, float)]) – The distance between pixels in the camera. A third value can be included to define the resolution in the z-direction.

  • refractive_index_medium (float) – The refractive index of the medium.

  • upscale (int) – Upscales the pupil function for a more accurate result.

  • padding (array_like[int, int, int, int]) – Pads the sample volume with zeros to avoid edge effects.

  • output_region (array_like[int, int, int, int]) – The region of the image to output (x,y,width,height). Default None returns entire image.

  • pupil (Feature) – A feature-set resolving the pupil function at focus. The feature-set receive an unaberrated pupil as input.

Module functions

_create_volume

deeptrack.optics._create_volume(list_of_scatterers, pad=(0, 0, 0, 0), output_region=(None, None, None, None), refractive_index_medium=1.33, **kwargs)

_get_position

deeptrack.optics._get_position(image, mode='center', return_z=False)