Watershed with Distancemap Example
Watershed with distance maps are useful for segmenting lungs, foams, and other cellular materials. I have a Kaggle Kernel that does it with ITK but it would be nice to have pure ITK demos with associated C++ and Python implementations

@kmader This is awesome.
I'd be glad to help in adding these to the existing examples. I grant that we are missing a CONTRIBUTING.md file, but you can get some inspiration from the ITK and ITKSoftwareGuide contributing processes.
Please, let me know when you experience difficulties.
@kmader @thewtex I started having a look at this.
A few comments:
- @kmader you said you also had the C++ code: could you please share it? I do not find it in kaggle.
- I assume that the
skimagelibrary used for morphological operations can be done in ITK, as well as themeshpart. - I assume that instead of showing the images, we will be writing them to disk, the showing in the
Documentation.rstfile. - I assume that we can do the analysis of the bubble features in a side file that uses
pandasormatplotlibas required so that the example does not add additional third-party dependencies. I think it's cleaner. Let me know what you think. - To avoid an excessively large vertical scroll, I'd write to files the screenshots from
pandasormatplotlibvisualizations of three image arrangements as in the original notebook, and these would be the files included in theDocumentation.rstfile.
Thanks.
After taking some time to think about this, I think an solution is to split the notebook code in three pieces:
- One taking the input image and providing the distance map, watershed and clean segmentation outputs, which will be the usual
Code.pyfile. - One taking the outputs of the segmentation and displaying and saving screenshots of the process with subplots, as in the kaggle example by Kevin.
- One taking the
. csvfile and performing the comparative analysis.
This will ideally enable separating non-ITK dependencies and providing a clean code.
Will work on it and will contribute with a version as time allows.
As I am working on this, I have a comment about the code in the kaggle notebook: although there is a section that is aimed at removing small bubbles, I'd say that these are not effectively removed, since in cell 10 the cleaned_img variable in line
cleaned_img = binary_opening(old_img, ball(3))
is local to the loop and never gets used. So I'd say that the loop is just doing a re-labelling, right? @kmader may be there is some cell missing?
Good catch, that looks like a bug!
On Sun, Nov 4, 2018, 20:44 Jon Haitz Legarreta Gorroño < [email protected] wrote:
As I am working on this, I have a comment about the code in the kaggle notebook: although there is a section that is aimed at removing small bubbles, I'd say that these are not effectively removed, since the cell 10 line
cleaned_img = binary_opening(old_img, ball(3))
cleaned_img is local to the loop and never gets used. So I'd say that the loop is just doing a re-labelling, right? @kmader https://github.com/kmader may be there is some cell missing?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/InsightSoftwareConsortium/ITKExamples/issues/48#issuecomment-435694948, or mute the thread https://github.com/notifications/unsubscribe-auth/AAHFmI1CcI9Rz1LKU58LxphC91SGB8C8ks5urzWggaJpZM4S6OEh .