scatterers

Implementations of Feature the model scattering objects.

Provides some basic implementations of scattering objects that are frequently used.

Classes

Scatterer

Abstract base class for scatterers

PointParticle

Generates point particles

Ellipse

Generetes 2-d elliptical particles

Sphere

Generates 3-d spheres

Ellipsoid

Generates 3-d ellipsoids

Module classes

Ellipse

class deeptrack.scatterers.Ellipse(radius, rotation, **kwargs)

Generates an elliptical disk scatterer

Parameters
  • radius (float or array_like [float (, float)]) – Radius of the ellipse in meters. If only one value, assume circular.

  • rotation (float) – Orientation angle of the ellipse in the camera plane in radians.

  • position (array_like[float, float (, float)]) – The position of the particle. Third index is optional, and represents the position in the direction normal to the camera plane.

  • z (float) – The position in the direction normal to the camera plane. Used if position is of length 2.

  • value (float) – A default value of the characteristic of the particle. Used by optics unless a more direct property is set: (eg. refractive_index for Brightfield and intensity for Fluorescence).

  • upsample (int) – Upsamples the calculations of the pixel occupancy fraction.

get(*ignore, radius, rotation, voxel_size, **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]

Ellipsoid

class deeptrack.scatterers.Ellipsoid(radius, rotation=0, **kwargs)

Generates an ellipsoidal scatterer

Parameters
  • radius (float or array_like[float (, float, float)]) – Radius of the ellipsoid in meters. If only one value, assume spherical.

  • rotation (float) – Rotation of the ellipsoid in about the x, y and z axis.

  • position (array_like[float, float (, float)]) – The position of the particle. Third index is optional, and represents the position in the direction normal to the camera plane.

  • z (float) – The position in the direction normal to the camera plane. Used if position is of length 2.

  • value (float) – A default value of the characteristic of the particle. Used by optics unless a more direct property is set: (eg. refractive_index for Brightfield and intensity for Fluorescence).

  • upsample (int) – Upsamples the calculations of the pixel occupancy fraction.

get(image, radius, rotation, voxel_size, **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]

PointParticle

class deeptrack.scatterers.PointParticle(**kwargs)

Generates a point particle

A point particle is approximated by the size of a pixel. For subpixel positioning, the position is interpolated linearly.

Parameters
  • position (array_like of length 2 or 3) – The position of the particle. Third index is optional, and represents the position in the direction normal to the camera plane.

  • z (float) – The position in the direction normal to the camera plane. Used if position is of length 2.

  • value (float) – A default value of the characteristic of the particle. Used by optics unless a more direct property is set: (eg. refractive_index for Brightfield and intensity for Fluorescence).

get(image, **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]

Scatterer

class deeptrack.scatterers.Scatterer(position, z=0.0, value=1.0, position_unit='meter', upsample=1, **kwargs)

Base abstract class for scatterers.

A scatterer is defined by a 3-dimensional volume of voxels. To each voxel corresponds an occupancy factor, i.e., how much of that voxel does the scatterer occupy. However, this number is not necessarily limited to the [0, 1] range. It can be any number, and its interpretation is left to the optical device that images the scatterer.

This abstract class implements the _process_properties method to convert the position to voxel units, as well as the _process_and_get method to upsample the calculation and crop empty slices.

Parameters
  • position (array_like of length 2 or 3) – The position of the particle. Third index is optional, and represents the position in the direction normal to the camera plane.

  • z (float) – The position in the direction normal to the camera plane. Used if position is of length 2.

  • value (float) – A default value of the characteristic of the particle. Used by optics unless a more direct property is set (eg. refractive_index for Brightfield and intensity for Fluorescence).

  • position_unit ("meter" or "pixel") – The unit of the provided position property.

Other Parameters
  • upsample_axes (tuple of ints) – Sets the axes along which the calculation is upsampled (default is None, which implies all axes are upsampled).

  • crop_zeros (bool) – Whether to remove slices in which all elements are zero.

Sphere

class deeptrack.scatterers.Sphere(radius, **kwargs)

Generates a spherical scatterer

Parameters
  • radius (float) – Radius of the sphere in meters.

  • position (array_like[float, float (, float)]) – The position of the particle. Third index is optional, and represents the position in the direction normal to the camera plane.

  • z (float) – The position in the direction normal to the camera plane. Used if position is of length 2.

  • value (float) – A default value of the characteristic of the particle. Used by optics unless a more direct property is set: (eg. refractive_index for Brightfield and intensity for Fluorescence).

  • upsample (int) – Upsamples the calculations of the pixel occupancy fraction.

get(image, radius, voxel_size, **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]