Radiomic Features¶
This section contains the definitions of the various features that can be extracted using PyRadiomics. They are subdivided into the following classes:
First Order Statistics
(19 features)Shapebased (3D)
(16 features)Shapebased (2D)
(10 features)Gray Level Cooccurrence Matrix
(24 features)Gray Level Run Length Matrix
(16 features)Gray Level Size Zone Matrix
(16 features)Neighbouring Gray Tone Difference Matrix
(5 features)Gray Level Dependence Matrix
(14 features)
All feature classes, with the exception of shape can be calculated on either the original image and/or a derived image, obtained by applying one of several filters. The shape descriptors are independent of gray value, and are extracted from the label mask. If enabled, they are calculated separately of enabled input image types, and listed in the result as if calculated on the original image.
Most features defined below are in compliance with feature definitions as described by the Imaging Biomarker Standardization Initiative (IBSI), which are available in a separate document by Zwanenburg et al. (2016) [1]. Where features differ, a note has been added specifying the difference.
First Order Features¶

class
radiomics.firstorder.
RadiomicsFirstOrder
(inputImage, inputMask, **kwargs)[source]¶ Bases:
radiomics.base.RadiomicsFeaturesBase
Firstorder statistics describe the distribution of voxel intensities within the image region defined by the mask through commonly used and basic metrics.
Let:
 \(\textbf{X}\) be a set of \(N_p\) voxels included in the ROI
 \(\textbf{P}(i)\) be the first order histogram with \(N_g\) discrete intensity levels,
where \(N_g\) is the number of nonzero bins, equally spaced from 0 with a width defined in the
binWidth
parameter.  \(p(i)\) be the normalized first order histogram and equal to \(\frac{\textbf{P}(i)}{N_p}\)
Following additional settings are possible:
 voxelArrayShift [0]: Integer, This amount is added to the gray level intensity in features Energy, Total Energy and RMS, this is to prevent negative values. If using CT data, or data normalized with mean 0, consider setting this parameter to a fixed value (e.g. 2000) that ensures nonnegative numbers in the image. Bear in mind however, that the larger the value, the larger the volume confounding effect will be.
Note
In the IBSI feature definitions, no correction for negative gray values is implemented. To achieve similar behaviour in PyRadiomics, set
voxelArrayShift
to 0.
getEnergyFeatureValue
()[source]¶ 1. Energy
\[\textit{energy} = \displaystyle\sum^{N_p}_{i=1}{(\textbf{X}(i) + c)^2}\]Here, \(c\) is optional value, defined by
voxelArrayShift
, which shifts the intensities to prevent negative values in \(\textbf{X}\). This ensures that voxels with the lowest gray values contribute the least to Energy, instead of voxels with gray level intensity closest to 0.Energy is a measure of the magnitude of voxel values in an image. A larger values implies a greater sum of the squares of these values.
Note
This feature is volumeconfounded, a larger value of \(c\) increases the effect of volumeconfounding.

getTotalEnergyFeatureValue
()[source]¶ 2. Total Energy
\[\textit{total energy} = V_{voxel}\displaystyle\sum^{N_p}_{i=1}{(\textbf{X}(i) + c)^2}\]Here, \(c\) is optional value, defined by
voxelArrayShift
, which shifts the intensities to prevent negative values in \(\textbf{X}\). This ensures that voxels with the lowest gray values contribute the least to Energy, instead of voxels with gray level intensity closest to 0.Total Energy is the value of Energy feature scaled by the volume of the voxel in cubic mm.
Note
This feature is volumeconfounded, a larger value of \(c\) increases the effect of volumeconfounding.
Note
Not present in IBSI feature definitions

getEntropyFeatureValue
()[source]¶ 3. Entropy
\[\textit{entropy} = \displaystyle\sum^{N_g}_{i=1}{p(i)\log_2\big(p(i)+\epsilon\big)}\]Here, \(\epsilon\) is an arbitrarily small positive number (\(\approx 2.2\times10^{16}\)).
Entropy specifies the uncertainty/randomness in the image values. It measures the average amount of information required to encode the image values.
Note
Defined by IBSI as Intensity Histogram Entropy.

getMaximumFeatureValue
()[source]¶ 7. Maximum
\[\textit{maximum} = \max(\textbf{X})\]The maximum gray level intensity within the ROI.

getMeanFeatureValue
()[source]¶ 8. Mean
\[\textit{mean} = \frac{1}{N_p}\displaystyle\sum^{N_p}_{i=1}{\textbf{X}(i)}\]The average gray level intensity within the ROI.

getInterquartileRangeFeatureValue
()[source]¶ 10. Interquartile Range
\[\textit{interquartile range} = \textbf{P}_{75}  \textbf{P}_{25}\]Here \(\textbf{P}_{25}\) and \(\textbf{P}_{75}\) are the 25^{th} and 75^{th} percentile of the image array, respectively.

getRangeFeatureValue
()[source]¶ 11. Range
\[\textit{range} = \max(\textbf{X})  \min(\textbf{X})\]The range of gray values in the ROI.

getMeanAbsoluteDeviationFeatureValue
()[source]¶ 12. Mean Absolute Deviation (MAD)
\[\textit{MAD} = \frac{1}{N_p}\displaystyle\sum^{N_p}_{i=1}{\textbf{X}(i)\bar{X}}\]Mean Absolute Deviation is the mean distance of all intensity values from the Mean Value of the image array.

getRobustMeanAbsoluteDeviationFeatureValue
()[source]¶ 13. Robust Mean Absolute Deviation (rMAD)
\[\textit{rMAD} = \frac{1}{N_{1090}}\displaystyle\sum^{N_{1090}}_{i=1} {\textbf{X}_{1090}(i)\bar{X}_{1090}}\]Robust Mean Absolute Deviation is the mean distance of all intensity values from the Mean Value calculated on the subset of image array with gray levels in between, or equal to the 10^{th} and 90^{th} percentile.

getRootMeanSquaredFeatureValue
()[source]¶ 14. Root Mean Squared (RMS)
\[\textit{RMS} = \sqrt{\frac{1}{N_p}\sum^{N_p}_{i=1}{(\textbf{X}(i) + c)^2}}\]Here, \(c\) is optional value, defined by
voxelArrayShift
, which shifts the intensities to prevent negative values in \(\textbf{X}\). This ensures that voxels with the lowest gray values contribute the least to RMS, instead of voxels with gray level intensity closest to 0.RMS is the squareroot of the mean of all the squared intensity values. It is another measure of the magnitude of the image values. This feature is volumeconfounded, a larger value of \(c\) increases the effect of volumeconfounding.

getStandardDeviationFeatureValue
()[source]¶ 15. Standard Deviation
\[\textit{standard deviation} = \sqrt{\frac{1}{N_p}\sum^{N_p}_{i=1}{(\textbf{X}(i)\bar{X})^2}}\]Standard Deviation measures the amount of variation or dispersion from the Mean Value. By definition, \(\textit{standard deviation} = \sqrt{\textit{variance}}\)
Note
As this feature is correlated with variance, it is marked so it is not enabled by default. To include this feature in the extraction, specify it by name in the enabled features (i.e. this feature will not be enabled if no individual features are specified (enabling ‘all’ features), but will be enabled when individual features are specified, including this feature). Not present in IBSI feature definitions (correlated with variance)

getSkewnessFeatureValue
()[source]¶ 16. Skewness
\[\textit{skewness} = \displaystyle\frac{\mu_3}{\sigma^3} = \frac{\frac{1}{N_p}\sum^{N_p}_{i=1}{(\textbf{X}(i)\bar{X})^3}} {\left(\sqrt{\frac{1}{N_p}\sum^{N_p}_{i=1}{(\textbf{X}(i)\bar{X})^2}}\right)^3}\]Where \(\mu_3\) is the 3^{rd} central moment.
Skewness measures the asymmetry of the distribution of values about the Mean value. Depending on where the tail is elongated and the mass of the distribution is concentrated, this value can be positive or negative.
Related links:
https://en.wikipedia.org/wiki/Skewness
Note
In case of a flat region, the standard deviation and 4^{rd} central moment will be both 0. In this case, a value of 0 is returned.

getKurtosisFeatureValue
()[source]¶ 17. Kurtosis
\[\textit{kurtosis} = \displaystyle\frac{\mu_4}{\sigma^4} = \frac{\frac{1}{N_p}\sum^{N_p}_{i=1}{(\textbf{X}(i)\bar{X})^4}} {\left(\frac{1}{N_p}\sum^{N_p}_{i=1}{(\textbf{X}(i)\bar{X}})^2\right)^2}\]Where \(\mu_4\) is the 4^{th} central moment.
Kurtosis is a measure of the ‘peakedness’ of the distribution of values in the image ROI. A higher kurtosis implies that the mass of the distribution is concentrated towards the tail(s) rather than towards the mean. A lower kurtosis implies the reverse: that the mass of the distribution is concentrated towards a spike near the Mean value.
Related links:
https://en.wikipedia.org/wiki/Kurtosis
Note
In case of a flat region, the standard deviation and 4^{rd} central moment will be both 0. In this case, a value of 0 is returned.
Note
The IBSI feature definition implements excess kurtosis, where kurtosis is corrected by 3, yielding 0 for normal distributions. The PyRadiomics kurtosis is not corrected, yielding a value 3 higher than the IBSI kurtosis.

getVarianceFeatureValue
()[source]¶ 18. Variance
\[\textit{variance} = \frac{1}{N_p}\displaystyle\sum^{N_p}_{i=1}{(\textbf{X}(i)\bar{X})^2}\]Variance is the the mean of the squared distances of each intensity value from the Mean value. This is a measure of the spread of the distribution about the mean. By definition, \(\textit{variance} = \sigma^2\)

getUniformityFeatureValue
()[source]¶ 19. Uniformity
\[\textit{uniformity} = \displaystyle\sum^{N_g}_{i=1}{p(i)^2}\]Uniformity is a measure of the sum of the squares of each intensity value. This is a measure of the homogeneity of the image array, where a greater uniformity implies a greater homogeneity or a smaller range of discrete intensity values.
Note
Defined by IBSI as Intensity Histogram Uniformity.
Shape Features (3D)¶

class
radiomics.shape.
RadiomicsShape
(inputImage, inputMask, **kwargs)[source]¶ Bases:
radiomics.base.RadiomicsFeaturesBase
In this group of features we included descriptors of the threedimensional size and shape of the ROI. These features are independent from the gray level intensity distribution in the ROI and are therefore only calculated on the nonderived image and mask.
Unless otherwise specified, features are derived from the approximated shape defined by the triangle mesh. To build this mesh, vertices (points) are first defined as points halfway on an edge between a voxel included in the ROI and one outside the ROI. By connecting these vertices a mesh of connected triangles is obtained, with each triangle defined by 3 adjacent vertices, which shares each side with exactly one other triangle.
This mesh is generated using a marching cubes algorithm. In this algorithm, a 2x2 cube is moved through the mask space. For each position, the corners of the cube are then marked ‘segmented’ (1) or ‘not segmented’ (0). Treating the corners as specific bits in a binary number, a unique cubeindex is obtained (0255). This index is then used to determine which triangles are present in the cube, which are defined in a lookup table.
These triangles are defined in such a way, that the normal (obtained from the cross product of vectors describing 2 out of 3 edges) are always oriented in the same direction. For PyRadiomics, the calculated normals are always pointing outward. This is necessary to obtain the correct signed volume used in calculation of
MeshVolume
.Let:
 \(N_v\) represent the number of voxels included in the ROI
 \(N_f\) represent the number of faces (triangles) defining the Mesh.
 \(V\) the volume of the mesh in mm^{3}, calculated by
