## 3 Methods
### Staging
#### 3.3.1 Locational Feature Extraction
As we were working on the 3D volumetric data, the algorithm returned a \(p-by-3\) matrix, where \(p\) is the total number of vertex points of the polygon and shows each point with three coordinate values \((x,\ y,\ z)\). Assuming \(T\) is a tumor nodule, \(Lz\) is a specific locational zone (any of zone from Zone 1 to Zone 7 is possible). We checked the invasion of \(T\) to the \(Lz\) using the invasion checking Algorithm 1 described below. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Lung Zones** & **Regions Invaded** & **Associated Tumor Stages** \\ \hline Zone 1 & Trachea & T4 \\ Zone 2 & Main bronchus and hilar & T2 \\ Zone 3 & Lobar bronchus & T1 \\ Zone 4 & Chest wall & T3 \\ Zone 5 & Pulmonary vessels & T4 \\ Zone 6 & Mediastinum, heart, phenic nerve, and parietal pericardium & T3, T4 \\ Zone 7 & Diaphrag & T4 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Dividing different zones. Figure 11: Different locational zones of the lungs. ```
1. Calculate the convex hulls of \(T\) and \(Lz\) and name them \(C_{T}\) and \(C_{Lz}\) respectively. Both of them are the \(p\)-by-3 matrixes, where \(p\) is the number of vertices in the convex polygon, and each vertex has \(x,y\) and \(z\) coordinate values. 2. Assign the initial status of invasion with a Boolean value such that \(\mathit{Invasion}=0\). 3. From \(C_{T}\), find six values which are the minimum and maximum of each coordinate. Let us say that \(\min C_{Tx}\) and \(\max C_{Tx}\) are the minimum and maximum values among the \(x\) coordinate points. In this way, \(\min C_{Ty}\), \(\max C_{Ty}\), \(\min C_{Tz}\), and \(\max C_{Tz}\) are also calculated from the \(y\) and \(z\) coordinates points. 4. Similar to step 3, calculate another six values from \(C_{LZ}\). They are \(\min C_{LZX}\), \(\max C_{LZX}\), \(\min C_{LZy}\), \(\min C_{LZy}\), \(\min C_{LZy}\), and \(\min C_{LZy}\). 5. Based on these values, check whether \(T\) is located inside or outside of \(LZ\). If \(\min C_{Tx}>\min C_{LZx}\) and \(\min_{Ty}>\min C_{LZy}\) and \(\min C_{Tz}>\min C_{LZZ}\) and \(\max C_{Tx}<\max C_{LZx}\) and \(\max_{Ty}<\max C_{LZy}\) and \(\max C_{Tz}<\max C_{LZz}\), then the convex polygon of \(T\) geometrically locates inside that of \(Lz\) and is assigned the value \(\mathit{Invasion}=1\). ```  
**Algorithm 1** Invasion checking  
Generally, tumor nodules are isolated inside the lungs, but in some cases they may attach to the visceral pleura. In order to investigate this, we first checked whether the tumor nodule was inside or outside of the lung regions. For this task, we used the previously described checking algorithm again. Here, \(Lz\) became the lung regions instead of the locational zones. Once the tumor nodule was located inside the lungs, we needed to check whether the nodule was attached to the pleura or not. For this task, the following steps of the pleural attachment checking Algorithm 2 were performed. ```
1.\(L\) is one of the lungs (left or right lung), and \(T\) is the tumor nodule. Both \(L\) and \(T\) are three dimensional arrays (\(512\times 512\times\) number of slices in a single exam). Firstly, convert both arrays into logical arrays by changing all the voxels values into 1 and 0. 2. Assign a Boolean value to the initial status of pleural attachment such that \(\mathit{Pleural attachment}=0\). 3. Find the edge voxels of the logical array \(L\), and define it as \(E\). 4. Calculate the logical negation of \(E\) from \(T\) and assign the results into a temporary array called \(\mathit{Tmp}\) such that \(\mathit{Tmp}=T\) (\(\sim E\)). 5. Check whether \(\mathit{Tmp}\) has any values of 1 or not. If there is a value of 1, some part of the tumor is along the edge of the lung region. Modify the status of pleural attachment to \(\mathit{Pleural attachment}=1\). ```  
**Algorithm 2** pleural attachment checking  
After checking for pleural attachment, another essential feature is the number of tumor nodules in the lungs. This feature can be achieved by counting the total number of true predicted nodules in a single exam.