The grey level co-occurrence matrix (GLCM) [Haralick] takes into account the arrangements of pairs of voxels to calculate textural indices. The GLCM is calculated from 13 different directions in 3D with a \(\delta\)-voxel distance (\(\|\overrightarrow{d\|}\)) relationship between neighboured voxels. The index value is the average of the index over the 13 directions in space (X, Y, Z). Six textural indices can be computed from this matrix. An entry \((i,j)\) of GLCM for one direction is equal to:

\begin{equation}
GLCM_{\Delta x,\Delta y}(i,j)= \frac{1}{Pairs_{ROI}}\sum_{p=1}^{N-\Delta x}\sum_{q=1}^{M-\Delta y}
\left\lbrace
\begin{array}{ll}
\mbox{1 if ($I(p,q)=i$, $I(p+\Delta x, q+\Delta y)=j$) } \\
\mbox{ and $I(p,q), I(p+\Delta x, q+\Delta y) \in ROI$ } \\
\mbox{0 otherwise}
\end{array}
\right.
\end{equation}

where \(I(p,q)\) corresponds to voxel \((p,q)\) in an image (\(I\)) of size \(N * M\). The vector \(\overrightarrow{d}=(\Delta x,\Delta y)\) covers the 4 directions (D1, D2, D3, D4, in 2D space or 13 directions (D1, D2, ..., D13, in 3D space and \(Pairs_{ROI}\)

Cost-effective creation of a transposed matrix

To reduce runtime calculation of GLCM matrix involving 26 directions in 3D (8 directions in 2D) the transposed matrix accounting for 13 directions calculated in 3D (and 4 in 2D) is added to the original matrix.

The GLCM describes the distribution of co-occurring pixel values at a given offset. This offset ($\delta$) set to 1 by default, meaning that only neighbour voxels are used to calculate GLCM. It is possible to change this default value from 1 to 10 in the "Distance with neighbours" box, which is in the "Textural Parameters" dialog box, GLCM subpart.

Be careful: if the distance is too large for small ROIs, some entries of the GLCM matrix will not have any meaning. This is detected and the corresponding results in the output Excel file are noted NaN! or Num!

GLCM_Homogeneity is the homogeneity of grey-level voxel pairs.

\begin{equation}
GLCM\_Homogeneity=Average~over~13~directions \left(\sum_{i} \sum_{j} \frac{GLCM(i,j)}{1+|i-j|} \right)
\end{equation}

 

 

GLCM_Energy also called Uniformity or Second Angular Moment, is the uniformity of grey-level voxel pairs.
\begin{equation}
GLCM\_Energy=Average~over~13~directions \left(\sum_{i} \sum_{j} GLCM(i,j)^{2} \right)
\end{equation}

 

 

GLCM_Contrast also called Variance or Inertia, is the local variations in the GLCM.
\begin{equation}
GLCM\_Contrast=Average~over~13~directions \left(\sum_{i} \sum_{j} (i-j)^{2} \cdot GLCM(i,j) \right)
\end{equation}

 

 

GLCM_Correlation is the linear dependency of grey-levels in GLCM.
\begin{equation}
GLCM\_Correlation=Average~over~13~directions \left(\sum_{i} \sum_{j} \frac{(i-\mu_{i})\cdot(j-\mu_{j})\cdot GLCM(i,j)}{\sigma_{i}\cdot \sigma_{j}} \right)
\end{equation}

where \(\mu_{i}\) or \(\mu_{j}\) corresponds to the average on row \(i\) or column \(j\) and \(\sigma_{i}\) and \(\sigma_{j}\) correspond to the variance on row \(i\) or column \(j\).

 


GLCM_Entropy_log10 is the randomness of grey-level voxel pairs.
\begin{equation}
GLCM\_Entropy_{log10}=Average~over~13~directions \left(-\sum_{i} \sum_{j} GLCM(i,j) \cdot log_{10}(GLCM(i,j)+ \epsilon) \right)
\end{equation}
where \(\varepsilon\) = 2e-16
Be aware of the logarithm used in the formula. We use the logarithm with base 10 in LIFEx but the logarithm base 2 is sometimes used in other software ; see _log2 formula.

 

 

GLCM_Entropy_log2 is the randomness of grey-level voxel pairs.
\begin{equation}
GLCM\_Entropy_{log2}=Average~over~13~directions \left(-\sum_{i} \sum_{j} GLCM(i,j) \cdot log_{2}(GLCM(i,j) + \epsilon) \right)
\end{equation}
where \(\varepsilon\) = 2e-16

 


GLCM_Dissimilarity is the variation of grey-level voxel pairs.
\begin{equation}
GLCM\_Dissimilarity=Average~over~13~directions \left(\sum_{i} \sum_{j} |i-j| \cdot GLCM(i,j) \right)
\end{equation}