Sphere#
- class deeptrack.optical.scatterers.Sphere(radius: float = 1e-06, **kwargs)#
Bases:
VolumeScattererGenerate a spherical scatterer.
Sphere 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#
- radius: float
Radius of the sphere in meters.
- position: tuple[float, float] | tuple[float, float, float]
The position of the particle, length 2 or 3. 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.
Methods Summary
get(*args, radius, voxel_size, **kwargs)Evaluate the sphere on a voxel grid.
Methods Documentation
- get(*args: Any, radius: float, voxel_size: ndarray | Tensor, **kwargs) ndarray | Tensor#
Evaluate the sphere on a voxel grid.
The sphere is defined by its radius, 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 sphere and 0 otherwise..
Parameters#
- args: Any
Positional arguments passed to the method. Not used in this implementation.
- radiusfloat
Radius of the sphere in meters.
- voxel_sizearray-like
Size of voxels along each axis.
- kwargs: Any
Keyword arguments passed to the method.
Returns#
- np.ndarray or torch.Tensor
A 3D array representing the spherical mask.