Ellipsoid#

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

Bases: VolumeScatterer

Generates an ellipsoidal scatterer.

Ellipsoid is a true volumetric scatterer. Its support spans a 3D voxelized region, so the correct spatial measure is already represented by the extent of the discrete mask. No additional fluorescence measure correction is required.

Parameters#

args: Any

Positional arguments passed to the method. Not used in this implementation.

radius: float | tuple[float, float, float]

Radius of the ellipsoid in meters. If only one value, assume spherical.

rotation: float | tuple[float, float, float]

Rotation angles (rx, ry, rz) applied in XYZ order.

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 ellipse is transposed as to align the first axis of the radius with the first axis of the created volume. This is applied before rotation.

kwargs: Any

Keyword arguments passed to the method.

Methods Summary

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

Evaluate the ellipsoid on a voxel grid.

Methods Documentation

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

Evaluate the ellipsoid on a voxel grid.

The ellipsoid is defined by its radii and rotation, and evaluated on a grid with spacing given by voxel_size. The returned value is a 3D array where each voxel is assigned 1 if inside the ellipsoid and 0 otherwise.

Parameters#

args: Any

Positional arguments passed to the method. Not used in this implementation.

radiusarray-like

Radii of the ellipsoid along the principal axes.

rotationarray-like of length 3

Rotation angles (rx, ry, rz) applied in XYZ order.

voxel_sizearray-like

Size of voxels along each axis.

transposebool

Whether to align the first axis of the radius with the first axis of the created volume before rotation.

kwargs: Any

Keyword arguments passed to the method.

Returns#

np.ndarray or torch.Tensor

A (X, Y, Z) array representing the ellipsoidal mask.