1. Input the LungIM (the binary image containing all candidate lung partitions) |
2. Find the vertical line in the image |
Height = Height(LungIM); |
CenterX = CenterPoint(LungIM,’X’); |
VerticalLine = (CenterX, 1) to (CenterX, Height) |
3. Get a List of Candidate Partitions on the left and right side of VerticalLine |
CandidateList = GetListPartition(LungIM); |
LeftCandidateList = CandidateList ? CandidateList on left of VerticalLine : null; |
RightCandidateList = CandidateList ? CandidateList on right of VerticalLine : null; |
4. Find the largest Candidates on the left and the right |
LeftLungIM = LeftCandidateList (Index(LeftCandidateList,’largest’)) |
RightLungIM = RightCandidateList (Index(RightCandidateList,’largest’)) |
5. End |
6. Result in LeftLungIM (the left lung partition) and RightLungIM (the right lung partition) |
Appendix |
GetListPartition method |
1. Set label to each unconnected partition from 1 … number of partitions |
2. Initiate a list |
3. Step through all possible idx =1, .. number of partitions |
a. Extract the partition in index = idx |
b. Store it to the list |
4. Finish |
Index method |
1. Sort the list from the largest area to the smallest one |
2. Take the first element in the list if the input is ‘largest’ |
3. Take the last element in the list if the input is ‘smallest’ |