## 2 Materials and Methods
### Methods
#### 2.2.2 Three Dimensional Chain Coding  
The segmentation of the lung regions usually fails when the nodules adhere to the boundary of the lungs. Such nodules are known as the juxta-pleural nodules and are exposed the intensities that are similar to the lung wall. Thus, during segmentation, they are usually excluded, together with the lung wall, and this produces an under-segmentation result. As an instance, Figure 3a demonstrates a 2D CT slice containing a juxta-pleural nodule (denoted by a red rectangle), and Figure 3b shows the segmentation result of the lungs in 3D, applying the automated SRG. From this image, we can notice that the juxta-pleural nodule is under-segmented (denoted by a red rectangle). Chain coding [4,5] is the most frequently used algorithm to solve the problem of juxta-pleural nodule segmentation. It traces the pixels/voxels along the contour of the lungs and determines whether there is a discrete path or not. If a discrete region is found, it is assumed to be the place of  
Figure 3: Unsuccessful segmentation of a Juxta-pleural nodule. (**a**) A two-dimensional computer tomography (CT) scan with a juxta-pleural nodule, and (**b**) an under-segmentation of the juxta-pleural nodule in a three-dimensional view. Figure 2: Automatic seed points selection using HU values of input CT volume (**a**) Histogram showing the distribution of HU values (**b**) two seed points selected for seeded region growing. the juxta-pleural nodule and it is enclosed by connecting the lung border. The bi-directional chain coding method in [6] is an advancement to the original chain coding in [5]. It uses two-dimensional coordinate systems to trace the boundary pixels in both the horizontal and vertical directions. It works well for juxta-pleural nodule segmentation, but it needs to operate on each 2D slice of the input CT exams. As a negative consequence, it consumes a lot of processing time and effort. Additionally, it needs a supplementary algorithm, for example, the support vector machine (SVM) [6], to determine and connect the start-point and end-point of the discrete path. Unlike the chain codes in [4; 5], we propose a three-dimensional chain code algorithm [33; 34] for juxta-pleural nodule detection. The main difference is that the chain coding in [4; 5] works in 2D segments of lung regions, but our proposed 3D chain coding works in the 3D segments of lung volume. Firstly, we extract the voxelized edge \(V\), i.e., a single voxel outline, of the segmented lungs. On that boundary or edge, \(V\), suppose there are \(N\) number of voxels. \(V(i)\) is the \(i^{th}\) voxel of the boundary where \(i=\{1,\ 2,\ \ldots\ N\}\). Then, [PERSON]'s F26 code word system [33] is applied to trace the directional changes between \(V(i)\) and its adjacent voxel \(V(i+1)\). As illustrated in Figure 4, F26 views a boundary voxel as a cubic lattice, and there are three types of adjacencies between neighborhood voxels. A cube is comprisesd of six faces, twelve edges, and eight vertices; thus, there are twenty-six possible directions. The associated codeword values of these directions are also described in Figure 4, using \(a\) to \(z\) characters. The codeword values are assigned, depending on the direction of the movement between a voxel to its adjacent one. A movement between two voxels is defined as a set of codeword values \(c\ (i)\), and each \(c\ (i)\) contains three elements that represent a face, edge and vertex connection, such that \(c\ (i)\in\ \{0,\ 1,-1\}\). For a visual explanation, Figure 5 demonstrates a path of the voxelized edge, and its associated codeword values can be assigned based on the adjacencies and directions between voxels along that path. The path contains seven voxels; thus, there are six directional movements between its voxels. Then, the associated codeword values of these movements can be defined by six sets, where each set contains three elements, as described below. Figure 4: Codeword values for 26 possible directions of the three dimensional chain code [30].