getMeshVolumeFeatureValue()
 \(A\) the surface area of the mesh in mm^{2}, calculated by
getMeshSurfaceAreaFeatureValue()
References:
 Lorensen WE, Cline HE. Marching cubes: A high resolution 3D surface construction algorithm. ACM SIGGRAPH Comput Graph Internet. 1987;21:1639.

getMeshVolumeFeatureValue
()[source]¶ 1. Mesh Volume
\[ \begin{align}\begin{aligned}V_i = \displaystyle\frac{Oa_i \cdot (Ob_i \times Oc_i)}{6} \text{ (1)}\\V = \displaystyle\sum^{N_f}_{i=1}{V_i} \text{ (2)}\end{aligned}\end{align} \]The volume of the ROI \(V\) is calculated from the triangle mesh of the ROI. For each face \(i\) in the mesh, defined by points \(a_i, b_i\) and \(c_i\), the (signed) volume \(V_f\) of the tetrahedron defined by that face and the origin of the image (\(O\)) is calculated. (1) The sign of the volume is determined by the sign of the normal, which must be consistently defined as either facing outward or inward of the ROI.
Then taking the sum of all \(V_i\), the total volume of the ROI is obtained (2)
Note
For more extensive documentation on how the volume is obtained using the surface mesh, see the IBSI document, where this feature is defined as
Volume
.

getVoxelVolumeFeatureValue
()[source]¶ 2. Voxel Volume
\[V_{voxel} = \displaystyle\sum^{N_v}_{k=1}{V_k}\]The volume of the ROI \(V_{voxel}\) is approximated by multiplying the number of voxels in the ROI by the volume of a single voxel \(V_k\). This is a less precise approximation of the volume and is not used in subsequent features. This feature does not make use of the mesh and is not used in calculation of other shape features.
Note
Defined in IBSI as
Approximate Volume
.

getSurfaceAreaFeatureValue
()[source]¶ 3. Surface Area
\[ \begin{align}\begin{aligned}A_i = \frac{1}{2}\text{a}_i\text{b}_i \times \text{a}_i\text{c}_i \text{ (1)}\\A = \displaystyle\sum^{N_f}_{i=1}{A_i} \text{ (2)}\end{aligned}\end{align} \]where:
\(\text{a}_i\text{b}_i\) and \(\text{a}_i\text{c}_i\) are edges of the \(i^{\text{th}}\) triangle in the mesh, formed by vertices \(\text{a}_i\), \(\text{b}_i\) and \(\text{c}_i\).
To calculate the surface area, first the surface area \(A_i\) of each triangle in the mesh is calculated (1). The total surface area is then obtained by taking the sum of all calculated subareas (2).
Note
Defined in IBSI as
Surface Area
.

getSurfaceVolumeRatioFeatureValue
()[source]¶ 4. Surface Area to Volume ratio
\[\textit{surface to volume ratio} = \frac{A}{V}\]Here, a lower value indicates a more compact (spherelike) shape. This feature is not dimensionless, and is therefore (partly) dependent on the volume of the ROI.

getSphericityFeatureValue
()[source]¶ 5. Sphericity
\[\textit{sphericity} = \frac{\sqrt[3]{36 \pi V^2}}{A}\]Sphericity is a measure of the roundness of the shape of the tumor region relative to a sphere. It is a dimensionless measure, independent of scale and orientation. The value range is \(0 < sphericity \leq 1\), where a value of 1 indicates a perfect sphere (a sphere has the smallest possible surface area for a given volume, compared to other solids).
Note
This feature is correlated to Compactness 1, Compactness 2 and Spherical Disproportion. In the default parameter file provided in the
pyradiomics/examples/exampleSettings
folder, Compactness 1 and Compactness 2 are therefore disabled.

getCompactness1FeatureValue
()[source]¶ 6. Compactness 1
\[\textit{compactness 1} = \frac{V}{\sqrt{\pi A^3}}\]Similar to Sphericity, Compactness 1 is a measure of how compact the shape of the tumor is relative to a sphere (most compact). It is therefore correlated to Sphericity and redundant. It is provided here for completeness. The value range is \(0 < compactness\ 1 \leq \frac{1}{6 \pi}\), where a value of \(\frac{1}{6 \pi}\) indicates a perfect sphere.
By definition, \(compactness\ 1 = \frac{1}{6 \pi}\sqrt{compactness\ 2} = \frac{1}{6 \pi}\sqrt{sphericity^3}\).
Note
This feature is correlated to Compactness 2, Sphericity and Spherical Disproportion. Therefore, this feature is marked, so it is not enabled by default (i.e. this feature will not be enabled if no individual features are specified (enabling ‘all’ features), but will be enabled when individual features are specified, including this feature). To include this feature in the extraction, specify it by name in the enabled features.

getCompactness2FeatureValue
()[source]¶ 7. Compactness 2
\[\textit{compactness 2} = 36 \pi \frac{V^2}{A^3}\]Similar to Sphericity and Compactness 1, Compactness 2 is a measure of how compact the shape of the tumor is relative to a sphere (most compact). It is a dimensionless measure, independent of scale and orientation. The value range is \(0 < compactness\ 2 \leq 1\), where a value of 1 indicates a perfect sphere.
By definition, \(compactness\ 2 = (sphericity)^3\)
Note
This feature is correlated to Compactness 1, Sphericity and Spherical Disproportion. Therefore, this feature is marked, so it is not enabled by default (i.e. this feature will not be enabled if no individual features are specified (enabling ‘all’ features), but will be enabled when individual features are specified, including this feature). To include this feature in the extraction, specify it by name in the enabled features.

getSphericalDisproportionFeatureValue
()[source]¶ 8. Spherical Disproportion
\[\textit{spherical disproportion} = \frac{A}{4\pi R^2} = \frac{A}{\sqrt[3]{36 \pi V^2}}\]Where \(R\) is the radius of a sphere with the same volume as the tumor, and equal to \(\sqrt[3]{\frac{3V}{4\pi}}\).
Spherical Disproportion is the ratio of the surface area of the tumor region to the surface area of a sphere with the same volume as the tumor region, and by definition, the inverse of Sphericity. Therefore, the value range is \(spherical\ disproportion \geq 1\), with a value of 1 indicating a perfect sphere.
Note
This feature is correlated to Compactness 2, Compactness2 and Sphericity. Therefore, this feature is marked, so it is not enabled by default (i.e. this feature will not be enabled if no individual features are specified (enabling ‘all’ features), but will be enabled when individual features are specified, including this feature). To include this feature in the extraction, specify it by name in the enabled features.

getMaximum3DDiameterFeatureValue
()[source]¶ 9. Maximum 3D diameter
Maximum 3D diameter is defined as the largest pairwise Euclidean distance between tumor surface mesh vertices.
Also known as Feret Diameter.

getMaximum2DDiameterSliceFeatureValue
()[source]¶ 10. Maximum 2D diameter (Slice)
Maximum 2D diameter (Slice) is defined as the largest pairwise Euclidean distance between tumor surface mesh vertices in the rowcolumn (generally the axial) plane.

getMaximum2DDiameterColumnFeatureValue
()[source]¶ 11. Maximum 2D diameter (Column)
Maximum 2D diameter (Column) is defined as the largest pairwise Euclidean distance between tumor surface mesh vertices in the rowslice (usually the coronal) plane.

getMaximum2DDiameterRowFeatureValue
()[source]¶ 12. Maximum 2D diameter (Row)
Maximum 2D diameter (Row) is defined as the largest pairwise Euclidean distance between tumor surface mesh vertices in the columnslice (usually the sagittal) plane.

getMajorAxisLengthFeatureValue
()[source]¶ 13. Major Axis Length
\[\textit{major axis} = 4 \sqrt{\lambda_{major}}\]This feature yield the largest axis length of the ROIenclosing ellipsoid and is calculated using the largest principal component \(\lambda_{major}\).
The principal component analysis is performed using the physical coordinates of the voxel centers defining the ROI. It therefore takes spacing into account, but does not make use of the shape mesh.

getMinorAxisLengthFeatureValue
()[source]¶ 14. Minor Axis Length
\[\textit{minor axis} = 4 \sqrt{\lambda_{minor}}\]This feature yield the secondlargest axis length of the ROIenclosing ellipsoid and is calculated using the largest principal component \(\lambda_{minor}\).
The principal component analysis is performed using the physical coordinates of the voxel centers defining the ROI. It therefore takes spacing into account, but does not make use of the shape mesh.

getLeastAxisLengthFeatureValue
()[source]¶ 15. Least Axis Length
\[\textit{least axis} = 4 \sqrt{\lambda_{least}}\]This feature yield the smallest axis length of the ROIenclosing ellipsoid and is calculated using the largest principal component \(\lambda_{least}\). In case of a 2D segmentation, this value will be 0.
The principal component analysis is performed using the physical coordinates of the voxel centers defining the ROI. It therefore takes spacing into account, but does not make use of the shape mesh.

getElongationFeatureValue
()[source]¶ 16. Elongation
Elongation shows the relationship between the two largest principal components in the ROI shape. For computational reasons, this feature is defined as the inverse of true elongation.
\[\textit{elongation} = \sqrt{\frac{\lambda_{minor}}{\lambda_{major}}}\]Here, \(\lambda_{\text{major}}\) and \(\lambda_{\text{minor}}\) are the lengths of the largest and second largest principal component axes. The values range between 1 (where the cross section through the first and second largest principal moments is circlelike (nonelongated)) and 0 (where the object is a maximally elongated: i.e. a 1 dimensional line).
The principal component analysis is performed using the physical coordinates of the voxel centers defining the ROI. It therefore takes spacing into account, but does not make use of the shape mesh.

getFlatnessFeatureValue
()[source]¶ 17. Flatness
Flatness shows the relationship between the largest and smallest principal components in the ROI shape. For computational reasons, this feature is defined as the inverse of true flatness.
\[\textit{flatness} = \sqrt{\frac{\lambda_{least}}{\lambda_{major}}}\]Here, \(\lambda_{\text{major}}\) and \(\lambda_{\text{least}}\) are the lengths of the largest and smallest principal component axes. The values range between 1 (nonflat, spherelike) and 0 (a flat object, or singleslice segmentation).
The principal component analysis is performed using the physical coordinates of the voxel centers defining the ROI. It therefore takes spacing into account, but does not make use of the shape mesh.
Shape Features (2D)¶

