# Forward Computational Modeling of Respiratory Airflow
## 3 Image-Based Structural and Spatial Geometric Models
### Lung Segmentation  
To utilize medical images in generating 3D geometric models that are useful for CFD simulation, whole lung and airway tree segmentations from the chest wall and mediastum must first be performed. The goal of lung segmentation is to separate voxels corresponding to the lung from those of other anatomic structures [33]. Such image segmentation can be achieved manually or automatically and serves as an antecedent for quantitative image analysis or computational modeling. The steep intensity gradient (i.e., low-intensity value of the lung and high-intensity surrounding chest wall) makes it relatively simple to segment lung tissues for a healthy subject, using automated thresholding techniques [40]. However, the situation becomes far more complicated for an injured or inflamed lung, in which high-intensity voxel values of consolidated and dereceruited lung tissue are almost indistinguishable from the surrounding chest wall and mediastinal contents. Automated segmentation is generally preferred over manual segmentation, since the latter is tedious, time-consuming, and impractical for dynamic imaging. Moreover, manual segmentations may include significant interobserver variability, especially when analyzing large datasets [33; 41].  
[PERSON] et al. [33] developed an algorithm for automated whole-lung segmentation for healthy subjects based on three main steps. First, optimal gray-level thresholding is applied to the image scan, then the anterior and posterior junctions of the lungs are identified to distinguish the left and right lung, and finally, the boundary of the lung is smoothed. The optimal gray-level threshold segments the 3D image into body and non-body voxels by an iterative method. An initial threshold value \(T_{0}\) is assigned for segmentation, and the next threshold value \(T_{i}\) is calculated by taking the average of the mean intensities in the body (\(I_{b}\)) and non-body (\(I_{n}\)) voxels. The process continues until the threshold value,  
\[T_{i}=T_{i-1} \tag{9}\]  
where  
\[T_{i}=\frac{(I_{b,i}+I_{n,i})}{2} \tag{10}\]  
Using this method, low-intensity voxels within the lungs or other structures (i.e., bowel gas) can be successfully segmented. The lung is identified using connectivity and topologic analyses, that retain only volumes greater than a predetermined minimum volume. This optimal threshold is unique to the specific dataset, from which the whole lung can be segmented. This is important since it considers the existence of intersubject variability in tissue intensities. The left and right lungs are separated using a dynamic programming technique that locates the anterior and posterior junction lines for each transverse slice and the boundary for each lung is smoothed [33; 42].  
[PERSON] et al. [41] developed a convolutional neural network (CNN) for whole lung segmentation in various mammalian species with both healthy and diseased conditions. Their technique was based on deep learning, allowing the CNN to extract certain features from spatially correlated data and to make predictions of anatomic boundaries. For whole lung segmentation, the network was trained with manually segmented image datasets from humans, which was then extended to porcine, canine, and ovine subjects using transfer learning. The manually segmented image datasets (i.e., ground truth) were generated by first using gray-level thresholding, then corrected by expert image analysts.