Overview

The Gray Level Co-occurrence Matrix (GLCM) is a fundamental texture analysis method that quantifies spatial relationships between voxel intensities in medical images. GLCM features capture information about the frequency of intensity value pairs occurring at specific spatial offsets, providing powerful descriptors of image texture and heterogeneity.

Radiomics.jl implements comprehensive GLCM feature extraction for both 2D and 3D medical images. The library computes co-occurrence matrices across multiple directions and distances, aggregating the results to produce rotationally invariant texture features suitable for radiomics analysis.

Extracted Features

The following GLCM-based texture features are computed:

Autocorrelation

Measures correlation between intensities of neighboring voxels, quantifying spatial intensity dependencies.

AC = Σᵢⱼ i·j·P(i,j)
Cluster Prominence

Indicates sharpness of deviations from the mean; detects asymmetric patterns in texture.

CP = Σᵢⱼ (i+j-μₓ-μᵧ)⁴·P(i,j)
Cluster Shade

Measures asymmetry of cluster distributions, capturing skewness in spatial intensity patterns.

CS = Σᵢⱼ (i+j-μₓ-μᵧ)³·P(i,j)
Cluster Tendency

Quantifies the degree of clustering of similar intensity values in the image.

CT = Σᵢⱼ (i+j-μₓ-μᵧ)²·P(i,j)
Contrast

Measures local intensity contrast between neighboring voxels, indicating texture variation.

C = Σᵢⱼ (i-j)²·P(i,j)
Correlation

Statistical correlation between intensities of neighboring voxels, reflecting linear dependencies.

ρ = Σᵢⱼ [(i-μₓ)(j-μᵧ)·P(i,j)]/(σₓσᵧ)
Joint Energy

Uniformity of the GLCM; high values indicate homogeneous texture patterns.

E = Σᵢⱼ P(i,j)²
Joint Entropy

Measures the complexity or disorder of the GLCM, quantifying texture randomness.

H = -Σᵢⱼ P(i,j)·log₂(P(i,j))
Inverse Difference Moment (IDM)

Measures homogeneity; higher values indicate less local variation and smoother textures.

IDM = Σᵢⱼ P(i,j)/(1+(i-j)²)
Normalized IDM (IDMN)

Normalized version of IDM, providing scale-invariant homogeneity measurement.

IDMN = Σᵢⱼ P(i,j)/(1+(i-j)²/N²)
Inverse Difference (ID)

Similar to IDM, measures proximity of intensity values to the central voxel.

ID = Σᵢⱼ P(i,j)/(1+|i-j|)
Normalized Inverse Difference (IDN)

Normalized version of ID for consistent comparison across different images.

IDN = Σᵢⱼ P(i,j)/(1+|i-j|/N)
Inverse Variance

Measures dispersion of GLCM values, indicating texture heterogeneity.

IV = Σᵢⱼ P(i,j)/(i-j)² (i≠j)
Maximum Probability

Maximum co-occurrence probability between gray levels, identifying dominant texture patterns.

MP = maxᵢⱼ P(i,j)
Sum of Squares

Measures total variation relative to the mean intensity in the GLCM.

SS = Σᵢⱼ (i-μ)²·P(i,j)
Difference Average

Mean of intensity differences between neighboring voxels across the GLCM.

DA = Σₖ k·Pₓ₋ᵧ(k)
Difference Entropy

Disorder of intensity differences, quantifying complexity of local variations.

DE = -Σₖ Pₓ₋ᵧ(k)·log₂(Pₓ₋ᵧ(k))
Difference Variance

Variance of intensity differences between neighbors, measuring spread of local contrasts.

DV = Σₖ (k-DA)²·Pₓ₋ᵧ(k)
Sum Average

Mean of sums of GLCM value pairs, representing average combined intensities.

SA = Σₖ k·Pₓ₊ᵧ(k)
Sum Entropy

Entropy of sums; measures complexity of combined intensity distributions.

SE = -Σₖ Pₓ₊ᵧ(k)·log₂(Pₓ₊ᵧ(k))
Joint Average

Global mean of GLCM values, providing an average co-occurrence measure.

JA = Σᵢⱼ i·P(i,j) = μₓ
IMC1 / IMC2

Informational measures of correlation between marginal distributions, capturing mutual information.

IMC1 = (H-HXY1)/(max(Hₓ,Hᵧ))
Maximal Correlation Coefficient (MCC)

Measures maximum linear correlation between rows and columns of the GLCM matrix.

MCC = √(second largest eigenvalue of Q)

Notation Legend

The following symbols are used in the formulas above:

  • P(i,j) = normalized co-occurrence probability at gray levels i and j
  • N = number of gray levels in the image
  • μₓ, μᵧ = mean values along x and y dimensions of the GLCM
  • σₓ, σᵧ = standard deviations along x and y dimensions
  • Pₓ₊ᵧ(k) = probability of sum of gray levels (i+j=k)
  • Pₓ₋ᵧ(k) = probability of difference of gray levels (|i-j|=k)
  • Hₓ, Hᵧ = marginal entropies
  • HXY1, HXY2 = conditional entropies
  • Σᵢⱼ = summation over all i,j pairs in the GLCM
  • Σₖ = summation over all k values

Implementation Details

These functions are designed for advanced radiomics analysis on medical images. The 2D wrapper enables the 3D calculation methodology to be applied to planar images by adding a singleton dimension, ensuring consistency across different dimensionalities. Features are aggregated across multiple spatial directions to provide rotationally invariant descriptors.