class
radiomics.shape2D.
RadiomicsShape2D
(inputImage, inputMask, **kwargs)[source]¶ Bases:
radiomics.base.RadiomicsFeaturesBase
In this group of features we included descriptors of the twodimensional size and shape of the ROI. These features are independent from the gray level intensity distribution in the ROI and are therefore only calculated on the nonderived image and mask.
Unless otherwise specified, features are derived from the approximated shape defined by the circumference mesh. To build this mesh, vertices (points) are first defined as points halfway on an edge between a pixel included in the ROI and one outside the ROI. By connecting these vertices a mesh of connected lines is obtained, with each line defined by 2 adjacent vertices, which shares each a point with exactly one other line.
This mesh is generated using an adapted version marching cubes algorithm. In this algorithm, a 2x2 square is moved through the mask space (2d). For each position, the corners of the square are then marked ‘segmented’ (1) or ‘not segmented’ (0). Treating the corners as specific bits in a binary number, a unique squareindex is obtained (015). This index is then used to determine which lines are present in the square, which are defined in a lookup table.
These lines are defined in such a way, that the normal of the triangle defined by these points and the origin is always oriented in the a consistent direction. This results in signed values for the surface area of each triangle, so that when summed, the superfluous (postive) area included by triangles partly inside and outside the ROI is perfectly cancelled out by the (negative) area of triangles entirely outside the ROI.
Let:
 \(N_p\) represent the number of pixels included in the ROI
 \(N_f\) represent the number of lines defining the circumference (perimeter) Mesh.
 \(A\) the surface area of the mesh in mm^{2}, calculated by
getMeshSurfaceFeatureValue()
 \(P\) the perimeter of the mesh in mm, calculated by
getPerimeterFeatureValue()
Note
This class can only be calculated for truly 2D masks. To ensure correct processing, it is required that
force2D
is set toTrue
andforce2Ddimension
to the dimension that is outof plane (e.g. 0 (zaxis) for an axial slice). Furthermore, this dimension is required to have size 1. If not set correctly, a ValueError is raised.References:
 Lorensen WE, Cline HE. Marching cubes: A high resolution 3D surface construction algorithm. ACM SIGGRAPH Comput Graph Internet. 1987;21:1639.

getMeshSurfaceFeatureValue
()[source]¶ 1. Mesh Surface
\[ \begin{align}\begin{aligned}A_i = \frac{1}{2}\text{Oa}_i \times \text{Ob}_i \text{ (1)}\\A = \displaystyle\sum^{N_f}_{i=1}{A_i} \text{ (2)}\end{aligned}\end{align} \]where:
\(\text{O}_i\text{a}_i\) and \(\text{O}_i\text{b}_i\) are edges of the \(i^{\text{th}}\) triangle in the mesh, formed by vertices \(\text{a}_i\), \(\text{b}_i\) of the perimiter and the origin \(\text{O}\).
To calculate the surface area, first the signed surface area \(A_i\) of each triangle in the mesh is calculated (1). The total surface area is then obtained by taking the sum of all calculated subareas (2), where the sign will ensure correct surface area, as the negative area of triangles outside the ROI will cancel out the surplus area included by triangles partly inside and partly outside the ROI.

getPixelSurfaceFeatureValue
()[source]¶ 2. Pixel Surface
\[A_{pixel} = \displaystyle\sum^{N_v}_{k=1}{A_k}\]The surface area of the ROI \(A_{pixel}\) is approximated by multiplying the number of pixels in the ROI by the surface area of a single pixel \(A_k\). This is a less precise approximation of the surface area. This feature does not make use of the mesh and is not used in calculation of other 2D shape features.

getPerimeterFeatureValue
()[source]¶ 3. Perimeter
\[ \begin{align}\begin{aligned}P_i = \sqrt{(\text{a}_i\text{b}_i)^2} \text{ (1)}\\P = \displaystyle\sum^{N_f}_{i=1}{P_i} \text{ (2)}\end{aligned}\end{align} \]where:
\(\text{a}_i\) and \(\text{b}_i\) are vertices of the \(i^{\text{th}}\) line in the perimeter mesh.
To calculate the perimeter, first the perimeter \(A_i\) of each line in the mesh circumference is calculated (1). The total perimeter is then obtained by taking the sum of all calculated subareas (2).

getPerimeterSurfaceRatioFeatureValue
()[source]¶ 4. Perimeter to Surface ratio
\[\textit{perimeter to surface ratio} = \frac{P}{A}\]Here, a lower value indicates a more compact (circlelike) shape. This feature is not dimensionless, and is therefore (partly) dependent on the surface area of the ROI.

getSphericityFeatureValue
()[source]¶ 5. Sphericity
\[\textit{sphericity} = \frac{2\pi R}{P} = \frac{2\sqrt{\pi A}}{P}\]Where \(R\) is the radius of a circle with the same surface as the ROI, and equal to \(\sqrt{\frac{A}{\pi}}\).
Sphericity is the ratio of the perimeter of the tumor region to the perimeter of a circle with the same surface area as the tumor region and therefore a measure of the roundness of the shape of the tumor region relative to a circle. It is a dimensionless measure, independent of scale and orientation. The value range is \(0 < sphericity \leq 1\), where a value of 1 indicates a perfect circle (a circle has the smallest possible perimeter for a given surface area, compared to other shapes).
Note
This feature is correlated to Spherical Disproportion. Therefore, only this feature is enabled by default.

getSphericalDisproportionFeatureValue
()[source]¶ 6. Spherical Disproportion
\[\textit{spherical disproportion} = \frac{P}{2\sqrt{\pi A}}\]Spherical Disproportion is the ratio of the perimeter of the tumor region to the perimeter of a circle with the same surface area as the tumor region, and by definition, the inverse of Sphericity. Therefore, the value range is \(spherical\ disproportion \geq 1\), with a value of 1 indicating a perfect sphere.
Note
This feature is correlated to Sphericity. Therefore, this feature is marked, so it is not enabled by default (i.e. this feature will not be enabled if no individual features are specified (enabling ‘all’ features), but will be enabled when individual features are specified, including this feature). To include this feature in the extraction, specify it by name in the enabled features.

getMaximumDiameterFeatureValue
()[source]¶ 7. Maximum 2D diameter
Maximum diameter is defined as the largest pairwise Euclidean distance between tumor surface mesh vertices.

getMajorAxisLengthFeatureValue
()[source]¶ 8. Major Axis Length
\[\textit{major axis} = 4 \sqrt{\lambda_{major}}\]This feature yield the largest axis length of the ROIenclosing ellipsoid and is calculated using the largest principal component \(\lambda_{major}\).
The principal component analysis is performed using the physical coordinates of the pixel centers defining the ROI. It therefore takes spacing into account, but does not make use of the shape mesh.

getMinorAxisLengthFeatureValue
()[source]¶ 9. Minor Axis Length
\[\textit{minor axis} = 4 \sqrt{\lambda_{minor}}\]This feature yield the secondlargest axis length of the ROIenclosing ellipsoid and is calculated using the largest principal component \(\lambda_{minor}\).
The principal component analysis is performed using the physical coordinates of the pixel centers defining the ROI. It therefore takes spacing into account, but does not make use of the shape mesh.

getElongationFeatureValue
()[source]¶ 10. Elongation
Elongation shows the relationship between the two largest principal components in the ROI shape. For computational reasons, this feature is defined as the inverse of true elongation.
\[\textit{elongation} = \sqrt{\frac{\lambda_{minor}}{\lambda_{major}}}\]Here, \(\lambda_{\text{major}}\) and \(\lambda_{\text{minor}}\) are the lengths of the largest and second largest principal component axes. The values range between 1 (where the cross section through the first and second largest principal moments is circlelike (nonelongated)) and 0 (where the object is a maximally elongated: i.e. a 1 dimensional line).
The principal component analysis is performed using the physical coordinates of the pixel centers defining the ROI. It therefore takes spacing into account, but does not make use of the shape mesh.
Gray Level Cooccurrence Matrix (GLCM) Features¶

class
radiomics.glcm.
RadiomicsGLCM
(inputImage, inputMask, **kwargs)[source]¶ Bases:
radiomics.base.RadiomicsFeaturesBase
A Gray Level Cooccurrence Matrix (GLCM) of size \(N_g \times N_g\) describes the secondorder joint probability function of an image region constrained by the mask and is defined as \(\textbf{P}(i,j\delta,\theta)\). The \((i,j)^{\text{th}}\) element of this matrix represents the number of times the combination of levels \(i\) and \(j\) occur in two pixels in the image, that are separated by a distance of \(\delta\) pixels along angle \(\theta\). The distance \(\delta\) from the center voxel is defined as the distance according to the infinity norm. For \(\delta=1\), this results in 2 neighbors for each of 13 angles in 3D (26connectivity) and for \(\delta=2\) a 98connectivity (49 unique angles).
Note that pyradiomics by default computes symmetrical GLCM!
As a two dimensional example, let the following matrix \(\textbf{I}\) represent a 5x5 image, having 5 discrete grey levels:
\[\begin{split}\textbf{I} = \begin{bmatrix} 1 & 2 & 5 & 2 & 3\\ 3 & 2 & 1 & 3 & 1\\ 1 & 3 & 5 & 5 & 2\\ 1 & 1 & 1 & 1 & 2\\ 1 & 2 & 4 & 3 & 5 \end{bmatrix}\end{split}\]For distance \(\delta = 1\) (considering pixels with a distance of 1 pixel from each other) and angle \(\theta=0^\circ\) (horizontal plane, i.e. voxels to the left and right of the center voxel), the following symmetrical GLCM is obtained:
\[\begin{split}\textbf{P} = \begin{bmatrix} 6 & 4 & 3 & 0 & 0\\ 4 & 0 & 2 & 1 & 3\\ 3 & 2 & 0 & 1 & 2\\ 0 & 1 & 1 & 0 & 0\\ 0 & 3 & 2 & 0 & 2 \end{bmatrix}\end{split}\]Let:
 \(\epsilon\) be an arbitrarily small positive number (\(\approx 2.2\times10^{16}\))
 \(\textbf{P}(i,j)\) be the cooccurrence matrix for an arbitrary \(\delta\) and \(\theta\)
 \(p(i,j)\) be the normalized cooccurrence matrix and equal to \(\frac{\textbf{P}(i,j)}{\sum{\textbf{P}(i,j)}}\)
 \(N_g\) be the number of discrete intensity levels in the image
 \(p_x(i) = \sum^{N_g}_{j=1}{p(i,j)}\) be the marginal row probabilities
 \(p_y(j) = \sum^{N_g}_{i=1}{p(i,j)}\) be the marginal column probabilities
 \(\mu_x\) be the mean gray level intensity of \(p_x\) and defined as \(\mu_x = \displaystyle\sum^{N_g}_{i=1}{p_x(i)i}\)
 \(\mu_y\) be the mean gray level intensity of \(p_y\) and defined as \(\mu_y = \displaystyle\sum^{N_g}_{j=1}{p_y(j)j}\)
 \(\sigma_x\) be the standard deviation of \(p_x\)
 \(\sigma_y\) be the standard deviation of \(p_y\)
 \(p_{x+y}(k) = \sum^{N_g}_{i=1}\sum^{N_g}_{j=1}{p(i,j)},\text{ where }i+j=k,\text{ and }k=2,3,\dots,2N_g\)
 \(p_{xy}(k) = \sum^{N_g}_{i=1}\sum^{N_g}_{j=1}{p(i,j)},\text{ where }ij=k,\text{ and }k=0,1,\dots,N_g1\)
 \(HX = \sum^{N_g}_{i=1}{p_x(i)\log_2\big(p_x(i)+\epsilon\big)}\) be the entropy of \(p_x\)
 \(HY = \sum^{N_g}_{j=1}{p_y(j)\log_2\big(p_y(j)+\epsilon\big)}\) be the entropy of \(p_y\)
 \(HXY = \sum^{N_g}_{i=1}\sum^{N_g}_{j=1}{p(i,j)\log_2\big(p(i,j)+\epsilon\big)}\) be the entropy of \(p(i,j)\)
 \(HXY1 = \sum^{N_g}_{i=1}\sum^{N_g}_{j=1}{p(i,j)\log_2\big(p_x(i)p_y(j)+\epsilon\big)}\)
 \(HXY2 = \sum^{N_g}_{i=1}\sum^{N_g}_{j=1}{p_x(i)p_y(j)\log_2\big(p_x(i)p_y(j)+\epsilon\big)}\)
