## 2 Materials and Methods
### Engineered Features
#### 2.1.4 Texture Magnitude  
In the analysis of the texture patterns, while the significance of the directional information predominates the role of magnitude information, often overlooked in texture patterns, is nonetheless crucial. This magnitude information is instrumental in delineating edge and gradient structures, offering advantages over other texture descriptors, such as the original LBP. Inspired by the concept of LBP, we propose a novel magnitude pattern aimed at enhancing nodule diagnosis. Recognizing that essential texture information is  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Direction** & \(N^{\prime}_{x}(g_{c})\geq 0\) & \(N^{\prime}_{y}(g_{c})\geq 0\) & \(N^{\prime}_{z}(g_{c})\geq 0\) \\ \hline
1 & ✓ & ✓ & ✓ \\
2 & ✓ & ✓ & ✗ \\
3 & ✓ & ✗ & ✓ \\
4 & ✓ & ✗ & ✗ \\
5 & ✗ & ✓ & ✓ \\
6 & ✗ & ✓ & ✗ \\
7 & ✗ & ✗ & ✓ \\
8 & ✗ & ✗ & ✗ \\ \hline \hline \end{tabular}
\end{table}
Table 1: Central voxel direction based on its first-order derivative.  
predominantly aligned along the \(x\), \(y\), and \(z\) axes, our pattern's primary objective is to investigate the interrelations among neighboring voxels and their immediate surroundings. This investigation leverages magnitude information across the \(x\), \(y\), and \(z\) directions.  
The magnitude pattern (MP) is calculated from the magnitude of the first-order derivatives along the \(x\), \(y\), and \(z\) axes using the following equation:  
\[MP=\sum_{i=1}^{N}2^{i-1}*f(M_{N^{\prime}}(g_{i})-M_{N^{\prime}}(g_{c})) \tag{8}\]  
\[M_{N^{\prime}}(g_{c})=\sqrt{N_{x}^{\prime}(g_{c})^{2}+N_{y}^{\prime}(g_{c})^{ 2}+N_{z}^{\prime}(g_{c})^{2}} \tag{9}\]  
\[f(x)=\begin{cases}1,&\text{if }x\geq 0\\ 0,&\text{otherwise}\end{cases} \tag{10}\]  
In this context, \(f(x)\) denotes a function with \(x\) derived from the discrepancy in magnitude between the neighboring pixels and the central pixel, as delineated in Equation (8), where \(x=M_{N^{\prime}}(g_{i})-M_{N^{\prime}}(g_{c})\). An illustrative example of computing the magnitude pattern is depicted in Figure 3. The magnitude of the central voxel, \(M_{N^{\prime}}(g_{c})=\sqrt{177}\) is determined utilizing Equation (9). Concurrently, the magnitudes of the peripheral neighbors, \(M_{N^{\prime}}(g_{i})\) are ascertained. For instance, the magnitude for the first neighboring pixel is \(M_{N^{\prime}}(g_{1})=\sqrt{264}\), surpassing that of the central pixel, resulting in the initial bit of the magnitude pattern being encoded as 1. Similarly, with the magnitude of the second neighbor being \(M_{N^{\prime}}(g_{2})=\sqrt{200}\), exceeding that of the central pixel, the corresponding bit in the magnitude pattern is also assigned a value of 1. Conversely, for the third neighbor with a magnitude of \(M_{N^{\prime}}(g_{3})=\sqrt{69}\), which is below the central pixel's magnitude, the magnitude pattern is encoded as 0. The encoding for the remaining bits, based on the magnitudes of neighboring pixels, yields a final magnitude pattern of 110100000110101011101101.  
In its current form, the texture magnitude descriptor lacks rotation invariance indicating that identical texture magnitudes when rotated will be encoded differently, potentially resulting in inaccuracies during the classification stage of diagnosis. To address this limitation, an approach was undertaken to standardize all rotated variants of a texture into a singular histogram bin. This was achieved by evaluating all possible 24 orientation codes, identifying the minimal code, and subsequently mapping various shifted combinations to this designated bin, thereby aiming to enhance classification accuracy in diagnostic procedures.  
Figure 2: Illustrative example of computing the texture direction pattern.