roi_voxels
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.
- roi_voxels(subject: Subject, roi: str | None, *, reference_modality: str | None = None, on_geometry_mismatch: str = 'resample_mask') Tuple[MaskVolume, ndarray, ndarray][source]
Return the ROI mask together with its boolean selector and coordinates.
When the mask and a reference image modality disagree on geometry, the default policy nearest-neighbour resamples the mask onto the image grid (see
habit.image_preprocessing.geometry). Passon_geometry_mismatch="strict"to raiseGeometryErrorinstead.- Parameters:
subject – Subject providing the mask (and images for alignment).
roi – Mask key, or
Nonefor the subject’s single mask.reference_modality – Image key used as the alignment target. When
None, the first modality in insertion order is used.on_geometry_mismatch –
"resample_mask"(default) or"strict".
- Returns:
(mask, inside, voxel_index)whereinsideselects ROI voxels on the (possibly resampled) mask grid andvoxel_indexlists their coordinates in the same C order the selector produces.