ImageVolume
Note
This page is a reference documentation. It only explains the class signature, and not how to use it. Please refer to the Habitat Guide and Python API guide (v2.0) for usage.
- class ImageVolume(data: ~numpy.ndarray, spacing: ~typing.Tuple[float, ...], origin: ~typing.Tuple[float, ...], direction: ~typing.Tuple[float, ...], modality: str | None = None, subject_id: str | None = None, timepoint: str | None = None, source: ~pathlib.Path | None = None, metadata: ~typing.Mapping[str, ~typing.Any] = <factory>)[source]
Bases:
objectAn image array with explicit physical-space metadata.
datafollows the NumPy convention used bySimpleITK.GetArrayFromImage. Physical metadata remains in SimpleITK axis order. Callers should use this object rather than infer geometry from array axes.The volume also satisfies
ImageRef:geometryreturns aGeometryandload()returns the already-resident array.- classmethod from_array(data: ndarray, *, spacing: Tuple[float, ...] | None = None, origin: Tuple[float, ...] | None = None, direction: Tuple[float, ...] | None = None, modality: str | None = None, subject_id: str | None = None, timepoint: str | None = None, metadata: Mapping[str, Any] | None = None) ImageVolume[source]
Create a volume from an array using identity physical metadata by default.
- classmethod from_geometry(array: ndarray, geometry: Geometry, *, modality: str | None = None, subject_id: str | None = None, timepoint: str | None = None, metadata: Mapping[str, Any] | None = None) ImageVolume[source]
Build a volume from an array plus a
Geometryvalue.
- classmethod from_sitk(image: Any, *, modality: str | None = None, subject_id: str | None = None, timepoint: str | None = None, source: str | Path | None = None, metadata: Mapping[str, Any] | None = None) ImageVolume[source]
Convert a
SimpleITK.Imagewithout discarding its physical metadata.
- __init__(data: ~numpy.ndarray, spacing: ~typing.Tuple[float, ...], origin: ~typing.Tuple[float, ...], direction: ~typing.Tuple[float, ...], modality: str | None = None, subject_id: str | None = None, timepoint: str | None = None, source: ~pathlib.Path | None = None, metadata: ~typing.Mapping[str, ~typing.Any] = <factory>) None
Examples using habit.contracts.ImageVolume
Comparing habitat maps with and without preprocessing