Upscale#

class deeptrack.features.Upscale(feature: Feature, factor: int | Tuple[int, int, int] = 1, **kwargs: Dict[str, Any])#

Bases: Feature

Perform the simulation at a higher resolution.

This feature scales up the resolution of the input pipeline by a specified factor, performs computations at the higher resolution, and then downsamples the result back to the original size. This is useful for simulating effects at a finer resolution while preserving compatibility with lower-resolution pipelines.

It redefines the sizes of internal units to scale up the simulation. The resulting image is then downscaled back to the original size.

Parameters#

featureFeature

The pipeline or feature to resolve at a higher resolution.

factorint or Tuple[int, int, int], optional

The factor by which to upscale the simulation. If a single integer is provided, it is applied uniformly across all axes. If a tuple of three integers is provided, each axis is scaled individually. Defaults to 1.

**kwargsDict[str, Any]

Additional keyword arguments passed to the parent Feature class.

Attributes#

__distributed__bool

Indicates whether this feature distributes computation across inputs. Always False for Upscale.

Methods#

get(image, factor, **kwargs)

Scales up the pipeline, performs computations, and scales down result.

Example#

>>> import deeptrack as dt
>>> optics = dt.Fluorescence()
>>> particle = dt.Sphere()
>>> pipeline = optics(particle)
>>> upscaled_pipeline = dt.Upscale(pipeline, factor=4)

Methods Summary

get(image, factor, **kwargs)

Scale up resolution of feature pipeline and scale down result.

Methods Documentation

get(image: ndarray, factor: int | Tuple[int, int, int], **kwargs: Dict[str, Any]) ndarray#

Scale up resolution of feature pipeline and scale down result.

Parameters#

imagenp.ndarray

The input image to process.

factorint or Tuple[int, int, int]

The factor by which to upscale the simulation. If a single integer is provided, it is applied uniformly across all axes. If a tuple of three integers is provided, each axis is scaled individually.

**kwargsDict[str, Any]

Additional keyword arguments passed to the feature.

Returns#

np.ndarray

The processed image at the original resolution.

Raises#

ValueError

If the input factor is not a valid integer or tuple of integers.