Methods¶

To avoid aliasing artifacts when generating a multiscale representation, it is crucial to smooth the input image before downsampling. Different downsampling methods are available, primarily differing in the smoothing method that is applied prior to resampling. There can also be differences due to the interpolator used to resample, but these tend to be negligible since we are downsampling.

These methods vary in their:

  • Amount of artifacts

  • Speed

  • Hardware requirements and portability

  • Appropriateness for intensity or label images

The ngff_zarr.to_multiscales function accepts the following methods, enumerated in ngff_zarr.Methods.

ITKWASM_GAUSSIAN¶

Smoothed with a discrete gaussian filter to generate a scale space, ideal for intensity images.

ITK-Wasm implementation is extremely portable. SIMD accelerated.

The default method.

To use an NVIDIA CUDA GPU-accelerated version, install the itkwasm-downsample-cucim package:

Install cuCIM, then:

pip install itkwasm-downsample-cucim

And GPU-accelerated filtering is applied by default after installation.

ITKWASM_BIN_SHRINK¶

Uses the local mean for the output value. WebAssembly build.

Fast but generates more artifacts than gaussian-based methods.

Appropriate for intensity images.

An NVIDIA CUDA GPU-accelerated version can be installed similar to ITKWASM_GAUSSIAN above.

ITKWASM_LABEL_IMAGE¶

A sample is the mode of the linearly weighted local labels in the image.

Fast and minimal artifacts. For label images.

ITK_GAUSSIAN¶

Similar to ITKWASM_GAUSSIAN, but the package is built to native binaries.

Install required dependencies with:

pip install "ngff-zarr[itk]"

To use a GPU-accelerated version, install the itk-vkfft package:

pip install itk-vkfft

And GPU-accelerated, FFT-based filtering is applied by default after installation.

ITK_BIN_SHRINK¶

Uses the local mean for the output value. Native binary build.

Fast but generates more artifacts than gaussian-based methods.

Appropriate for intensity images.

Install required dependencies with:

pip install "ngff-zarr[itk]"

DASK_IMAGE_GAUSSIAN¶

Smoothed with a discrete gaussian filter to generate a scale space, ideal for intensity images.

dask-image implementation based on scipy.

Install required dependencies with:

pip install "ngff-zarr[dask-image]"

DASK_IMAGE_MODE¶

Local mode for label images.

Fewer artifacts than simple nearest neighbor interpolation.

Slower.

DASK_IMAGE_NEAREST¶

Nearest neighbor for label images.

Will have many artifacts for high-frequecy content and / or multiple scales.

Install required dependencies with:

pip install "ngff-zarr[dask-image]"