pymif.microscope_manager.utils.axes

Attributes

ALLOWED_AXES

ALLOWED_AXIS_SET

SPATIAL_AXES

SPATIAL_AXIS_SET

DATA_TYPES

Functions

infer_axes_from_ndim(→ tuple[str, Ellipsis])

Infer a legacy-friendly axes tuple from an array dimensionality.

normalize_axes(→ tuple[str, Ellipsis])

Return validated, lowercase axis labels.

axes_to_string(→ str)

Normalize axes and return the compact string representation.

spatial_axes_in_order(→ tuple[str, Ellipsis])

Return the spatial axis labels present in axes, preserving order.

spatial_axis_indices(→ tuple[int, Ellipsis])

Return the integer positions of spatial axes in axes.

normalize_data_type(→ str)

Normalize PyMIF's image-vs-label flag to intensity or label.

spatial_values_for_axes(→ tuple[float, ...)

Normalize a scalar/spatial sequence to the spatial axes present.

index_list_from_selection(→ list[int])

Return explicit indices represented by an int, slice or index sequence.

selection_length_and_spacing(→ tuple[int, int])

Return selected length and uniform spacing for metadata updates.

Module Contents

pymif.microscope_manager.utils.axes.ALLOWED_AXES: tuple[str, Ellipsis] = ('t', 'c', 'z', 'y', 'x')[source]
pymif.microscope_manager.utils.axes.ALLOWED_AXIS_SET: set[str][source]
pymif.microscope_manager.utils.axes.SPATIAL_AXES: tuple[str, Ellipsis] = ('z', 'y', 'x')[source]
pymif.microscope_manager.utils.axes.SPATIAL_AXIS_SET: set[str][source]
pymif.microscope_manager.utils.axes.DATA_TYPES: tuple[str, Ellipsis] = ('intensity', 'label')[source]
pymif.microscope_manager.utils.axes.infer_axes_from_ndim(ndim: int) tuple[str, Ellipsis][source]

Infer a legacy-friendly axes tuple from an array dimensionality.

pymif.microscope_manager.utils.axes.normalize_axes(axes: str | collections.abc.Sequence[str] | None, ndim: int | None = None) tuple[str, Ellipsis][source]

Return validated, lowercase axis labels.

PyMIF Zarr datasets intentionally support only image-style axes made from the labels t, c, z, y and x. Any subset and any order of those labels is accepted, but labels must be unique and must match the array dimensionality when ndim is supplied.

pymif.microscope_manager.utils.axes.axes_to_string(axes: str | collections.abc.Sequence[str] | None, ndim: int | None = None) str[source]

Normalize axes and return the compact string representation.

pymif.microscope_manager.utils.axes.spatial_axes_in_order(axes: str | collections.abc.Sequence[str]) tuple[str, Ellipsis][source]

Return the spatial axis labels present in axes, preserving order.

pymif.microscope_manager.utils.axes.spatial_axis_indices(axes: str | collections.abc.Sequence[str]) tuple[int, Ellipsis][source]

Return the integer positions of spatial axes in axes.

pymif.microscope_manager.utils.axes.normalize_data_type(data_type: str | None = None, *, is_label: bool | None = None) str[source]

Normalize PyMIF’s image-vs-label flag to intensity or label.

pymif.microscope_manager.utils.axes.spatial_values_for_axes(value: numbers.Real | collections.abc.Sequence[numbers.Real] | None, axes: str | collections.abc.Sequence[str], *, name: str, default: numbers.Real = 1, allow_float: bool = True) tuple[float, Ellipsis] | tuple[int, Ellipsis][source]

Normalize a scalar/spatial sequence to the spatial axes present.

Sequences may be either length n_spatial in the order used by axes or length 3 in legacy ZYX order. The latter keeps old calls like downscale_factor=(1, 2, 2) working for datasets that contain only YX.

pymif.microscope_manager.utils.axes.index_list_from_selection(selection: Any, axis_size: int) list[int][source]

Return explicit indices represented by an int, slice or index sequence.

pymif.microscope_manager.utils.axes.selection_length_and_spacing(selection: Any, axis_size: int, axis_name: str) tuple[int, int][source]

Return selected length and uniform spacing for metadata updates.