By default, the value of a feature is calculated on the GLCM for each angle separately, after which the mean of these values is returned. If distance weighting is enabled, GLCM matrices are weighted by weighting factor W and then summed and normalised. Features are then calculated on the resultant matrix. Weighting factor W is calculated for the distance between neighbouring voxels by:
\(W = e^{\d\^2}\), where d is the distance for the associated angle according to the norm specified in setting ‘weightingNorm’.
The following class specific settings are possible:
distances [[1]]: List of integers. This specifies the distances between the center voxel and the neighbor, for which angles should be generated.
symmetricalGLCM [True]: boolean, indicates whether cooccurrences should be assessed in two directions per angle, which results in a symmetrical matrix, with equal distributions for \(i\) and \(j\). A symmetrical matrix corresponds to the GLCM as defined by Haralick et al.
weightingNorm [None]: string, indicates which norm should be used when applying distance weighting. Enumerated setting, possible values:
 ‘manhattan’: first order norm
 ‘euclidean’: second order norm
 ‘infinity’: infinity norm.
 ‘no_weighting’: GLCMs are weighted by factor 1 and summed
 None: Applies no weighting, mean of values calculated on separate matrices is returned.
In case of other values, an warning is logged and option ‘no_weighting’ is used.
References
 Haralick, R., Shanmugan, K., Dinstein, I; Textural features for image classification; IEEE Transactions on Systems, Man and Cybernetics; 1973(3), p610621
 https://en.wikipedia.org/wiki/Cooccurrence_matrix
 http://www.fp.ucalgary.ca/mhallbey/the_glcm.htm

getAutocorrelationFeatureValue
()[source]¶ 1. Autocorrelation
\[\textit{autocorrelation} = \displaystyle\sum^{N_g}_{i=1}\displaystyle\sum^{N_g}_{j=1}{p(i,j)ij}\]Autocorrelation is a measure of the magnitude of the fineness and coarseness of texture.

getJointAverageFeatureValue
()[source]¶ 2. Joint Average
\[\textit{joint average} = \mu_x = \displaystyle\sum^{N_g}_{i=1}\displaystyle\sum^{N_g}_{j=1}{p(i,j)i}\]Returns the mean gray level intensity of the \(i\) distribution.
Warning
As this formula represents the average of the distribution of \(i\), it is independent from the distribution of \(j\). Therefore, only use this formula if the GLCM is symmetrical, where \(p_x(i) = p_y(j) \text{, where } i = j\).

getClusterProminenceFeatureValue
()[source]¶ 3. Cluster Prominence
\[\textit{cluster prominence} = \displaystyle\sum^{N_g}_{i=1}\displaystyle\sum^{N_g}_{j=1} {\big( i+j\mu_x\mu_y\big)^4p(i,j)}\]Cluster Prominence is a measure of the skewness and asymmetry of the GLCM. A higher values implies more asymmetry about the mean while a lower value indicates a peak near the mean value and less variation about the mean.

getClusterShadeFeatureValue
()[source]¶ 4. Cluster Shade
\[\textit{cluster shade} = \displaystyle\sum^{N_g}_{i=1}\displaystyle\sum^{N_g}_{j=1} {\big(i+j\mu_x\mu_y\big)^3p(i,j)}\]Cluster Shade is a measure of the skewness and uniformity of the GLCM. A higher cluster shade implies greater asymmetry about the mean.

getClusterTendencyFeatureValue
()[source]¶ 5. Cluster Tendency
\[\textit{cluster tendency} = \displaystyle\sum^{N_g}_{i=1}\displaystyle\sum^{N_g}_{j=1} {\big(i+j\mu_x\mu_y\big)^2p(i,j)}\]Cluster Tendency is a measure of groupings of voxels with similar graylevel values.

getContrastFeatureValue
()[source]¶ 6. Contrast
\[\textit{contrast} = \displaystyle\sum^{N_g}_{i=1}\displaystyle\sum^{N_g}_{j=1}{(ij)^2p(i,j)}\]Contrast is a measure of the local intensity variation, favoring values away from the diagonal \((i = j)\). A larger value correlates with a greater disparity in intensity values among neighboring voxels.

getCorrelationFeatureValue
()[source]¶ 7. Correlation
\[\textit{correlation} = \frac{\sum^{N_g}_{i=1}\sum^{N_g}_{j=1}{p(i,j)ij\mu_x\mu_y}}{\sigma_x(i)\sigma_y(j)}\]Correlation is a value between 0 (uncorrelated) and 1 (perfectly correlated) showing the linear dependency of gray level values to their respective voxels in the GLCM.
Note
When there is only 1 discrete gray value in the ROI (flat region), \(\sigma_x\) and \(\sigma_y\) will be 0. In this case, an arbitrary value of 1 is returned instead. This is assessed on a perangle basis.

getDifferenceAverageFeatureValue
()[source]¶ 8. Difference Average
\[\textit{difference average} = \displaystyle\sum^{N_g1}_{k=0}{kp_{xy}(k)}\]Difference Average measures the relationship between occurrences of pairs with similar intensity values and occurrences of pairs with differing intensity values.

getDifferenceEntropyFeatureValue
()[source]¶ 9. Difference Entropy
\[\textit{difference entropy} = \displaystyle\sum^{N_g1}_{k=0}{p_{xy}(k)\log_2\big(p_{xy}(k)+\epsilon\big)}\]Difference Entropy is a measure of the randomness/variability in neighborhood intensity value differences.

getDifferenceVarianceFeatureValue
()[source]¶ 10. Difference Variance
\[\textit{difference variance} = \displaystyle\sum^{N_g1}_{k=0}{(kDA)^2p_{xy}(k)}\]Difference Variance is a measure of heterogeneity that places higher weights on differing intensity level pairs that deviate more from the mean.

getDissimilarityFeatureValue
()[source]¶ DEPRECATED. Dissimilarity
\[\textit{dissimilarity} = \displaystyle\sum^{N_g}_{i=1}\displaystyle\sum^{N_g}_{j=1}{ijp(i,j)}\]Warning
This feature has been deprecated, as it is mathematically equal to Difference Average
getDifferenceAverageFeatureValue()
. See here for the proof. Enabling this feature will result in the logging of a DeprecationWarning (does not interrupt extraction of other features), no value is calculated for this features

getJointEnergyFeatureValue
()[source]¶ 11. Joint Energy
\[\textit{joint energy} = \displaystyle\sum^{N_g}_{i=1}\displaystyle\sum^{N_g}_{j=1}{\big(p(i,j)\big)^2}\]Energy is a measure of homogeneous patterns in the image. A greater Energy implies that there are more instances of intensity value pairs in the image that neighbor each other at higher frequencies.
Note
Defined by IBSI as Angular Second Moment.

getJointEntropyFeatureValue
()[source]¶ 12. Joint Entropy
\[\textit{joint entropy} = \displaystyle\sum^{N_g}_{i=1}\displaystyle\sum^{N_g}_{j=1} {p(i,j)\log_2\big(p(i,j)+\epsilon\big)}\]Joint entropy is a measure of the randomness/variability in neighborhood intensity values.
Note
Defined by IBSI as Joint entropy

getHomogeneity1FeatureValue
()[source]¶ DEPRECATED. Homogeneity 1
\[\textit{homogeneity 1} = \displaystyle\sum^{N_g}_{i=1}\displaystyle\sum^{N_g}_{j=1}{\frac{p(i,j)}{1+ij}}\]Warning
This feature has been deprecated, as it is mathematically equal to Inverse Difference
getIdFeatureValue()
. Enabling this feature will result in the logging of a DeprecationWarning (does not interrupt extraction of other features), no value is calculated for this features

getHomogeneity2FeatureValue
()[source]¶ DEPRECATED. Homogeneity 2
\[\textit{homogeneity 2} = \displaystyle\sum^{N_g}_{i=1}\displaystyle\sum^{N_g}_{j=1}{\frac{p(i,j)}{1+ij^2}}\]Warning
This feature has been deprecated, as it is mathematically equal to Inverse Difference Moment
getIdmFeatureValue()
. Enabling this feature will result in the logging of a DeprecationWarning (does not interrupt extraction of other features), no value is calculated for this features

getImc1FeatureValue
()[source]¶ 13. Informational Measure of Correlation (IMC) 1
\[\textit{IMC 1} = \displaystyle\frac{HXYHXY1}{\max\{HX,HY\}}\]IMC1 assesses the correlation between the probability distributions of \(i\) and \(j\) (quantifying the complexity of the texture), using mutual information I(x, y):
\[ \begin{align}\begin{aligned}I(i, j) = \sum^{N_g}_{i=1}\sum^{N_g}_{j=1}{p(i,j)\log_2\big(\frac{p(i,j)}{p_x(i)p_y(j)}\big)}\\ = \sum^{N_g}_{i=1}\sum^{N_g}_{j=1}{p(i,j)\big(\log_2 (p(i,j))  \log_2 (p_x(i)p_y(j))\big)}\\ = \sum^{N_g}_{i=1}\sum^{N_g}_{j=1}{p(i,j)\log_2 \big(p(i,j)\big)}  \sum^{N_g}_{i=1}\sum^{N_g}_{j=1}{p(i,j)\log_2 \big(p_x(i)p_y(j)\big)}\\ = HXY + HXY1\end{aligned}\end{align} \]However, in this formula, the numerator is defined as HXY  HXY1 (i.e. \(I(x, y)\)), and is therefore \(\leq 0\). This reflects how this feature is defined in the original Haralick paper.
In the case where the distributions are independent, there is no mutual information and the result will therefore be 0. In the case of uniform distribution with complete dependence, mutual information will be equal to \(\log_2(N_g)\).
Finally, \(HXY  HXY1\) is divided by the maximum of the 2 marginal entropies, where in the latter case of complete dependence (not necessarily uniform; low complexity) it will result in \(IMC1 = 1\), as \(HX = HY = I(i, j)\).
Note
In the case where both HX and HY are 0 (as is the case in a flat region), an arbitrary value of 0 is returned to prevent a division by 0. This is done on a perangle basis (i.e. prior to any averaging).

getImc2FeatureValue
()[source]¶ 14. Informational Measure of Correlation (IMC) 2
\[\textit{IMC 2} = \displaystyle\sqrt{1e^{2(HXY2HXY)}}\]IMC2 also assesses the correlation between the probability distributions of \(i\) and \(j\) (quantifying the complexity of the texture). Of interest is to note that \(HXY1 = HXY2\) and that \(HXY2  HXY \geq 0\) represents the mutual information of the 2 distributions. Therefore, the range of IMC2 = [0, 1), with 0 representing the case of 2 independent distributions (no mutual information) and the maximum value representing the case of 2 fully dependent and uniform distributions (maximal mutual information, equal to \(\log_2(N_g)\)). In this latter case, the maximum value is then equal to \(\displaystyle\sqrt{1e^{2\log_2(N_g)}}\), approaching 1.
Note
Due to machine precision errors, it is possble that HXY > HXY2, which would result in returning complex numbers. In these cases, a value of 0 is returned for IMC2. This is done on a perangle basis (i.e. prior to any averaging).

getIdmFeatureValue
()[source]¶ 15. Inverse Difference Moment (IDM)
\[\textit{IDM} = \displaystyle\sum^{N_g1}_{k=0}{\frac{p_{xy}(k)}{1+k^2}}\]IDM (a.k.a Homogeneity 2) is a measure of the local homogeneity of an image. IDM weights are the inverse of the Contrast weights (decreasing exponentially from the diagonal i=j in the GLCM).

getMCCFeatureValue
()[source]¶ 16. Maximal Correlation Coefficient (MCC)
\[ \begin{align}\begin{aligned}\textit{MCC} = \sqrt{\text{second largest eigenvalue of Q}}\\Q(i, j) = \displaystyle\sum^{N_g}_{k=0}{\frac{p(i,k)p(j, k)}{p_x(i)p_y(k)}}\end{aligned}\end{align} \]The Maximal Correlation Coefficient is a measure of complexity of the texture and \(0 \leq MCC \leq 1\).
In case of a flat region, each GLCM matrix has shape (1, 1), resulting in just 1 eigenvalue. In this case, an arbitrary value of 1 is returned.

getIdmnFeatureValue
()[source]¶ 17. Inverse Difference Moment Normalized (IDMN)
\[\textit{IDMN} = \displaystyle\sum^{N_g1}_{k=0}{ \frac{p_{xy}(k)}{1+\left(\frac{k^2}{N_g^2}\right)} }\]IDMN (inverse difference moment normalized) is a measure of the local homogeneity of an image. IDMN weights are the inverse of the Contrast weights (decreasing exponentially from the diagonal \(i=j\) in the GLCM). Unlike Homogeneity2, IDMN normalizes the square of the difference between neighboring intensity values by dividing over the square of the total number of discrete intensity values.

getIdFeatureValue
()[source]¶ 18. Inverse Difference (ID)
\[\textit{ID} = \displaystyle\sum^{N_g1}_{k=0}{\frac{p_{xy}(k)}{1+k}}\]ID (a.k.a. Homogeneity 1) is another measure of the local homogeneity of an image. With more uniform gray levels, the denominator will remain low, resulting in a higher overall value.

getIdnFeatureValue
()[source]¶ 19. Inverse Difference Normalized (IDN)
\[\textit{IDN} = \displaystyle\sum^{N_g1}_{k=0}{ \frac{p_{xy}(k)}{1+\left(\frac{k}{N_g}\right)} }\]IDN (inverse difference normalized) is another measure of the local homogeneity of an image. Unlike Homogeneity1, IDN normalizes the difference between the neighboring intensity values by dividing over the total number of discrete intensity values.

getInverseVarianceFeatureValue
()[source]¶ 20. Inverse Variance
\[\textit{inverse variance} = \displaystyle\sum^{N_g1}_{k=1}{\frac{p_{xy}(k)}{k^2}}\]Note that \(k=0\) is skipped, as this would result in a division by 0.

getMaximumProbabilityFeatureValue
()[source]¶ 21. Maximum Probability
\[\textit{maximum probability} = \max\big(p(i,j)\big)\]Maximum Probability is occurrences of the most predominant pair of neighboring intensity values.
Note
Defined by IBSI as Joint maximum

getSumAverageFeatureValue
()[source]¶ 22. Sum Average
\[\textit{sum average} = \displaystyle\sum^{2N_g}_{k=2}{p_{x+y}(k)k}\]Sum Average measures the relationship between occurrences of pairs with lower intensity values and occurrences of pairs with higher intensity values.
Warning
When GLCM is symmetrical, \(\mu_x = \mu_y\), and therefore \(\text{Sum Average} = \mu_x + \mu_y = 2 \mu_x = 2 * Joint Average\). See formulas (4.), (5.) and (6.) defined here for the proof that \(\text{Sum Average} = \mu_x + \mu_y\). In the default parameter files provided in the
examples/exampleSettings
, this feature has been disabled.

getSumVarianceFeatureValue
()[source]¶ DEPRECATED. Sum Variance
\[\textit{sum variance} = \displaystyle\sum^{2N_g}_{k=2}{(kSA)^2p_{x+y}(k)}\]Warning
This feature has been deprecated, as it is mathematically equal to Cluster Tendency
getClusterTendencyFeatureValue()
. See here for the proof. Enabling this feature will result in the logging of a DeprecationWarning (does not interrupt extraction of other features), no value is calculated for this features

getSumEntropyFeatureValue
()[source]¶ 23. Sum Entropy
\[\textit{sum entropy} = \displaystyle\sum^{2N_g}_{k=2}{p_{x+y}(k)\log_2\big(p_{x+y}(k)+\epsilon\big)}\]Sum Entropy is a sum of neighborhood intensity value differences.

getSumSquaresFeatureValue
()[source]¶ 24. Sum of Squares
\[\textit{sum squares} = \displaystyle\sum^{N_g}_{i=1}\displaystyle\sum^{N_g}_{j=1}{(i\mu_x)^2p(i,j)}\]Sum of Squares or Variance is a measure in the distribution of neigboring intensity level pairs about the mean intensity level in the GLCM.
Warning
This formula represents the variance of the distribution of \(i\) and is independent from the distribution of \(j\). Therefore, only use this formula if the GLCM is symmetrical, where \(p_x(i) = p_y(j) \text{, where } i = j\)
Note
Defined by IBSI as Joint Variance
Gray Level Size Zone Matrix (GLSZM) Features¶

class
radiomics.glszm.
RadiomicsGLSZM
(inputImage, inputMask, **kwargs)[source]¶ Bases:
radiomics.base.RadiomicsFeaturesBase
A Gray Level Size Zone (GLSZM) quantifies gray level zones in an image. A gray level zone is defined as a the number of connected voxels that share the same gray level intensity. A voxel is considered connected if the distance is 1 according to the infinity norm (26connected region in a 3D, 8connected region in 2D). In a gray level size zone matrix \(P(i,j)\) the \((i,j)^{\text{th}}\) element equals the number of zones with gray level \(i\) and size \(j\) appear in image. Contrary to GLCM and GLRLM, the GLSZM is rotation independent, with only one matrix calculated for all directions in the ROI.
As a two dimensional example, consider the following 5x5 image, with 5 discrete gray levels:
\[\begin{split}\textbf{I} = \begin{bmatrix} 5 & 2 & 5 & 4 & 4\\ 3 & 3 & 3 & 1 & 3\\ 2 & 1 & 1 & 1 & 3\\ 4 & 2 & 2 & 2 & 3\\ 3 & 5 & 3 & 3 & 2 \end{bmatrix}\end{split}\]The GLSZM then becomes:
\[\begin{split}\textbf{P} = \begin{bmatrix} 0 & 0 & 0 & 1 & 0\\ 1 & 0 & 0 & 0 & 1\\ 1 & 0 & 1 & 0 & 1\\ 1 & 1 & 0 & 0 & 0\\ 3 & 0 & 0 & 0 & 0 \end{bmatrix}\end{split}\]Let:
 \(N_g\) be the number of discrete intensity values in the image
 \(N_s\) be the number of discrete zone sizes in the image
 \(N_p\) be the number of voxels in the image
 \(N_z\) be the number of zones in the ROI, which is equal to \(\sum^{N_g}_{i=1}\sum^{N_s}_{j=1} {\textbf{P}(i,j)}\) and \(1 \leq N_z \leq N_p\)
 \(\textbf{P}(i,j)\) be the size zone matrix
 \(p(i,j)\) be the normalized size zone matrix, defined as \(p(i,j) = \frac{\textbf{P}(i,j)}{N_z}\)
Note
The mathematical formulas that define the GLSZM features correspond to the definitions of features extracted from the GLRLM.
References
 Guillaume Thibault; Bernard Fertil; Claire Navarro; Sandrine Pereira; Pierre Cau; Nicolas Levy; Jean Sequeira; JeanLuc Mari (2009). “Texture Indexes and Gray Level Size Zone Matrix. Application to Cell Nuclei Classification”. Pattern Recognition and Information Processing (PRIP): 140145.
 https://en.wikipedia.org/wiki/Gray_level_size_zone_matrix

getSmallAreaEmphasisFeatureValue
()[source]¶ 1. Small Area Emphasis (SAE)
\[\textit{SAE} = \frac{\sum^{N_g}_{i=1}\sum^{N_s}_{j=1}{\frac{\textbf{P}(i,j)}{j^2}}}{N_z}\]SAE is a measure of the distribution of small size zones, with a greater value indicative of more smaller size zones and more fine textures.

getLargeAreaEmphasisFeatureValue
()[source]¶ 2. Large Area Emphasis (LAE)
\[\textit{LAE} = \frac{\sum^{N_g}_{i=1}\sum^{N_s}_{j=1}{\textbf{P}(i,j)j^2}}{N_z}\]LAE is a measure of the distribution of large area size zones, with a greater value indicative of more larger size zones and more coarse textures.

getGrayLevelNonUniformityFeatureValue
()[source]¶ 3. Gray Level NonUniformity (GLN)
\[\textit{GLN} = \frac{\sum^{N_g}_{i=1}\left(\sum^{N_s}_{j=1}{\textbf{P}(i,j)}\right)^2}{N_z}\]GLN measures the variability of graylevel intensity values in the image, with a lower value indicating more homogeneity in intensity values.

