Scatterer#
- class deeptrack.optical.scatterers.Scatterer(position: tuple[float, float] | tuple[float, float, float] = (32.0, 32.0), z: float = 0.0, value: float = 1.0, position_unit: str = 'pixel', upsample: int = 1, voxel_size: tuple | None = None, pixel_size: tuple | None = None, **kwargs)#
Bases:
FeatureBase abstract class for scatterers.
A Scatterer defines an object or optical source term to be evaluated on a discrete spatial grid. Depending on the subclass, the result may represent either a voxelized volume (VolumeScatterer) or a complex field (FieldScatterer).
Parameters#
- position: tuple[float, float] | tuple[float, float, float], optional
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. Default is (32.0, 32.0).
- z: float, optional
The position in the direction normal to the camera plane. Used if position is of length 2. Default is 0.0.
- value: float, optional
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). Default is 1.0.
- position_unit: str, optional
The unit of the provided position property. Can be “meter” or “pixel”. Default is “pixel”.
- upsample: int, optional
Geometry supersampling factor for volume-based scatterers. The scatterer is evaluated on a finer grid and downsampled by average pooling. Ignored by field-based scatterers.
- upsample_axes: tuple of int, optional
Deprecated. Previously selected the axes along which supersampling was applied. This parameter is now ignored.
- voxel_size: array-like, optional
The size of the voxels in meters. If not provided, it is obtained from the active optics configuration.
- pixel_size: array-like, optional
The size of the pixels in meters. If not provided, it is obtained from the active optics configuration.
- **kwargs: Any
Additional feature properties forwarded to the parent Feature class.
Methods#
- _antialias_volume(volume, factor) -> array
Geometry-only supersampling anti-aliasing.
- _process_properties(properties) -> dict
Preprocess the input to the method .get(). This method is called before the scatterer is evaluated.
- _process_and_get(…) -> list[array]
Post-processes the created object.
- _wrap_output(array, props) -> ScatteredVolume or ScatteredField
Wraps the output of the scatterer in the appropriate class.
Notes#
For developers extending the class hierarchy: __list_merge_strategy__: str
The strategy for merging lists of properties when multiple scatterers are combined. Default is “append”, which concatenates the lists.
- __distributed__: bool
Determines whether .get(image, **kwargs) is applied to each element of the input list independently (__distributed__ = True) or to the list as a whole (__distributed__ = False).
- __conversion_table__: ConversionTable
A table defining the physical units of the scatterer’s properties and how to convert them to the internal units used for calculations.