ngff_zarr.methods._itkwasm

Module Contents

Functions

_check_wasm_block_size

Raise before building a graph whose blocks the wasm sandbox cannot hold.

_trim_to_shrink_multiple

Drop the voxels past the last full shrink window on each spatial axis.

_itkwasm_blur_and_downsample

Blur and then downsample a given image chunk

_itkwasm_chunk_bin_shrink

Compute the local mean and downsample on a given image chunk

_itkwasm_chunk_bin_shrink_nd

Bin-shrink a block that may include leading non-spatial dimensions.

_downsample_itkwasm

Data

API

ngff_zarr.methods._itkwasm._image_dims: tuple[str, str, str, str]

(‘x’, ‘y’, ‘z’, ‘t’)

ngff_zarr.methods._itkwasm._MAX_VECTOR_COMPONENTS

8

ngff_zarr.methods._itkwasm._WASM_BLOCK_LIMITS

None

ngff_zarr.methods._itkwasm._check_wasm_block_size(
image: ngff_zarr.ngff_image.NgffImage,
is_vector: bool,
smoothing: str,
kernel_radius=None,
) None

Raise before building a graph whose blocks the wasm sandbox cannot hold.

A block handed to itkwasm spans the spatial chunk, the channel chunk when channels travel as vector components, and the overlap the Gaussian filter reads past the chunk. Chunks smaller than that overlap are merged by map_overlap before the filter runs, so the merged chunks are what count. Integer input to the Gaussian filter is converted to float32 first, which is the size that counts.

ngff_zarr.methods._itkwasm._trim_to_shrink_multiple(
image: ngff_zarr.ngff_image.NgffImage,
dim_factors: dict,
) ngff_zarr.ngff_image.NgffImage

Drop the voxels past the last full shrink window on each spatial axis.

BinShrink produces floor(n / factor) samples along an axis; the remainder never contributes to the output, and a block made only of that remainder shrinks to zero voxels, which aborts the wasm sandbox.

ngff_zarr.methods._itkwasm._itkwasm_blur_and_downsample(
image_data,
shrink_factors,
kernel_radius,
smoothing,
is_vector=False,
)

Blur and then downsample a given image chunk

ngff_zarr.methods._itkwasm._itkwasm_chunk_bin_shrink(image_data, shrink_factors, is_vector=False)

Compute the local mean and downsample on a given image chunk

ngff_zarr.methods._itkwasm._itkwasm_chunk_bin_shrink_nd(
block,
shrink_factors,
n_spatial_dims,
is_vector=False,
)

Bin-shrink a block that may include leading non-spatial dimensions.

When the block has more dimensions than the number of spatial dims (e.g. it includes time and/or channel axes), iterate over every combination of non-spatial indices, apply bin-shrink to each spatial sub-block, and reassemble the result.

ngff_zarr.methods._itkwasm._downsample_itkwasm(
ngff_image: ngff_zarr.ngff_image.NgffImage,
default_chunks,
out_chunks,
scale_factors,
smoothing,
)