Morphological labeling operations

Hi Guys,

I have some images with a lot of noize, therefore I use Erode 30 times, to get rid of the small noize segments. To maintain the area of my other segments I use Dilate 30 times as well later on on the labels. However this results in some labels becoming overlapping. Is there a way to prevent this? I already tried setting Dilate to less then 30, but I am unsure how much this affects the area measurements of my objects.



Hi Luuklag,

As a first idea, you can try filtering out small segments with the Labeling Filter Node it has the option to filter by size, so you might not need to use the Morphological Labeling Operations at all.

If you can upload an example picture + your workflow we should be able to help you further.

Hi gab1one,

Thanks for the tip. I tried moving my Labeling Filter further upstream, and that indeed helps a lot in getting rid of unwanted parts. However I still can't do without Erode/Dilate, as some things are pixel wise to big to filter out without removing wanted parts. As the unwanted parts are rather loose, compared to the solid objects I want, Erode/Dilate gets rid of them easy.

As for overlapping labels, I found out a very easy way to prevent this. There is a setting in the Morphological Labeling Operations, Strategy. It was set to Individual Labeling, but when it is changed to Binary, it does not take into account the different labels, but only if its labeled or not. This results in the program being unable to let labels overlap. Or as the Node Description says: " Erode/Dilate each pixel with none/any labeling in the neighborhood. In short: we don't distinguish between the individual labels and treat any labeled pixel as positive."

Here another suggestion (advanced):

* Mark some of your image parts as positive/negative using the `Interactive Labeling Editor`.

* Calculate features (geometric features like size, roundness or also intensity based features if it helps)  for each labeled segment.

* Train a Model (e.g. Random Forest, Decision Tree, SVM or whatever you prefer) which can distiguish between positive and negative segments.

* Apply the model on unseen data and reassemble the classified data using the Group By.

Sometimes, this works really, really well and you don't have to set all those magic thresholds (you rather train a model).



Wel that certainly sounds like a good solution, however I'm afraid that is a bit too advanced for me.

Christian I tried your suggestion but I couldn't get it running. Maybe you could have a look or is there allready an example on the server?



Hi Flo

I took your workflow and edited it so that it does what you want. Give it a try!

The problem in your workflow was that the interactive labeling editor gives back one big label (not single nuclei).


Thanks a lot oole. Works great !