Closed eelvira closed 6 years ago
Good stuff! Would it be possible to provide a test for processing a LIDC scan and one for processing a LUNA scan? This would also make it easier to understand how to use the provided methods while an explanation in a pull request is harder to find than a test in the code base IMO :)
@WGierke , thank you for your comment! I will try to provide all the necessary tests this weekend after some changes in the code base
Nice work! Along with @WGierke suggestions, would you mind providing a test case that shows the segmentation error before this PR and how it's fixed after? Thanks!
@reubano , thank you for your comment and remarks! I will provide everything as soon as possible :)
No prob. One last comment: for the numbers in your functions, could you make them upper case constants placed at the top of the file? That will make it easier to figure out what they mean and where the values came from. And then you could also allow users to override those values in specific functions. Like so:
MIN_LUNG_HU = -1010
def grow_lungs(patient, seeds, min_lung_hu=MIN_LUNG_HU):
...
lungs_seeds = region_growing(patient.copy(), lungs_seeds, min_lung_hu, threshold)
...
I'd love to get this merged over the next few days — do we have a list of blockers/next steps? I see a whole bunch of reviewed comments, etc. that have been addressed but to get a synopsis here would be superb and I'm sure would lead to this landing sooner than before.
Initially the separation of the lungs was implemented the method, which chose the search area on a two-dimensional slice. Two-dimensional morphological erosion with a diamond-shaped nucleus was used for separation and successively was extended to other slices. It wasn't work perfect for some cases.
In order to avoid such situations, it was decided to apply the method was described in this preprint by @vessemer. The main idea of the algorithm is to select reference binary image of the lungs in a one slice which further will be propagated over all adjacent slices, that have not yet been visited, by comparison of its complements. This process will be repeated, taking adjacent slices from previous step, as new reference images until lungs are not separated.
@reubano, @lamby, all rebased and squashed, can you take a look, please?
LGTM! @reubano ?
Description
The threshold method consists of 4 steps: 1) extraction of large airways; 2) segmentation of lung regions; 3) separation of the left and right lungs; 4) smoothing.
Reference to official issue
I have solved issue #138, there it was proposed to improve lung segmentation.
Motivation and Context
The algorithm includes errors in lung segmentation, which often occur at the borders of the lungs, when the contrast between the lung parenchyma and the surrounding tissue is low due to pathologic abnormalities that show up as dense regions. In normal lung anatomy, the shape of the costal lung surface is convex. When an error occurs at the costal border, the surface is typically not convex anymore.
This problem was fixed with method, which was described in issue #138. Also bronchi and trachea were indicated and segmented in this method.
How Has This Been Tested?
I've tested the algorithm over the cases with nodules and compare output with basic segmentation algorithm.
Screenshots :
You can see that the algorithm includes pathologies, whereas the ventricle isn't included in lungs area:
Segmented lungs and trachea (bronchi) in frontal projection:
CLA