pymif.microscope_manager.utils.downsampling
Attributes
Functions
|
Normalize scalar or ZYX factor to a 3-tuple. |
Normalize a factor to the spatial axes present in |
|
|
|
|
|
|
|
|
Return level scale ratios relative to ref_level. |
|
Return axis-aware level scale ratios relative to |
|
|
Infer relative spatial level factors from NGFF multiscales metadata. |
Module Contents
- type pymif.microscope_manager.utils.downsampling.SpatialFactor = int | float | Sequence[int | float][source]
- pymif.microscope_manager.utils.downsampling.normalize_spatial_factor(value: SpatialFactor, *, name: str = 'downscale_factor', allow_float: bool = True) SpatialScale | SpatialIntFactor[source]
Normalize scalar or ZYX factor to a 3-tuple.
This helper keeps the old public behavior. Axis-aware code should use
normalize_spatial_factor_for_axes().Scalar 2 -> (2, 2, 2) Tuple (1,2,2) -> (1, 2, 2)
- pymif.microscope_manager.utils.downsampling.normalize_spatial_factor_for_axes(value: SpatialFactor, axes: str | collections.abc.Sequence[str], *, name: str = 'downscale_factor', allow_float: bool = True) SpatialScale | SpatialIntFactor[source]
Normalize a factor to the spatial axes present in
axes.
- pymif.microscope_manager.utils.downsampling.spatial_factor_power(factor: SpatialFactor, exponent: int) SpatialScale[source]
- pymif.microscope_manager.utils.downsampling.spatial_factor_power_for_axes(factor: SpatialFactor, axes: str | collections.abc.Sequence[str], exponent: int) SpatialScale[source]
- pymif.microscope_manager.utils.downsampling.multiply_spatial_scales(scales: collections.abc.Sequence[int | float], factors: SpatialFactor) tuple[float, float, float][source]
- pymif.microscope_manager.utils.downsampling.relative_level_factors(total_levels: int, ref_level: int, downscale_factor: SpatialFactor = 2) list[SpatialScale][source]
Return level scale ratios relative to ref_level.
Example with downscale_factor=(1,2,2), ref_level=0:
level 0 -> (1, 1, 1) level 1 -> (1, 2, 2) level 2 -> (1, 4, 4)
Example with ref_level=1:
level 0 -> (1, 0.5, 0.5) level 1 -> (1, 1, 1) level 2 -> (1, 2, 2)
- pymif.microscope_manager.utils.downsampling.relative_level_factors_for_axes(total_levels: int, ref_level: int, axes: str | collections.abc.Sequence[str], downscale_factor: SpatialFactor = 2) list[SpatialScale][source]
Return axis-aware level scale ratios relative to
ref_level.
- pymif.microscope_manager.utils.downsampling.axis_names_from_multiscales(multiscales: dict[str, Any]) list[str][source]
- pymif.microscope_manager.utils.downsampling._dataset_scale_vector(dataset: dict[str, Any]) collections.abc.Sequence[int | float] | None[source]
- pymif.microscope_manager.utils.downsampling.level_scale_ratios_from_multiscales(multiscales: dict[str, Any], datasets: collections.abc.Sequence[dict[str, Any]], ref_level: int) list[SpatialScale] | None[source]
Infer relative spatial level factors from NGFF multiscales metadata.
Returned tuples are ordered like the spatial axes in the metadata, not necessarily legacy ZYX.