NEUBIAS / training-resources

Resources for teaching/preparing to teach bioimage analysis
https://neubias.github.io/training-resources
Other
48 stars 21 forks source link

Create Morphological Filter module #255

Closed tischi closed 2 years ago

tischi commented 2 years ago

Merge filter_rank.md into filter_morphologial.md.

Content (distribute across activities and exercises): min/erode, max/dilate, opening, closing, top-hat, inner-edge, outer-edge

manerotoni commented 2 years ago

See also #61

manerotoni commented 2 years ago

Draft branch is #278

manerotoni commented 2 years ago

Hi @tischi, I would separate morphological filtering applied to binary and gray scale values. For the moment only work on morphological filtering for binary images.

What do you think?

Antonio

manerotoni commented 2 years ago

Hi @tischi, a fill operation is it a morphological filter? I do not know exactly and I think it depends on the algorithm. You can compute the connected component of the background and omit the components that touch the border (MATLAB imfill). https://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.binary_fill_holes.html does it differently and use a dilation operation.

tischi commented 2 years ago

is a "fill operation" a "morphological filter"?

I don't know... @dlegland, what would you say?

dlegland commented 2 years ago

Hi all, I would say: yes, fill holes belongs to morphological operators. To me, it belongs to the class of "reconstruction-based" operators.

By the way, both Matlab and scipy implementation rely on the same idea; the morphological reconstruction can be obtained by iterating dilations, and constraining each dilation to a mask (here the background).

manerotoni commented 2 years ago

Great thank you.

manerotoni commented 2 years ago

One could also do fill holes by performing a CCA on the background pixels and then remove objects that touch the boundary. All objects found are associated to fg and added to the original image.

dlegland commented 2 years ago

Yes, this should work.

Actually, the principle for fill holes is to use reconstruction on the BG pixels/voxels, by using as marker the BG pixels/voxels on the border of the image. The nice point of this approch is that one only needs to keep initial and result image. Using CCA on BG rely on the same idea, but this requires creating an intermediate label image, that can be memory-costly.

manerotoni commented 2 years ago

First nearly finished draft of module is now ready to merge. Thanks again @dlegland for the very useful comments. It start to make sense in my mind.