Hi Michael,
Thank you for your detailed analysis. I am surprised this artefact was not reported earlier.

I agree with you that original isolated pixels that remain after a closing should stay there. The ones to remove are those which appear after the closing operation. That is why I was thinking of using binary reconstruction using the closed-image as the mask and the original image as the seed. That way the pixels that are not connected to original regions are guaranteed to be the artefact of the kernel quantization and won't be reconstructed. Using the same example this is what I had in mind:

selectImage("1.tif");
run("Duplicate...", "title=original");
selectImage("1.tif");
run("Maximum...", "radius=6");
run("Minimum...", "radius=6");
run("BinaryReconstruct ", "mask=1.tif seed=original create white");
selectImage("Reconstructed");

I have the suspicion that octagonal kernels might not suffer from these artefacts but I have not tested it.

We can generate octagonal kernel dilation (and erosion) by doing a maximum filter of radius=0.5 followed by another maximum filter of radius=1, and repeating for larger sizes.

Best wishes

Gabriel




On 13/03/2024 19:59, Michael Schmid wrote:
Hi Gabriel,

without having a definitive proof, I think that the unexpected pixel is
a result of pixel quantization, and this would not happen with a
circular structuring element in a "continuous world".

The attached image shows the Euclidian Distance map of the dilated input
image (cyan outline) and the pixel in question (small orange square).
The orange circle shows that this pixel is nicely placed in the center
of the constriction. The ridge of the EDM is under an angle, so the
pixels above and below the pixel in question are not at the ridge but at
the side, and their distance to the cyan boundary is less. Hence, these
neighboring pixels do not survive the erosion with a circular
structuring element.

Probably there is some theory behind it, which I am not aware of...

Eliminating all isolated pixels at the output of the maximum+minimum
filter may be desired in your case or not: If you have a single
foreground pixel inside a large background area, in principle, a
morphological close operation should keep that pixel.
You could eliminate isolated pixels only if they were not present in the
input image.

Alternatively, you could have a look at the "Ultimate Points" after
"Maximum" (on a copy of the image). "Ultimate Points" is based on the
maxima of the EDM, but it takes into account that ridges are not
necessarily in the centers of pixels. The problematic pixel of your
example image does not qualify as an ultimate point of the dilated image
(after the "maximum"). However, I cannot guarantee that all bona fide
blobs remaining after the maximum+minimum filter would contain an
ultimate point - one would have to check this.


Best,

Michael
________________________________________________________________


On 13.03.24 16:26, Gabriel Landini wrote:
Hi,
I encountered an unexpected result and I am unsure what is the source of
the problem.

See the attached image 1.tif, after applying a morphological closing
with a disc of radius=6:

run("Maximum...", "radius=6");
run("Minimum...", "radius=6");

I get a single pixel appearing between the two regions (see 2.tif). I
was expecting that the closing results in either a connection or non
connection of the two regions, but I am puzzled by that disconnected pixel.

The closing can also be done via:
run("Top Hat...", "radius=6 light don't");
and the result is the same.

I can get rid of that pixel via morphological reconstruction, but it
seems a bit of a hack, when I do not understand why it happens.
This seems to happen only in certain configurations.

I wonder if this is due to the rounding when defining the disc kernels?

Many thanks for any insights.
Regards,

Gabriel



--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

Reply via email to