getGrayLevelNonUniformityNormalizedFeatureValue
()[source]¶ 4. Gray Level NonUniformity Normalized (GLNN)
\[\textit{GLNN} = \frac{\sum^{N_g}_{i=1}\left(\sum^{N_s}_{j=1}{\textbf{P}(i,j)}\right)^2}{N_z^2}\]GLNN measures the variability of graylevel intensity values in the image, with a lower value indicating a greater similarity in intensity values. This is the normalized version of the GLN formula.

getSizeZoneNonUniformityFeatureValue
()[source]¶ 5. SizeZone NonUniformity (SZN)
\[\textit{SZN} = \frac{\sum^{N_s}_{j=1}\left(\sum^{N_g}_{i=1}{\textbf{P}(i,j)}\right)^2}{N_z}\]SZN measures the variability of size zone volumes in the image, with a lower value indicating more homogeneity in size zone volumes.

getSizeZoneNonUniformityNormalizedFeatureValue
()[source]¶ 6. SizeZone NonUniformity Normalized (SZNN)
\[\textit{SZNN} = \frac{\sum^{N_s}_{j=1}\left(\sum^{N_g}_{i=1}{\textbf{P}(i,j)}\right)^2}{N_z^2}\]SZNN measures the variability of size zone volumes throughout the image, with a lower value indicating more homogeneity among zone size volumes in the image. This is the normalized version of the SZN formula.

getZonePercentageFeatureValue
()[source]¶ 7. Zone Percentage (ZP)
\[\textit{ZP} = \frac{N_z}{N_p}\]ZP measures the coarseness of the texture by taking the ratio of number of zones and number of voxels in the ROI.
Values are in range \(\frac{1}{N_p} \leq ZP \leq 1\), with higher values indicating a larger portion of the ROI consists of small zones (indicates a more fine texture).

getGrayLevelVarianceFeatureValue
()[source]¶ 8. Gray Level Variance (GLV)
\[\textit{GLV} = \displaystyle\sum^{N_g}_{i=1}\displaystyle\sum^{N_s}_{j=1}{p(i,j)(i  \mu)^2}\]Here, \(\mu = \displaystyle\sum^{N_g}_{i=1}\displaystyle\sum^{N_s}_{j=1}{p(i,j)i}\)
GLV measures the variance in gray level intensities for the zones.

getZoneVarianceFeatureValue
()[source]¶ 9. Zone Variance (ZV)
\[\textit{ZV} = \displaystyle\sum^{N_g}_{i=1}\displaystyle\sum^{N_s}_{j=1}{p(i,j)(j  \mu)^2}\]Here, \(\mu = \displaystyle\sum^{N_g}_{i=1}\displaystyle\sum^{N_s}_{j=1}{p(i,j)j}\)
ZV measures the variance in zone size volumes for the zones.

getZoneEntropyFeatureValue
()[source]¶ 10. Zone Entropy (ZE)
\[\textit{ZE} = \displaystyle\sum^{N_g}_{i=1}\displaystyle\sum^{N_s}_{j=1}{p(i,j)\log_{2}(p(i,j)+\epsilon)}\]Here, \(\epsilon\) is an arbitrarily small positive number (\(\approx 2.2\times10^{16}\)).
ZE measures the uncertainty/randomness in the distribution of zone sizes and gray levels. A higher value indicates more heterogeneneity in the texture patterns.

getLowGrayLevelZoneEmphasisFeatureValue
()[source]¶ 11. Low Gray Level Zone Emphasis (LGLZE)
\[\textit{LGLZE} = \frac{\sum^{N_g}_{i=1}\sum^{N_s}_{j=1}{\frac{\textbf{P}(i,j)}{i^2}}}{N_z}\]LGLZE measures the distribution of lower graylevel size zones, with a higher value indicating a greater proportion of lower graylevel values and size zones in the image.

getHighGrayLevelZoneEmphasisFeatureValue
()[source]¶ 12. High Gray Level Zone Emphasis (HGLZE)
\[\textit{HGLZE} = \frac{\sum^{N_g}_{i=1}\sum^{N_s}_{j=1}{\textbf{P}(i,j)i^2}}{N_z}\]HGLZE measures the distribution of the higher graylevel values, with a higher value indicating a greater proportion of higher graylevel values and size zones in the image.

getSmallAreaLowGrayLevelEmphasisFeatureValue
()[source]¶ 13. Small Area Low Gray Level Emphasis (SALGLE)
\[\textit{SALGLE} = \frac{\sum^{N_g}_{i=1}\sum^{N_s}_{j=1}{\frac{\textbf{P}(i,j)}{i^2j^2}}}{N_z}\]SALGLE measures the proportion in the image of the joint distribution of smaller size zones with lower graylevel values.

getSmallAreaHighGrayLevelEmphasisFeatureValue
()[source]¶ 14. Small Area High Gray Level Emphasis (SAHGLE)
\[\textit{SAHGLE} = \frac{\sum^{N_g}_{i=1}\sum^{N_s}_{j=1}{\frac{\textbf{P}(i,j)i^2}{j^2}}}{N_z}\]SAHGLE measures the proportion in the image of the joint distribution of smaller size zones with higher graylevel values.

getLargeAreaLowGrayLevelEmphasisFeatureValue
()[source]¶ 15. Large Area Low Gray Level Emphasis (LALGLE)
\[\textit{LALGLE} = \frac{\sum^{N_g}_{i=1}\sum^{N_s}_{j=1}{\frac{\textbf{P}(i,j)j^2}{i^2}}}{N_z}\]LALGLE measures the proportion in the image of the joint distribution of larger size zones with lower graylevel values.

getLargeAreaHighGrayLevelEmphasisFeatureValue
()[source]¶ 16. Large Area High Gray Level Emphasis (LAHGLE)
\[\textit{LAHGLE} = \frac{\sum^{N_g}_{i=1}\sum^{N_s}_{j=1}{\textbf{P}(i,j)i^2j^2}}{N_z}\]LAHGLE measures the proportion in the image of the joint distribution of larger size zones with higher graylevel values.
Gray Level Run Length Matrix (GLRLM) Features¶

class
radiomics.glrlm.
RadiomicsGLRLM
(inputImage, inputMask, **kwargs)[source]¶ Bases:
radiomics.base.RadiomicsFeaturesBase
A Gray Level Run Length Matrix (GLRLM) quantifies gray level runs, which are defined as the length in number of pixels, of consecutive pixels that have the same gray level value. In a gray level run length matrix \(\textbf{P}(i,j\theta)\), the \((i,j)^{\text{th}}\) element describes the number of runs with gray level \(i\) and length \(j\) occur in the image (ROI) along angle \(\theta\).
As a two dimensional example, consider the following 5x5 image, with 5 discrete gray levels:
\[\begin{split}\textbf{I} = \begin{bmatrix} 5 & 2 & 5 & 4 & 4\\ 3 & 3 & 3 & 1 & 3\\ 2 & 1 & 1 & 1 & 3\\ 4 & 2 & 2 & 2 & 3\\ 3 & 5 & 3 & 3 & 2 \end{bmatrix}\end{split}\]The GLRLM for \(\theta = 0\), where 0 degrees is the horizontal direction, then becomes:
\[\begin{split}\textbf{P} = \begin{bmatrix} 1 & 0 & 1 & 0 & 0\\ 3 & 0 & 1 & 0 & 0\\ 4 & 1 & 1 & 0 & 0\\ 1 & 1 & 0 & 0 & 0\\ 3 & 0 & 0 & 0 & 0 \end{bmatrix}\end{split}\]Let:
 \(N_g\) be the number of discrete intensity values in the image
 \(N_r\) be the number of discrete run lengths in the image
 \(N_p\) be the number of voxels in the image
 \(N_r(\theta)\) be the number of runs in the image along angle \(\theta\), which is equal to \(\sum^{N_g}_{i=1}\sum^{N_r}_{j=1}{\textbf{P}(i,j\theta)}\) and \(1 \leq N_r(\theta) \leq N_p\)
 \(\textbf{P}(i,j\theta)\) be the run length matrix for an arbitrary direction \(\theta\)
 \(p(i,j\theta)\) be the normalized run length matrix, defined as \(p(i,j\theta) = \frac{\textbf{P}(i,j\theta)}{N_r(\theta)}\)
By default, the value of a feature is calculated on the GLRLM for each angle separately, after which the mean of these values is returned. If distance weighting is enabled, GLRLMs are weighted by the distance between neighbouring voxels and then summed and normalised. Features are then calculated on the resultant matrix. The distance between neighbouring voxels is calculated for each angle using the norm specified in ‘weightingNorm’.
The following class specific settings are possible:
weightingNorm [None]: string, indicates which norm should be used when applying distance weighting. Enumerated setting, possible values:
 ‘manhattan’: first order norm
 ‘euclidean’: second order norm
 ‘infinity’: infinity norm.
 ‘no_weighting’: GLCMs are weighted by factor 1 and summed
 None: Applies no weighting, mean of values calculated on separate matrices is returned.
In case of other values, an warning is logged and option ‘no_weighting’ is used.
References
 Galloway MM. 1975. Texture analysis using gray level run lengths. Computer Graphics and Image Processing, 4(2):172179.
 Chu A., Sehgal C.M., Greenleaf J. F. 1990. Use of gray value distribution of run length for texture analysis. Pattern Recognition Letters, 11(6):415419
 Xu D., Kurani A., Furst J., Raicu D. 2004. RunLength Encoding For Volumetric Texture. International Conference on Visualization, Imaging and Image Processing (VIIP), p. 452458
 Tang X. 1998. Texture information in runlength matrices. IEEE Transactions on Image Processing 7(11):16021609.
 Tustison N., Gee J. RunLength Matrices For Texture Analysis. Insight Journal 2008 January  June.

getShortRunEmphasisFeatureValue
()[source]¶ 1. Short Run Emphasis (SRE)
\[\textit{SRE} = \frac{\sum^{N_g}_{i=1}\sum^{N_r}_{j=1}{\frac{\textbf{P}(i,j\theta)}{j^2}}}{N_r(\theta)}\]SRE is a measure of the distribution of short run lengths, with a greater value indicative of shorter run lengths and more fine textural textures.

getLongRunEmphasisFeatureValue
()[source]¶ 2. Long Run Emphasis (LRE)
\[\textit{LRE} = \frac{\sum^{N_g}_{i=1}\sum^{N_r}_{j=1}{\textbf{P}(i,j\theta)j^2}}{N_r(\theta)}\]LRE is a measure of the distribution of long run lengths, with a greater value indicative of longer run lengths and more coarse structural textures.

getGrayLevelNonUniformityFeatureValue
()[source]¶ 3. Gray Level NonUniformity (GLN)
\[\textit{GLN} = \frac{\sum^{N_g}_{i=1}\left(\sum^{N_r}_{j=1}{\textbf{P}(i,j\theta)}\right)^2}{N_r(\theta)}\]GLN measures the similarity of graylevel intensity values in the image, where a lower GLN value correlates with a greater similarity in intensity values.

