| 1. Input the Matrix SliceIM (One lung slice image in each phase) |
| 2. Find the Dark and Light Area in an image |
| LightArea = find(image, ‘light’); |
| DarkArea = find(image, ‘dark’); |
| 3. Fill the DarkArea within a LightArea |
| SliceIM = floodfill(SliceIM, LightArea, DarkArea); |
| 4. Quantitate SliceIM into three indexed images using the Minimum Variance Quantization |
| IndexIM = Quantization(SliceIM, 3) |
| 5. Select the index partition in which it is the largest area |
| MaxPartitionIM = MaxArea(IndexIM) |
| 6. Fill the holes in MaxPartionIM to get the whole lung partition without artifacts |
| OutputIM = FillHoles(MaxPartitionIM) |
| 7. End |
| 8. Result in the Matrix OutputIM (The lung slice image without artifacts, have only lung and body area) |
| Appendix |
| FillHoles method |
| 1. Find the Dark and Light Area in an image |
| LightArea = find(image, ‘light’); |
| DarkArea = find(image, ‘dark’); |
| 2. Fill the DarkArea within a LightArea by floodfill |
| image = floodfill(image, LightArea, DarkArea); |