Ellipse#

class deeptrack.optical.scatterers.Ellipse(radius: float = 1e-06, rotation: float = 0, transpose: bool = False, **kwargs)#

Bases: VolumeScatterer

Generate a 2D elliptical scatterer.

Build a 2D ellipse on a voxel grid, defined by its radii and rotation. The ellipse is represented as a planar object embedded in a 3D voxel grid, with support on a single z-slice. For fluorescence imaging, the discrete mask is therefore scaled by the axial voxel size to account for the missing thickness of the continuous emitter.

Supports both NumPy and PyTorch backends.

Parameters#

radius: float | tuple[float, float]

Radius of the ellipse in meters. If a single value is provided, a circular shape is assumed.

rotation: float

Orientation angle of the ellipse in the camera plane in radians.

position: tuple[float, float] | tuple[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.

transpose: bool

If True, the radius components are aligned with the (y, x) axes before rotation.

Methods Summary

get(*args, radius, rotation, voxel_size, ...)

Evaluate the ellipse on a voxel grid.

Methods Documentation

get(*args: Any, radius: ndarray | Tensor | float, rotation: float, voxel_size: ndarray | Tensor, transpose: bool, **kwargs: Any) ndarray | Tensor#

Evaluate the ellipse on a voxel grid.

The ellipse is defined by its radii and rotation and evaluated on a grid with spacing given by voxel_size.

For fluorescence imaging, the returned planar mask is scaled by the axial voxel size so that the discrete source has the correct measure under changes in z-resolution.

Parameters#

radiusarray-like

Radii of the ellipse along the principal axes.

rotationfloat

Rotation angle in radians.

voxel_sizearray-like

Size of voxels along each axis.

transposebool

Whether to align radii with (y, x) axes before rotation.

Returns#

np.ndarray or torch.Tensor

An array representing the elliptical mask.