extract_voxel_texture

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.

extract_voxel_texture(image: ImageVolume, mask: MaskVolume, *, kernel_radius: int = 3, bin_width: float = 12.0, feature_classes: Mapping[str, Sequence[str]] | None = None, params: Dict[str, Any] | None = None, voxel_batch: int | str = 1000, use_torch_radiomics: str | bool = 'auto', use_gpu_matrices: str | bool = 'auto') → VoxelFeatureField[source]

Extract a per-voxel texture table from one image and one mask.

This is the atomic teaching / experiment call. Paper combinations are repeated calls on the same volumes with different knobs, for example kernel_radius=1 vs kernel_radius=3 (R1 vs R3) or bin_width=12 vs bin_width=25 (B12 vs B25). The returned VoxelFeatureField is the input to precision_panel().

Parameters:
  • image – Intensity volume.

  • mask – ROI mask; one row is emitted per foreground voxel.

  • kernel_radius – Neighbourhood radius in voxels (the paper’s R). Must be a positive int. Radius 1 is 3x3x3; radius 3 is 7x7x7. Default 3.

  • bin_width – Grey-level discretisation width (the paper’s B). Must be a positive float. Typical CT pair is 12 vs 25 HU. Default 12.0.

  • feature_classes – Optional PyRadiomics class-to-names map, e.g. {"firstorder": ["Entropy", "Mean"], "glcm": ["Contrast"]}. Default None (bundled voxel preset, unless params is set).

  • params – Full in-memory PyRadiomics settings. Default None. Mutually exclusive with feature_classes. bin_width still overwrites setting.binWidth.

  • voxel_batch – ROI voxels per batch. Allowed: positive int or "auto" (size from VRAM). Default 1000.

  • use_torch_radiomics – Allowed "auto", True, or False. Default "auto".

  • use_gpu_matrices – Allowed "auto", True, or False. Default "auto". GPU matrices stay bit-identical to CPU.

Returns:

One row per ROI voxel, one column per enabled feature. Provenance carries the extractor Spec.

Raises:

HABITAPIError – When feature_classes and params are both set, or kernel_radius is not positive.

See also

habit.voxel_features.VoxelRadiomicsFeatures

Subject-level extractor this function constructs for one image/mask pair.

Examples using habit.voxel_features.extract_voxel_texture

Extracting a voxel texture

Extracting a voxel texture

Clustering habitats from a texture field

Clustering habitats from a texture field

Per-habitat radiomics

Per-habitat radiomics

Precise voxel features

Precise voxel features