Augmentation#
- class deeptrack.optical.augmentations.Augmentation(time_consistent: bool = False, **kwargs: Any)#
Bases:
FeatureBase class for augmentation features.
This class defines the interface for spatial augmentations applied to arrays, scattered fields, or scattered volumes. Subclasses implement the actual transformation logic while this class handles dispatching, batching, and backend selection.
Supported inputs include: - NumPy arrays - Torch tensors - ScatteredVolume and ScatteredField objects
When applied to scattered objects, both the underlying array and relevant metadata (e.g., positions) may be updated.
Parameters#
- time_consistent: bool, optional
If True, the same augmentation parameters are applied to all elements in a sequence. This is useful for time-series data where each frame must undergo the same transformation. Defaults to False.
Methods#
- _process_and_get(elements, time_consistent, **kwargs) -> list
Augments a list of scatterers or arrays and returns an output of the same type.
- `_augment_element(element, **kwargs) -> volyme | field | array | tensor `
Augments a single scatterer or array element.
- _augment_array(array, **kwargs) -> array | tensor
Augments a single array element, dispatching to the appropriate backend method.
- _get_xp(array, xp, **kwargs) -> array | tensor
Backend-agnostic implementation using the provided array module (numpy or torch).
- _get_numpy(array, **kwargs) -> array
NumPy-specific implementation.
- _get_torch(array, **kwargs) -> tensor
PyTorch-specific implementation.
- _update_properties(element, old_shape, new_shape, …) -> volume | field
Updates the properties of a ScatteredVolume or ScatteredField after the array has been augmented.
Notes#
Subclasses typically implement one of the following: - _get_xp(array, xp, **kwargs) - _get_numpy(array, **kwargs) - _get_torch(array, **kwargs) If ._get_xp() is implemented, it will be used for both backends.