FileImageRef
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 FileImageRef(path: str | Path, *, is_mask: bool, role_name: str)[source]
Bases:
objectLazy
ImageRefbacked by one image file.Holds only the path plus lazily-read header metadata, so a cohort of thousands of subjects can cross a process boundary without carrying a single voxel. Header fields are cached after the first access; pixel data is only read by
load()/load_volume().- Parameters:
path – Image file readable by SimpleITK.
is_mask – Whether the file holds a label mask (selects
MaskVolumematerialisation and nearest-neighbour semantics downstream).role_name – Modality or ROI name attached to materialised volumes.
- load_volume() ImageVolume | MaskVolume[source]
Materialise with full physical metadata in one read.
- Returns:
An
ImageVolume, or aMaskVolumewhen the reference was created for a mask file.