CropToMultiplesOf#
- class deeptrack.optical.augmentations.CropToMultiplesOf(multiple: int | tuple[int | None, ...] | Callable[[...], int | tuple[int | None, ...]] = 1, corner: str | Callable[[...], str] = 'random', **kwargs)#
Bases:
CropCrop images so their dimensions are multiples of a given value.
The image is cropped along each axis until its size becomes a multiple of the specified value.
Parameters#
- multiple: PropertyLike[int | tuple[int | None, …]]
Target multiples for each axis. If a single integer is provided, the same multiple is applied to all axes. If a tuple is provided, each value corresponds to an axis. A value of None or -1 indicates that the axis should not be constrained.
- corner: PropertyLike[str], optional
Top-left corner of the cropped region. - “random” selects a random valid corner. (default) - A tuple specifies the corner explicitly. - A callable receives the input array and returns a corner.
Examples#
>>> import deeptrack as dt
>>> particle = dt.PointParticle(position=(32, 32)) >>> optics = dt.Fluorescence() >>> crop_mult = dt.CropToMultiplesOf(multiple=5, corner=(0,0)) >>> image = optics(particle) >> crop_mult >>> print(image.resolve().shape)