getGrayLevelNonUniformityNormalizedFeatureValue
()[source]¶ 4. Gray Level NonUniformity Normalized (GLNN)
\[\textit{GLNN} = \frac{\sum^{N_g}_{i=1}\left(\sum^{N_r}_{j=1}{\textbf{P}(i,j\theta)}\right)^2}{N_r(\theta)^2}\]GLNN measures the similarity of graylevel intensity values in the image, where a lower GLNN value correlates with a greater similarity in intensity values. This is the normalized version of the GLN formula.

getRunLengthNonUniformityFeatureValue
()[source]¶ 5. Run Length NonUniformity (RLN)
\[\textit{RLN} = \frac{\sum^{N_r}_{j=1}\left(\sum^{N_g}_{i=1}{\textbf{P}(i,j\theta)}\right)^2}{N_r(\theta)}\]RLN measures the similarity of run lengths throughout the image, with a lower value indicating more homogeneity among run lengths in the image.

getRunLengthNonUniformityNormalizedFeatureValue
()[source]¶ 6. Run Length NonUniformity Normalized (RLNN)
\[\textit{RLNN} = \frac{\sum^{N_r}_{j=1}\left(\sum^{N_g}_{i=1}{\textbf{P}(i,j\theta)}\right)^2}{N_r(\theta)^2}\]RLNN measures the similarity of run lengths throughout the image, with a lower value indicating more homogeneity among run lengths in the image. This is the normalized version of the RLN formula.

getRunPercentageFeatureValue
()[source]¶ 7. Run Percentage (RP)
\[\textit{RP} = {\frac{N_r(\theta)}{N_p}}\]RP measures the coarseness of the texture by taking the ratio of number of runs and number of voxels in the ROI.
Values are in range \(\frac{1}{N_p} \leq RP \leq 1\), with higher values indicating a larger portion of the ROI consists of short runs (indicates a more fine texture).
Note
Note that when weighting is applied and matrices are merged before calculation, \(N_p\) is multiplied by \(n\) number of matrices merged to ensure correct normalization (as each voxel is considered \(n\) times)

getGrayLevelVarianceFeatureValue
()[source]¶ 8. Gray Level Variance (GLV)
\[\textit{GLV} = \displaystyle\sum^{N_g}_{i=1}\displaystyle\sum^{N_r}_{j=1}{p(i,j\theta)(i  \mu)^2}\]Here, \(\mu = \displaystyle\sum^{N_g}_{i=1}\displaystyle\sum^{N_r}_{j=1}{p(i,j\theta)i}\)
GLV measures the variance in gray level intensity for the runs.

getRunVarianceFeatureValue
()[source]¶ 9. Run Variance (RV)
\[\textit{RV} = \displaystyle\sum^{N_g}_{i=1}\displaystyle\sum^{N_r}_{j=1}{p(i,j\theta)(j  \mu)^2}\]Here, \(\mu = \displaystyle\sum^{N_g}_{i=1}\displaystyle\sum^{N_r}_{j=1}{p(i,j\theta)j}\)
RV is a measure of the variance in runs for the run lengths.

getRunEntropyFeatureValue
()[source]¶ 10. Run Entropy (RE)
\[\textit{RE} = \displaystyle\sum^{N_g}_{i=1}\displaystyle\sum^{N_r}_{j=1} {p(i,j\theta)\log_{2}(p(i,j\theta)+\epsilon)}\]Here, \(\epsilon\) is an arbitrarily small positive number (\(\approx 2.2\times10^{16}\)).
RE measures the uncertainty/randomness in the distribution of run lengths and gray levels. A higher value indicates more heterogeneity in the texture patterns.

getLowGrayLevelRunEmphasisFeatureValue
()[source]¶ 11. Low Gray Level Run Emphasis (LGLRE)
\[\textit{LGLRE} = \frac{\sum^{N_g}_{i=1}\sum^{N_r}_{j=1}{\frac{\textbf{P}(i,j\theta)}{i^2}}}{N_r(\theta)}\]LGLRE measures the distribution of low graylevel values, with a higher value indicating a greater concentration of low graylevel values in the image.

getHighGrayLevelRunEmphasisFeatureValue
()[source]¶ 12. High Gray Level Run Emphasis (HGLRE)
\[\textit{HGLRE} = \frac{\sum^{N_g}_{i=1}\sum^{N_r}_{j=1}{\textbf{P}(i,j\theta)i^2}}{N_r(\theta)}\]HGLRE measures the distribution of the higher graylevel values, with a higher value indicating a greater concentration of high graylevel values in the image.

getShortRunLowGrayLevelEmphasisFeatureValue
()[source]¶ 13. Short Run Low Gray Level Emphasis (SRLGLE)
\[\textit{SRLGLE} = \frac{\sum^{N_g}_{i=1}\sum^{N_r}_{j=1}{\frac{\textbf{P}(i,j\theta)}{i^2j^2}}}{N_r(\theta)}\]SRLGLE measures the joint distribution of shorter run lengths with lower graylevel values.

getShortRunHighGrayLevelEmphasisFeatureValue
()[source]¶ 14. Short Run High Gray Level Emphasis (SRHGLE)
\[\textit{SRHGLE} = \frac{\sum^{N_g}_{i=1}\sum^{N_r}_{j=1}{\frac{\textbf{P}(i,j\theta)i^2}{j^2}}}{N_r(\theta)}\]SRHGLE measures the joint distribution of shorter run lengths with higher graylevel values.

getLongRunLowGrayLevelEmphasisFeatureValue
()[source]¶ 15. Long Run Low Gray Level Emphasis (LRLGLE)
\[\textit{LRLGLRE} = \frac{\sum^{N_g}_{i=1}\sum^{N_r}_{j=1}{\frac{\textbf{P}(i,j\theta)j^2}{i^2}}}{N_r(\theta)}\]LRLGLRE measures the joint distribution of long run lengths with lower graylevel values.
Neighbouring Gray Tone Difference Matrix (NGTDM) Features¶

