ngff_zarr.methods._support

Module Contents

Functions

_spatial_dims_last

_spatial_dims_last_zyx

_channel_dim_last

_dim_scale_factors

Calculate incremental scale factors to apply to previous image.

_update_previous_dim_factors

_align_chunks

_compute_sigma

Compute Gaussian kernel sigma values in pixel units for downsampling. sigma = sqrt((k^2 - 1^2)/(2sqrt(2ln(2)))^2) Ref https://discourse.itk.org/t/resampling-to-isotropic-signal-processing-theory/1403/16 https://doi.org/10.1007/978-3-319-24571-3_81 http://discovery.ucl.ac.uk/1469251/1/scale-factor-point-5.pdf

_get_block

Helper method for accessing an enumerated chunk from input

_next_scale_metadata

Compute the next scale metadata based on the previous image and scale factor.

_next_block_shape

Compute the next block shape based on the previous image and scale factor.

Data

API

ngff_zarr.methods._support._spatial_dims

None

ngff_zarr.methods._support._spatial_dims_last(
ngff_image: ngff_zarr.ngff_image.NgffImage,
) ngff_zarr.ngff_image.NgffImage
ngff_zarr.methods._support._spatial_dims_last_zyx(
ngff_image: ngff_zarr.ngff_image.NgffImage,
) ngff_zarr.ngff_image.NgffImage
ngff_zarr.methods._support._channel_dim_last(
ngff_image: ngff_zarr.ngff_image.NgffImage,
) ngff_zarr.ngff_image.NgffImage
ngff_zarr.methods._support._dim_scale_factors(
dims,
scale_factor,
previous_dim_factors,
original_image=None,
previous_image=None,
)

Calculate incremental scale factors to apply to previous image.

When original_image and previous_image are provided, calculates the exact incremental factor needed to reach the target size from the previous size. This ensures we get exact 1x, 2x, 3x, 4x sizes even with incremental downsampling.

ngff_zarr.methods._support._update_previous_dim_factors(scale_factor, spatial_dims, previous_dim_factors)
ngff_zarr.methods._support._align_chunks(previous_image, default_chunks, dim_factors)
ngff_zarr.methods._support._compute_sigma(shrink_factors: List[int]) List[float]

Compute Gaussian kernel sigma values in pixel units for downsampling. sigma = sqrt((k^2 - 1^2)/(2sqrt(2ln(2)))^2) Ref https://discourse.itk.org/t/resampling-to-isotropic-signal-processing-theory/1403/16 https://doi.org/10.1007/978-3-319-24571-3_81 http://discovery.ucl.ac.uk/1469251/1/scale-factor-point-5.pdf

Note: If input spacing / output sigma in physical units, the function would be sigma = sqrt((input_spacing^2*(k^2 - 1^2))/(2sqrt(2ln(2)))^2)

input spacings: List Input image physical spacings in xyzt order

shrink_factors: List Shrink ratio along each axis in xyzt order

result: List Standard deviation of Gaussian kernel along each axis in xyzt order

ngff_zarr.methods._support._get_block(previous_image: ngff_zarr.ngff_image.NgffImage, block_index: int)

Helper method for accessing an enumerated chunk from input

ngff_zarr.methods._support._next_scale_metadata(
previous_image: ngff_zarr.ngff_image.NgffImage,
dim_factors: dict,
spatial_dims: tuple,
) tuple

Compute the next scale metadata based on the previous image and scale factor.

ngff_zarr.methods._support._next_block_shape(
previous_image: ngff_zarr.ngff_image.NgffImage,
dim_factors: dict,
spatial_dims: tuple,
block_input: numpy.typing.ArrayLike,
) tuple

Compute the next block shape based on the previous image and scale factor.