Radiomics#

class zrad.radiomics.extractor.Radiomics(aggr_dim='3D', aggr_method='AVER', slice_weighting=False, slice_median=False)[source]#

Extract radiomics features from prepared ROI data.

Radiomics consumes a fully prepared RoiData instance. Preprocessing steps are responsible for building the intensity mask, applying re-segmentation, and preparing texture or IVH intensity images before extraction.

Supported feature families are:

  • "morphology"

  • "local_intensity"

  • "intensity_statistics"

  • "intensity_histogram"

  • "glcm"

  • "glrlm"

  • "glszm"

  • "gldzm"

  • "ngtdm"

  • "ngldm"

  • "ivh"

"morphology" includes Moran’s I and Geary’s C for 3D ROIs, including default extraction. Both share an exact hybrid FFT or blocked calculation. They can also be selected by their individual feature names.

Parameters:
  • aggr_dim ({"2D", "2.5D", "3D"}, default="3D") – Spatial aggregation dimensionality for texture features. This affects GLCM, GLRLM, GLSZM, GLDZM, NGTDM, and NGLDM feature names and values.

  • aggr_method ({"MERG", "AVER", "SLICE_MERG", "DIR_MERG"}, default="AVER") – Texture aggregation strategy across directions and slices. This is used by GLCM and GLRLM features.

  • slice_weighting (bool, default=False) – Weight 2D slice-wise texture averages by slice ROI size.

  • slice_median (bool, default=False) – Aggregate 2D slice-wise texture values by median instead of mean.

Methods

extract_features([roi_data, families, ...])

Run radiomics feature extraction.

Radiomics.extract_features(roi_data=None, families=None, features=None, include_metadata=False)[source]#

Run radiomics feature extraction.

Parameters:
  • roi_data (RoiData) – Prepared ROI data containing at least image, morphological_mask, and intensity_mask. Texture and IVH feature families additionally require their corresponding prepared fields on RoiData.

  • families (str or sequence of str, optional) –

    Feature families to extract. Supported names are: "morphology", "local_intensity", "intensity_statistics", "intensity_histogram", "glcm", "glrlm", "glszm", "gldzm", "ngtdm", "ngldm", and "ivh".

    If omitted, all default-enabled families supported by the prepared RoiData are extracted. Use "all" to extract every supported family. Morphology includes Moran’s I and Geary’s C. Repeated family selections are calculated once.

  • features (str or sequence of str, optional) – Individual feature names to extract. Names may come from one or more feature families. Use either families or features, not both. For texture features, either configured output names or base feature names can be supplied. Base names are mapped to the configured output names for the current aggregation settings.

  • include_metadata (bool, default=False) – If True, append extraction metadata to the returned dictionary. Metadata currently includes the minimum bounding-box side length, voxel count, and number of discretized texture bins.

Returns:

features – Flat dictionary mapping feature names to calculated values.

Return type:

dict

Raises:
  • TypeError – If roi_data is not a RoiData instance.

  • ValueError – If required ROI fields are missing, if an unknown family or feature is requested, or if both families and features are set.

  • DataStructureError – If a requested family is not supported for the current image shape or prepared ROI data.

Notes

Feature availability depends on the prepared RoiData:

  • "morphology" requires a 3D ROI.

  • "intensity_histogram" and texture families require texture_discretized_image.

  • "ivh" requires ivh_intensity_image and IVH discretization metadata.

  • "local_intensity" and "intensity_statistics" use the non-discretized intensity mask.