# Computer Tools to Analyze Lung CT Changes after Radiotherapy
## 3 CT Images' Preprocessing Using CNN  
The application of AI and deep learning (DL) in the field of diagnosis from CT scans was proposed in several research works. [PERSON] et al. in [PERSON] et al. (2017) presented a comprehensive survey on the application of DL, reinforcement learning (RL), and deep RL techniques in mining biomedical data, including medical images. [PERSON] et al. [PERSON] et al. (2018) analyzed three types of artificial neural networks, i.e., non-convolutional deep neural networks (DNNs), CNNs, and sparse autoencoders (SAEs), and the CNN model was chosen as the most accurate in this type application. The CNN was also successfully used by [PERSON] et al. [PERSON] et al. (2018) to analyze CT scans of smokers to identify those having chronic obstructive pulmonary disease. CT-based examination was proven to be an important diagnostic procedure for COVID-19 and has been applied as a major diagnostic modality in confirming positive COVID-19 cases [PERSON] et al. (2018); [PERSON] et al. (2018); [PERSON] et al. (2018); [PERSON] et al. (2018). An important task to be completed before starting the lung images' analysis is the selection of the CT slices, which include lungs, out of all the set of slices obtained from the multi-slice CT. In our system, for this purpose, we decided to use two of the neural network tested in [PERSON] et al. (2017), i.e., VGG16 and VGG19.The structure of the VGG16 network is presented in Figure 2.  
The data flow of the implemented procedure is presented in Figure 3.  
The input data required for CNN training, validation, and testing were downloaded from the Cancer Imaging Archive website ([PERSON] et al., 2015). The selection filter was set to the following values:  
* Collections: NSCLC-radiomics
* Image modality: CT
* Anatomical site: lung  
The structure of the training, validation and testing data is described in Table 2.  
After reading the slices given in DICOM, the necessary scaling was applied. First the read slices were converted to the Hounsfield scale. The minimum threshold was set to \(-1024\) (\(-1000\) is the air level). This operation reset the _PixelPaddingValue_ parameter, which was present in some DICOM files. The next operation moved the scale to include only positive values (simply a minimum value in each slice was added). Next, the maximum threshold was set. All values above \(X\) were changed to \(X\) (\(X=2000\), \(2500\)). The resulting range was rescaled to real numbers in the range <0.0, 1.0>. Since the VGG network was designed for RGB input images, we tripled the one input channel. It was also necessary to change the slice image size to \(224\times 224\). We used a sigmoid activation function for the last layer in the VGG networks and the ReLU (rectified linear unit) function for the other layers. The _padding_ parameter was set to _same_ value, and the training process was set for 32 epochs. As mentioned above, we tested two sets of input data with different maximum thresholds \(X\) (\(X=2000,2500\)) and two CNN configurations: VGG16 and VGG19. We also  
Figure 2: The structure of the VGG network used in our system. VGG16-2500 was discarded because of _not lung_ images being classified as _lung_. These mistakes did not appear for the other networks, which in fact were similar in accuracy. We noticed a difference for 1-2 images; however, in these cases, the expert's decisions for the validation sets were also not clear. Figure 4 illustrates the set of images that were classified by all tested networks as FN, which means the image was classified as _not lung_, whereas it contained a lung. \begin{table}
\begin{tabular}{c c c c c} \hline \hline  & **VGG19-2000** & **VGG19-2500** & **VGG16-2000** & **VGG16-2500** \\ \hline Accuracy = (TP + TN)/All & 0.9732 & 0.9739 & 0.9780 & 0.9766 \\ \hline Sensitivity = TP/(TP + FN) & 0.9696 & 0.9718 & 0.9741 & 0.9876 \\ \hline Specificity = TN/(TN + FP) & 0.9788 & 0.9771 & 0.9841 & 0.9594 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Accuracy, sensitivity, and specificity for the validation set.