class
radiomics.ngtdm.
RadiomicsNGTDM
(inputImage, inputMask, **kwargs)[source]¶ Bases:
radiomics.base.RadiomicsFeaturesBase
A Neighbouring Gray Tone Difference Matrix quantifies the difference between a gray value and the average gray value of its neighbours within distance \(\delta\). The sum of absolute differences for gray level \(i\) is stored in the matrix. Let \(\textbf{X}_{gl}\) be a set of segmented voxels and \(x_{gl}(j_x,j_y,j_z) \in \textbf{X}_{gl}\) be the gray level of a voxel at postion \((j_x,j_y,j_z)\), then the average gray level of the neigbourhood is:
\[\begin{split}\bar{A}_i &= \bar{A}(j_x, j_y, j_z) \\ &= \displaystyle\frac{1}{W} \displaystyle\sum_{k_x=\delta}^{\delta}\displaystyle\sum_{k_y=\delta}^{\delta} \displaystyle\sum_{k_z=\delta}^{\delta}{x_{gl}(j_x+k_x, j_y+k_y, j_z+k_z)}, \\ &\mbox{where }(k_x,k_y,k_z)\neq(0,0,0)\mbox{ and } x_{gl}(j_x+k_x, j_y+k_y, j_z+k_z) \in \textbf{X}_{gl}\end{split}\]Here, \(W\) is the number of voxels in the neighbourhood that are also in \(\textbf{X}_{gl}\).
As a two dimensional example, let the following matrix \(\textbf{I}\) represent a 4x4 image, having 5 discrete grey levels, but no voxels with gray level 4:
\[\begin{split}\textbf{I} = \begin{bmatrix} 1 & 2 & 5 & 2\\ 3 & 5 & 1 & 3\\ 1 & 3 & 5 & 5\\ 3 & 1 & 1 & 1\end{bmatrix}\end{split}\]The following NGTDM can be obtained:
\[\begin{split}\begin{array}{cccc} i & n_i & p_i & s_i\\ \hline 1 & 6 & 0.375 & 13.35\\ 2 & 2 & 0.125 & 2.00\\ 3 & 4 & 0.25 & 2.63\\ 4 & 0 & 0.00 & 0.00\\ 5 & 4 & 0.25 & 10.075\end{array}\end{split}\]6 pixels have gray level 1, therefore:
\(s_1 = 110/3 + 130/8 + 115/5 + 113/5 + 115/5 + 111/3 = 13.35\)
For gray level 2, there are 2 pixels, therefore:
\(s_2 = 215/5 + 29/3 = 2\)
Similar for gray values 3 and 5:
\(s_3 = 312/5 + 318/5 + 320/8 + 35/3 = 3.03 \\ s_5 = 514/5 + 518/5 + 520/8 + 511/5 = 10.075\)
Let:
\(n_i\) be the number of voxels in \(X_{gl}\) with gray level \(i\)
\(N_{v,p}\) be the total number of voxels in \(X_{gl}\) and equal to \(\sum{n_i}\) (i.e. the number of voxels with a valid region; at least 1 neighbor). \(N_{v,p} \leq N_p\), where \(N_p\) is the total number of voxels in the ROI.
\(p_i\) be the gray level probability and equal to \(n_i/N_v\)
\(s_i = \left\{ {\begin{array} {rcl} \sum^{n_i}{i\bar{A}_i} & \mbox{for} & n_i \neq 0 \\ 0 & \mbox{for} & n_i = 0 \end{array}}\right.\) be the sum of absolute differences for gray level \(i\)
\(N_g\) be the number of discrete gray levels
\(N_{g,p}\) be the number of gray levels where \(p_i \neq 0\)
The following class specific settings are possible:
 distances [[1]]: List of integers. This specifies the distances between the center voxel and the neighbor, for which angles should be generated.
References
 Amadasun M, King R; Textural features corresponding to textural properties; Systems, Man and Cybernetics, IEEE Transactions on 19:12641274 (1989). doi: 10.1109/21.44046

getCoarsenessFeatureValue
()[source]¶ Calculate and return the coarseness.
\(Coarseness = \frac{1}{\sum^{N_g}_{i=1}{p_{i}s_{i}}}\)
Coarseness is a measure of average difference between the center voxel and its neighbourhood and is an indication of the spatial rate of change. A higher value indicates a lower spatial change rate and a locally more uniform texture.
N.B. \(\sum^{N_g}_{i=1}{p_{i}s_{i}}\) potentially evaluates to 0 (in case of a completely homogeneous image). If this is the case, an arbitrary value of \(10^6\) is returned.

getContrastFeatureValue
()[source]¶ Calculate and return the contrast.
\(Contrast = \left(\frac{1}{N_{g,p}(N_{g,p}1)}\displaystyle\sum^{N_g}_{i=1}\displaystyle\sum^{N_g}_{j=1}{p_{i}p_{j}(ij)^2}\right) \left(\frac{1}{N_{v,p}}\displaystyle\sum^{N_g}_{i=1}{s_i}\right)\text{, where }p_i \neq 0, p_j \neq 0\)
Contrast is a measure of the spatial intensity change, but is also dependent on the overall gray level dynamic range. Contrast is high when both the dynamic range and the spatial change rate are high, i.e. an image with a large range of gray levels, with large changes between voxels and their neighbourhood.
N.B. In case of a completely homogeneous image, \(N_{g,p} = 1\), which would result in a division by 0. In this case, an arbitray value of 0 is returned.

getBusynessFeatureValue
()[source]¶ Calculate and return the busyness.
\(Busyness = \frac{\sum^{N_g}_{i = 1}{p_{i}s_{i}}}{\sum^{N_g}_{i = 1}\sum^{N_g}_{j = 1}{ip_i  jp_j}}\text{, where }p_i \neq 0, p_j \neq 0\)
A measure of the change from a pixel to its neighbour. A high value for busyness indicates a ‘busy’ image, with rapid changes of intensity between pixels and its neighbourhood.
N.B. if \(N_{g,p} = 1\), then \(busyness = \frac{0}{0}\). If this is the case, 0 is returned, as it concerns a fully homogeneous region.

getComplexityFeatureValue
()[source]¶ Calculate and return the complexity.
\(Complexity = \frac{1}{N_{v,p}}\displaystyle\sum^{N_g}_{i = 1}\displaystyle\sum^{N_g}_{j = 1}{i  j \frac{p_{i}s_{i} + p_{j}s_{j}}{p_i + p_j}}\text{, where }p_i \neq 0, p_j \neq 0\)
An image is considered complex when there are many primitive components in the image, i.e. the image is nonuniform and there are many rapid changes in gray level intensity.

getStrengthFeatureValue
()[source]¶ Calculate and return the strength.
\(Strength = \frac{\sum^{N_g}_{i = 1}\sum^{N_g}_{j = 1}{(p_i + p_j)(ij)^2}}{\sum^{N_g}_{i = 1}{s_i}}\text{, where }p_i \neq 0, p_j \neq 0\)
Strength is a measure of the primitives in an image. Its value is high when the primitives are easily defined and visible, i.e. an image with slow change in intensity but more large coarse differences in gray level intensities.
N.B. \(\sum^{N_g}_{i=1}{s_i}\) potentially evaluates to 0 (in case of a completely homogeneous image). If this is the case, 0 is returned.
Gray Level Dependence Matrix (GLDM) Features¶

class
radiomics.gldm.
RadiomicsGLDM
(inputImage, inputMask, **kwargs)[source]¶ Bases:
radiomics.base.RadiomicsFeaturesBase
A Gray Level Dependence Matrix (GLDM) quantifies gray level dependencies in an image. A gray level dependency is defined as a the number of connected voxels within distance \(\delta\) that are dependent on the center voxel. A neighbouring voxel with gray level \(j\) is considered dependent on center voxel with gray level \(i\) if \(ij\le\alpha\). In a gray level dependence matrix \(\textbf{P}(i,j)\) the \((i,j)\)^{th} element describes the number of times a voxel with gray level \(i\) with \(j\) dependent voxels in its neighbourhood appears in image.
As a two dimensional example, consider the following 5x5 image, with 5 discrete gray levels:
\[\begin{split}\textbf{I} = \begin{bmatrix} 5 & 2 & 5 & 4 & 4\\ 3 & 3 & 3 & 1 & 3\\ 2 & 1 & 1 & 1 & 3\\ 4 & 2 & 2 & 2 & 3\\ 3 & 5 & 3 & 3 & 2 \end{bmatrix}\end{split}\]For \(\alpha=0\) and \(\delta = 1\), the GLDM then becomes:
\[\begin{split}\textbf{P} = \begin{bmatrix} 0 & 1 & 2 & 1 \\ 1 & 2 & 3 & 0 \\ 1 & 4 & 4 & 0 \\ 1 & 2 & 0 & 0 \\ 3 & 0 & 0 & 0 \end{bmatrix}\end{split}\]Let:
 \(N_g\) be the number of discrete intensity values in the image
 \(N_d\) be the number of discrete dependency sizes in the image
 \(N_z\) be the number of dependency zones in the image, which is equal to \(\sum^{N_g}_{i=1}\sum^{N_d}_{j=1}{\textbf{P}(i,j)}\)
 \(\textbf{P}(i,j)\) be the dependence matrix
 \(p(i,j)\) be the normalized dependence matrix, defined as \(p(i,j) = \frac{\textbf{P}(i,j)}{N_z}\)
Note
Because incomplete zones are allowed, every voxel in the ROI has a dependency zone. Therefore, \(N_z = N_p\), where \(N_p\) is the number of voxels in the image. Due to the fact that \(Nz = N_p\), the Dependence Percentage and Gray Level NonUniformity Normalized (GLNN) have been removed. The first because it would always compute to 1, the latter because it is mathematically equal to first order  Uniformity (see
getUniformityFeatureValue()
). For mathematical proofs, see here.The following class specific settings are possible:
 distances [[1]]: List of integers. This specifies the distances between the center voxel and the neighbor, for which angles should be generated.
 gldm_a [0]: float, \(\alpha\) cutoff value for dependence. A neighbouring voxel with gray level \(j\) is considered dependent on center voxel with gray level \(i\) if \(ij\le\alpha\)
References:
 Sun C, Wee WG. Neighboring Gray Level Dependence Matrix for Texture Classification. Comput Vision, Graph Image Process. 1983;23:341352

getSmallDependenceEmphasisFeatureValue
()[source]¶ 1. Small Dependence Emphasis (SDE)
\[SDE = \frac{\sum^{N_g}_{i=1}\sum^{N_d}_{j=1}{\frac{\textbf{P}(i,j)}{i^2}}}{N_z}\]A measure of the distribution of small dependencies, with a greater value indicative of smaller dependence and less homogeneous textures.

getLargeDependenceEmphasisFeatureValue
()[source]¶ 2. Large Dependence Emphasis (LDE)
\[LDE = \frac{\sum^{N_g}_{i=1}\sum^{N_d}_{j=1}{\textbf{P}(i,j)j^2}}{N_z}\]A measure of the distribution of large dependencies, with a greater value indicative of larger dependence and more homogeneous textures.

getGrayLevelNonUniformityFeatureValue
()[source]¶ 3. Gray Level NonUniformity (GLN)
\[GLN = \frac{\sum^{N_g}_{i=1}\left(\sum^{N_d}_{j=1}{\textbf{P}(i,j)}\right)^2}{N_z}\]Measures the similarity of graylevel intensity values in the image, where a lower GLN value correlates with a greater similarity in intensity values.

getGrayLevelNonUniformityNormalizedFeatureValue
()[source]¶ DEPRECATED. Gray Level NonUniformity Normalized (GLNN)
\(GLNN = \frac{\sum^{N_g}_{i=1}\left(\sum^{N_d}_{j=1}{\textbf{P}(i,j)}\right)^2}{\sum^{N_g}_{i=1} \sum^{N_d}_{j=1}{\textbf{P}(i,j)}^2}\)
Warning
This feature has been deprecated, as it is mathematically equal to First Order  Uniformity
getUniformityFeatureValue()
. See here for the proof. Enabling this feature will result in the logging of a DeprecationWarning (does not interrupt extraction of other features), no value is calculated for this feature

getDependenceNonUniformityFeatureValue
()[source]¶ 4. Dependence NonUniformity (DN)
\[DN = \frac{\sum^{N_d}_{j=1}\left(\sum^{N_g}_{i=1}{\textbf{P}(i,j)}\right)^2}{N_z}\]Measures the similarity of dependence throughout the image, with a lower value indicating more homogeneity among dependencies in the image.

getDependenceNonUniformityNormalizedFeatureValue
()[source]¶ 5. Dependence NonUniformity Normalized (DNN)
\[DNN = \frac{\sum^{N_d}_{j=1}\left(\sum^{N_g}_{i=1}{\textbf{P}(i,j)}\right)^2}{N_z^2}\]Measures the similarity of dependence throughout the image, with a lower value indicating more homogeneity among dependencies in the image. This is the normalized version of the DLN formula.

getGrayLevelVarianceFeatureValue
()[source]¶ 6. Gray Level Variance (GLV)
\[GLV = \displaystyle\sum^{N_g}_{i=1}\displaystyle\sum^{N_d}_{j=1}{p(i,j)(i  \mu)^2} \text{, where} \mu = \displaystyle\sum^{N_g}_{i=1}\displaystyle\sum^{N_d}_{j=1}{ip(i,j)}\]Measures the variance in grey level in the image.

getDependenceVarianceFeatureValue
()[source]¶ 7. Dependence Variance (DV)
\[DV = \displaystyle\sum^{N_g}_{i=1}\displaystyle\sum^{N_d}_{j=1}{p(i,j)(j  \mu)^2} \text{, where} \mu = \displaystyle\sum^{N_g}_{i=1}\displaystyle\sum^{N_d}_{j=1}{jp(i,j)}\]Measures the variance in dependence size in the image.

getDependenceEntropyFeatureValue
()[source]¶ 8. Dependence Entropy (DE)
\[Dependence Entropy = \displaystyle\sum^{N_g}_{i=1}\displaystyle\sum^{N_d}_{j=1}{p(i,j)\log_{2}(p(i,j)+\epsilon)}\]

getDependencePercentageFeatureValue
()[source]¶ DEPRECATED. Dependence Percentage
\[\textit{dependence percentage} = \frac{N_z}{N_p}\]Warning
This feature has been deprecated, as it would always compute 1. See here for more details. Enabling this feature will result in the logging of a DeprecationWarning (does not interrupt extraction of other features), no value is calculated for this features

getLowGrayLevelEmphasisFeatureValue
()[source]¶ 9. Low Gray Level Emphasis (LGLE)
\[LGLE = \frac{\sum^{N_g}_{i=1}\sum^{N_d}_{j=1}{\frac{\textbf{P}(i,j)}{i^2}}}{N_z}\]Measures the distribution of low graylevel values, with a higher value indicating a greater concentration of low graylevel values in the image.

getHighGrayLevelEmphasisFeatureValue
()[source]¶ 10. High Gray Level Emphasis (HGLE)
\[HGLE = \frac{\sum^{N_g}_{i=1}\sum^{N_d}_{j=1}{\textbf{P}(i,j)i^2}}{N_z}\]Measures the distribution of the higher graylevel values, with a higher value indicating a greater concentration of high graylevel values in the image.

getSmallDependenceLowGrayLevelEmphasisFeatureValue
()[source]¶ 11. Small Dependence Low Gray Level Emphasis (SDLGLE)
\[SDLGLE = \frac{\sum^{N_g}_{i=1}\sum^{N_d}_{j=1}{\frac{\textbf{P}(i,j)}{i^2j^2}}}{N_z}\]Measures the joint distribution of small dependence with lower graylevel values.

getSmallDependenceHighGrayLevelEmphasisFeatureValue
()[source]¶ 12. Small Dependence High Gray Level Emphasis (SDHGLE)
Measures the joint distribution of small dependence with higher graylevel values.
[1]  Zwanenburg, A., Leger, S., Vallières, M., and Löck, S. (2016). Image biomarker standardisation initiative  feature definitions. In eprint arXiv:1612.07003 [cs.CV] 