CoLlAGe radiomics

Co-occurrence of Local Anisotropic Gradient Orientations describes local disorder in image gradients. This package provides thirteen voxel-wise Haralick statistics, a medical-image CLI, reproducible examples, and a 3D Slicer extension.

The scientific reference is Prasanna, Tiwari, and Madabhushi (2016), Scientific Reports 6:37241. The source and issue tracker are at radxtools/collageradiomics.

Python API

CoLlAGe descriptors for finite, aligned 2D and 3D NumPy arrays.

class collageradiomics.HaralickFeature(*values)

Enumeration Helper For Haralick Features

Parameters:

IntEnum (HaralickFeature) – Enumeration Helper For Haralick Features

class collageradiomics.DifferenceVarianceInterpretation(*values)

Difference variance has two interpretations, as the variance of |x-y| or as the variance of P(|x-y|). See: https://ieeexplore.ieee.org/document/4309314

Parameters:

Enum (DifferenceVarianceInterpretation) – Enumeration Helper For Haralick Features

class collageradiomics.Collage(img_array, mask_array, svd_radius=5, verbose_logging=False, cooccurence_angles=None, difference_variance_interpretation=DifferenceVarianceInterpretation.XMinusYVariance, haralick_window_size=-1, num_unique_angles=64, progress_callback=None)

This is the main object in the Collage calculation system. Usage: create a Collage object and then call the execute() function.

Parameters:
  • img_array (numpy.ndarray) – image to run collage upon

  • mask_array (numpy.ndarray) – mask that correlates with the image

  • svd_radius (int, optional) – radius of svd. Defaults to 5.

  • verbose_logging (bool, optional) – This parameter is now ignored. Please use the python logging module.

  • cooccurence_angles (list, optional) – list of angles to use in the cooccurence matrix. Defaults to [x*numpy.pi/4 for x in range(8)]

  • difference_variance_interpretation (DifferenceVarianceInterpretation, optional) – Difference variance has two interpretations, as the variance of |x-y| or as the variance of P(|x-y|).].Defaults to DifferenceVarianceInterpretation.XMinusYVariance.

  • haralick_window_size (int, optional) – size of rolling window for texture calculations. Defaults to -1.

  • num_unique_angles (int, optional) – number of bins to use for the texture calculation. Defaults to 64.

  • progress_callback (Callable[[str, int, int], None] | None)

property img_array: NDArray[Any]

The original image.

Getter:

Returns the original image array.

Type:

np.ndarray

property mask_array: NDArray[bool]

Array passed into Collage.

Getter:

Returns the original mask array.

Type:

np.ndarray

property is_3D: bool

Whether we are using 3D collage calculations (True) or 2D (False)

property svd_radius: int

SVD radius is used to calculate the pixel radius for the dominant angle calculation.

Getter:

Returns the SVD radius.

Type:

int

property verbose_logging: bool

This parameter is now ignored. Please use the python logging module.

Getter:

Returns True if on.

Type:

bool

property cooccurence_angles: tuple[float, ...]

Iterable of angles that will be used in the cooccurence matrix.

Getter:

Returns the Iterable of cooccurence angles.

Type:

int

property difference_variance_interpretation: DifferenceVarianceInterpretation

Difference variance has two interpretations, as the variance of |x-y| or as the variance of P(|x-y|).]. Defaults to DifferenceVarianceInterpretation.XMinusYVariance.

Getter:

Returns requested variance interpretation.

Type:

DifferenceVarianceInterpretation

property haralick_window_size: int

Number of pixels around each pixel to calculate a haralick texture.

Getter:

Returns requested number of pixels.

Type:

int

property num_unique_angles: int

Number of bins to use for texture calculations. Defaults to 64.

Getter:

Returns requested number of unique angles to bin into.

Type:

int

property collage_output: NDArray[float64]

Array representing collage upon the mask within the full images. If the input was 2D, the output will be height×width×13 where “13” is the number of haralick textures. If the input was 3D, the output will be height×width×depth×13x2 where “2” is the primary angle (element 0) or the secondary angle (element 1)

The output will have numpy.nan values everywhere outside the masked region.

Getter:

Returns array the same shape as the original image with collage in the mask region.

Type:

numpy.ndarray

get_single_feature_output(which_feature)

Output a single collage output feature. If this was a 3D calculation, the output will be of size height×width×depth×2 where the “2” represents the collage calculation from the primary angle (0) or secondary angle (1).

param which_feature:

Either an integer from 0 to 12 (inclusive) or a HaralickFeature enum value

type which_feature:

HaralickFeature

Parameters:

which_feature (int | HaralickFeature)

Return type:

NDArray[float64]

execute()

Return feature maps at input size, with NaN only outside the mask.

Image edges are extended by replication. SVD neighborhoods and Haralick neighborhoods both include their complete halo, including for small ROIs. In 3D, gradients use neighboring slices and textures remain slice-wise.

Return type:

NDArray[float64]