aligned_image
Note
This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the Habitat Guide and Python API guide (v2.0) for usage.
- aligned_image(subject: Subject, modality: str, mask: ImageVolume, *, owner: str, on_geometry_mismatch: str = 'resample_mask') ndarray[source]
Read one modality after ensuring it shares the ROI’s voxel grid.
Callers should normally obtain
maskfromroi_voxels()(oralign_subject_masks()) so the mask already sits on a reference image grid. When a residual mismatch remains (for example another modality on a different grid than the reference), the default policy resamples the mask onto this modality for the compatibility check path used by single-modality reads; multi-modality extractors that share onevoxel_indexstill require all modalities to agree with the mask returned byroi_voxels().- Parameters:
subject – Subject providing the image.
modality – Modality key to read.
mask – The ROI mask whose grid the image must match.
owner – Extractor name used in the error message.
on_geometry_mismatch –
"resample_mask"(default) or"strict". Underresample_mask, a mismatch raises only when the mask cannot be treated as already aligned (see note above); the helper still raisesGeometryErrorso shared voxel indices stay consistent across modalities.
- Returns:
The modality’s voxel array.
- Raises:
GeometryError – If the modality and the mask are on different grids.