## Scripting example (simple series) v>5.10

• DataFile1_PT_Anonym.zip
• DataFile1_PT_Anonym_RoiVolume_healthy.nii
• DataFile1_PT_Anonym_RoiVolume_tumor.nii
• DataFile1_PT_Anonym_TextureResults.cvs

Unzip the DataFile1_PT_Anonym.zip

Create the script file DataFile1_PT_Anonym_script.txt (see example of script below).

Edit the script and remplace all the "WD" by your working directory:

• ex on Linux: WD=/home/me/LIFExControlQualitySet
• ex on Mac: WD=/home/me/LIFExControlQualitySet
• ex on Windows: WD=C:/Users/me/LIFExControlQualitySet

Run:

1. drag and drop the script file into LIFEx (left side after having selected texture protocol)
2. results are saved in DataFile1_PT_Anonym_TextureResults.csv
3. check results with our DataFile1_PT_Anonym_TextureResults.csv file

Here, an example of script (save in txt format, not rtf):

#CommonLIFEx.texture.BinSize=3.125LIFEx.texture.NbGrey=64.0LIFEx.texture.SessionCsv=WD/DataFiles/DataFile1_PTCT/DataFile1_PT_Anonym_TextureResults_LIFEx5.60.csv# AbsoluteLIFEx.texture.ButtonAbsolute=trueLIFEx.texture.MinBound=0.0LIFEx.texture.MaxBound=20.0# RelativeMeanSdLIFEx.texture.ButtonRelativeMeanSd=false# RelativeMinMaxLIFEx.texture.ButtonRelativeMinMax=false# GLCMLIFEx.texture.GLCM.DistanceWithNeighbours=1# SpatialResampling (0 = no spatial resampling = native spacing voxels)LIFEx.texture.ZSpatialResampling=0LIFEx.texture.YSpatialResampling=0LIFEx.texture.XSpatialResampling=0# Patient0LIFEx.texture.Img0=WD/DataFiles/DataFile1_PTCT/DataFile1_PT_AnonymLIFEx.texture.Img0Roi0=WD/DataFiles/DataFile1_PTCT/DataFile1_PT_Anonym_RoiVolume_healthy.niiLIFEx.texture.Img0Roi1=WD/DataFiles/DataFile1_PTCT/DataFile1_PT_Anonym_RoiVolume_tumor.nii

## Conventional Indices

CONV_SUVmin reflects the minimum Standardized Uptake Value (SUV) in the Volume of Interest.

CONV\_SUVmin=\min_{i}SUV_i

## First Order Features - Histogram

Histogram calculation

To build a histogram, it is necessary to determine a bin width ("bin" parameter). The indices derived from the histogram will depend on this bin width parameter.

This dependence, similar to that found in texture index calculations, is often overlooked in publications.

In LIFEx, with the absolute model the histogram is built a number of bins equal to that entered by the user in the "number of grey level" and "size of bin" fields of the resampling menu.

In LIFEx, with the relative model the histogram is built only with "number of grey level" fields of the resampling menu that entered by the user and min and max are extracted values of each ROI.

## First Order Features - Shape

SHAPE_Sphericity is how spherical a Volume of Interest is. Sphericity is equal to 1 for a perfect sphere.

SHAPE\_Sphericity=\frac{\pi^{1/3}\cdot(6V)^{2/3}}{A}

where $$V$$ and $$A$$ correspond to the volume and the surface of the Volume Of Interest based on the Delaunay triangulation.

## Grey-Level Zone Length Matrix (GLZLM)

The grey-level zone length matrix (GLZLM) provides information on the size of homogeneous zones for each grey-level in 3 dimensions. It is also named Grey Level Size Zone Matrix (GLSZM).

From this matrix, 11 texture indices can be computed. Element $$(i,j)$$ of GLZLM corresponds to the number of homogeneous zones of $$j$$ voxels with the intensity $$i$$ in an image and is called $$GLZLM(i,j)$$ thereafter.

## Grey-Level Run Length Matrix (GLRLM)

The grey-level run length matrix (GLRLM) gives the size of homogeneous runs for each grey level. This matrix is computed for the 13 different directions in 3D (4 in 2D) and for each of the 11 texture indices derived from this matrix, the 3D value is the average over the 13 directions in 3D (4 in 2D). The element $$(i,j)$$ of GLRLM corresponds to the number of homogeneous runs of $$j$$ voxels with intensity $$i$$ in an image and is called $$GLRLM(i,j)$$ thereafter.

## Neighborhood Grey-Level Different Matrix (NGLDM)

The neighborhood grey-level different matrix (NGLDM) corresponds to the difference of grey-level between one voxel and its 26 neighbours in 3 dimensions (8 in 2D). Three texture indices can be computed from this matrix. An element $$(i,1)$$ of NGLDM corresponds to the probability of occurrence of level $$i$$ and an element $$(i,2)$$ is equal to:

NGLDM(i,2)= \sum_{p}\sum_{q} \left\lbrace
\begin{array}{ll}
|\overline{M}(p,q)-i| \mbox{~if $I(p,q)=i$} \\
0 \mbox{~else}
\end{array}
\right.

where $$\overline{M}(p,q)$$ is the average of intensities over the 26 neighbour voxels of voxel $$(p,q)$$.

## Grey Level Co-occurrence Matrix (GLCM)

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:

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.

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}$$