LocalEntropyVoxelFeatures

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 LocalEntropyVoxelFeatures(modalities: Sequence[str] = (), roi: str | None = None, kernel_size: int = 3, bins: int = 32, modality: str | None = None, as_: str | None = None)[source]

Bases: object

Shannon entropy of each voxel’s intensity neighbourhood.

Where raw intensity says how bright a voxel is, local entropy says how disordered its surroundings are, which separates homogeneous tissue from structurally mixed tissue at the same intensity. The entropy map is computed over the whole image and then restricted to the ROI, exactly as in v0.1, so voxels at the ROI border still see their true neighbourhood.

Parameters:
  • modality – Single modality key – the explicit form used inside feature trees. Mutually exclusive with modalities.

  • modalities – Modality keys to describe, 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; None uses the subject’s single mask.

  • kernel_size – Neighbourhood edge length in voxels. Even values are incremented to keep the neighbourhood centred, as in v0.1.

  • bins – Histogram bins used to discretise intensities.

__init__(modalities: Sequence[str] = (), roi: str | None = None, kernel_size: int = 3, bins: int = 32, modality: str | None = None, as_: str | None = None) → None[source]
property spec: Spec

Return the algorithm specification used for provenance.

__call__(subject: Subject) → VoxelFeatureField[source]

Compute per-voxel local entropy for one subject.

Parameters:

subject – Subject providing the requested modalities and mask.

Returns:

One row per ROI voxel, one local_entropy-{source} column per modality, where source is the as_ alias when given, else the modality name.

Raises:

Examples using habit.voxel_features.LocalEntropyVoxelFeatures

/auto_examples/04_habitat_maps/plot_07_voxel_texture

Extracting a voxel texture

/auto_examples/04_habitat_maps/plot_09_texture_habitats

Clustering habitats from a texture field