VoxelRadiomicsFeatures
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 VoxelRadiomicsFeatures(modalities: Sequence[str] = (), roi: str | None = None, params_file: str | None = None, params: Dict[str, Any] | None = None, kernel_radius: int = 3, voxel_batch: int | str = 1000, use_torch_radiomics: str | bool = 'auto', torch_device: str = 'auto', torch_dtype: str = 'float64', use_gpu_matrices: str | bool = 'auto', output_float32: bool = True, class_progress: bool = False, crop_to_roi: bool = True, cache_dir: str | None = None, modality: str | None = None, as_: str | None = None)[source]
Bases:
objectDescribe every ROI voxel by a PyRadiomics feature vector.
One extraction pass runs per modality and each column is suffixed with
-{modality}, the v0.1 scheme forconcat(voxel_radiomics(m1), voxel_radiomics(m2)).- Parameters:
modality – Single modality key – the explicit form used inside feature trees. Mutually exclusive with
modalities.modalities – Modality keys to extract from, in feature order; empty selects every image the subject carries.
as – Optional output-column alias. Valid only with exactly one resolved modality; the column suffix then uses the alias.
roi – Mask key defining the region of interest;
Noneuses the subject’s single mask.params_file – Path to a PyRadiomics parameter YAML;
Noneselects the bundled voxel preset.params – Inline PyRadiomics settings, for API callers holding settings in memory. Mutually exclusive with
params_file.kernel_radius – Neighbourhood radius in voxels; radius 1 is a 3x3x3 cube, radius 3 a 7x7x7 cube.
voxel_batch – ROI voxels per batch. Default 1000. Pass a larger integer on a 12–24 GB GPU, or
"auto"to pick from VRAM.use_torch_radiomics –
"auto",TrueorFalse– whether to use the TorchRadiomics path when torch and CUDA are present.torch_device – Torch device string, or
"auto"to select one.torch_dtype –
"float64"(default) or"float32"for the torch path.use_gpu_matrices –
"auto",TrueorFalse– whether the TorchRadiomics texture matrices (GLCM, …) are built on GPU byhabit.kernels.radiomics.gpumatricesinstead of the single-threaded PyRadiomics C extension."auto"follows the torch device. Bit-identical counts either way.output_float32 – Downcast the feature columns to float32, the v0.1 default that keeps large voxel tables manageable.
class_progress – When True, print and tqdm each PyRadiomics class (firstorder, glcm, …). Default False: one
execute()with no per-class lines;Cohort.mapstill shows subject progress.crop_to_roi – When True (default), crop image and mask to the ROI bounding box plus
kernel_radiuspadding before callingexecute. PyRadiomics re-applies the identical crop internally, so feature values are bit-identical; the pre-crop just keeps the full-volume diagnostics (sitk.Hash, whole-image statistics) and mask checks off the big volume, saving several seconds per modality on whole-body scans.cache_dir – Optional directory for extracted fields. A hit skips PyRadiomics. The cache key ignores
voxel_batchand device knobs so a later run with a larger batch can reuse the file.
See also
habit.voxel_features.extract_voxel_textureOne image + mask call that constructs this extractor.
- __init__(modalities: Sequence[str] = (), roi: str | None = None, params_file: str | None = None, params: Dict[str, Any] | None = None, kernel_radius: int = 3, voxel_batch: int | str = 1000, use_torch_radiomics: str | bool = 'auto', torch_device: str = 'auto', torch_dtype: str = 'float64', use_gpu_matrices: str | bool = 'auto', output_float32: bool = True, class_progress: bool = False, crop_to_roi: bool = True, cache_dir: str | None = None, modality: str | None = None, as_: str | None = None) None[source]
- __call__(subject: Subject) VoxelFeatureField[source]
Compute per-voxel radiomics for one subject.
- Parameters:
subject – Subject providing the requested modalities and mask.
- Returns:
One row per ROI voxel, one column per feature and modality.
- Raises:
HABITAPIError – If a requested modality is absent, or a modality’s extraction does not cover every ROI voxel.