Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Label Morphological Filter: Erosion Operation for touching labels #76

Closed
maulakhan opened this issue May 25, 2023 · 7 comments
Closed

Comments

@maulakhan
Copy link

maulakhan commented May 25, 2023

Dear all,

I am trying to erode a label mask in such a way that I have non-touching labels using MorpholibJ Label Morphological Filter options.
I get the following result:
image
Left: original label mask, Right: label mask after erosion with radius = 9

I used radius = 9 but was not able to separate them. Can you please help to get the non-touching labels, maybe I am doing something wrong or is it supposed to work that way?

Attaching one example
C2-Composite

Thanks a lot!

@tischi
Copy link

tischi commented Jun 5, 2023

ping @dlegland @iarganda

@dlegland
Copy link
Contributor

dlegland commented Jun 5, 2023

Hi,

Well, for the moment this is the expected kind of result, so nothing wrong a priori.

The aim to this plugin was to generalize erosion and dilation to label maps. Of course, one has to decide what to do when several labels are found in the neighborhood of current pixel! For erosion, I have made the decision to apply erosion only if a background pixel or voxel (label 0) is found in the neighborhood. Therefore, a the boundary of two regions, no erosion occur as there is no background.

I was thinking about this, and it could be possible to add an additionnal option, to erode if a different label (either 0 or another one) is present in the neighborhood. This would have some side effects on other kind of images, but if the option can be chosen by the user, this should be fine. I will try to add it in a future release. Stay tuned...

@tischi
Copy link

tischi commented Jun 5, 2023

I was thinking about this, and it could be possible to add an additionnal option, to erode if a different label (either 0 or another one) is present in the neighborhood.

this is what I would have expected it to do....essentially erode each label as if it was a lonely binary mask.

it would be great if that could be added.

I would make it the default behaviour, as I don't know a use-case right now for the current implementation, do you have a use-case?

@iarganda
Copy link
Contributor

iarganda commented Jun 5, 2023

Hey guys! What about imposing label (zero) boundaries and then eroding?

@dlegland
Copy link
Contributor

dlegland commented Jun 5, 2023

I would make it the default behaviour, as I don't know a use-case right now for the current implementation, do you have a use-case?

Actually, in case of "dense" label maps (like a watershed result without dams), applying erosion would create new background pixels within groups of regions. The apparition of background may be questionable... But If the option to use background instead of other label is more natural, maybe I can change default option.

Hey guys! What about imposing label (zero) boundaries and then eroding?

This is a solution as well! But then it is necessary to iterate over labels, create new image for each label, and then concatenating the results.

@dlegland
Copy link
Contributor

dlegland commented Jun 5, 2023

Hi,

I have updated the plugin, and drafted a new release (https://github.com/ijpb/MorphoLibJ/releases/tag/v1.6.0-LabelMapFiltering)

You can play with the new jar, and tell me if this is better now!

@dlegland
Copy link
Contributor

fixed in release 1.6.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants