Erosion and Dilation in imageJ

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Erosion and Dilation in imageJ

Geology Guy
Good Afternoon Everyone
I am trying to do an erosion and dilation process in imageJ but it is not giving me the expected result. I have a  threshold/binary image and all I want to do is to remove the white pixels that are isolated in the background and also remove the black pixels in the white foreground without reducing or shrinking the size of the white particles. I even click "Pad edges" before the process but that isn't preventing the grains from being eroded. Right now I am reading about this thing called a Structural element and how it can also help when doing erosion and dilation. I currently have the Image J 1.46r and I don't think it has this 'structural element" function. Can someone please advice me on what to do? Thanks a lot.


GeologyGuy
Reply | Threaded
Open this post in threaded view
|

Re: Erosion and Dilation in imageJ

Michael Schmid
Hi Geology Guy,

for removing isolated foreground pixels, you can do 'Erode' with the
Binary Options set to 1 iteration and Count=8. If you set Count=7, also
two-pixel particles are removed. For removing small holes, use 'Dilate'
with the same options.

For a larger size threshold, you can use 'Analyze Particles'; set a size
range and 'show masks', keeping interior holes.

The "structuring element", sometimes also named 'kernel', is the
neighborhood used for an image processing operation. The binary erode,
dilate, etc. operations use a 3x3 area; most filters under Process>Filters
(median, mean, minimum, maximum) use a circular area (see
Process>Filters>Show Circular Masks. The 'Fast Filters' plugin uses
rectangular structuring elements.

Michael
____________________________________________________________________


On Thu, June 27, 2013 20:38, Geology Guy wrote:

> Good Afternoon Everyone
> I am trying to do an erosion and dilation process in imageJ but it is not
> giving me the expected result. I have a  threshold/binary image and all I
> want to do is to remove the white pixels that are isolated in the
> background
> and also remove the black pixels in the white foreground without reducing
> or
> shrinking the size of the white particles. I even click "Pad edges" before
> the process but that isn't preventing the grains from being eroded. Right
> now I am reading about this thing called a Structural element and how it
> can
> also help when doing erosion and dilation. I currently have the Image J
> 1.46r and I don't think it has this 'structural element" function. Can
> someone please advice me on what to do? Thanks a lot.
>
>
> GeologyGuy
>
>
>
> --
> View this message in context:
> http://imagej.1557.x6.nabble.com/Erosion-and-Dilation-in-imageJ-tp5003683.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Erosion and Dilation in imageJ

Geology Guy
Michael thank you very much for your reply. I have tried it but it's not working as I would like to. When I carry out the "Erode" step, it is shrinking the particles even though "Pad edges" box is already checked. I am a new user and have read through the manual. I know what measurements I want to obtain and the only challenge now is figuring exactly this Eroding and dilation combination to do what I want. I tried Open and Close and neither seems to work to do what I want which is just to remove isolated foreground pixels and simply fill in the black background pixels within the white foreground pixels.

My thesis is due in 4 weeks time and I am not feeling too confident with my progress so far with the software.
Reply | Threaded
Open this post in threaded view
|

Re: Erosion and Dilation in imageJ

Gabriel Landini
On Thursday 27 Jun 2013 23:38:12 Geology Guy  wrote:
> Michael thank you very much for your reply. I have tried it but it's not
> working as I would like to. When I carry out the "Erode" step, it is
> shrinking the particles even though "Pad edges" box is already checked. I am
> a new user and have read through the manual. I know what measurements I
> want to obtain and the only challenge now is figuring exactly this Eroding
> and dilation combination to do what I want. I tried Open and Close and
> neither seems to work to do what I want which is just to remove isolated
> foreground pixels and simply fill in the black background pixels within the
> white foreground pixels.

Erosion always shrinks objects objects in the image (well that sometimes
depends if they touch the border and the padding setting).
So to remove small free particles you can erode and the dilate to bring the
shrunk ones back to a similar size. This is called "opening". Mind you the
boundary of the remaining particles gets smoothed for details of "kernel"
sizes.

You might want to try "opening by reconstruction" which does not affect the
size of the remaining particles.
There is a plugin in my page called "BinaryFilterReconstruct" which does
exactly that: removes particles that would disappear after n erosions, without
modifiying the rest.

You could also invert the image and do the same to get rid of the holes of
similar sizes.
http://www.dentistry.bham.ac.uk/landinig/software/software.html
Download the morphology collection zip, it is in there.

Regards
Gabriel

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Erosion and Dilation in imageJ

Geology Guy

>Erosion always shrinks objects objects in the image (well that sometimes
>depends if they touch the border and the padding setting).
>So to remove small free particles you can erode and the dilate to bring the
>shrunk ones back to a similar size. This is called "opening". Mind you the
>boundary of the remaining particles gets smoothed for details of "kernel"
>sizes.

>You might want to try "opening by reconstruction" which does not affect the
>size of the remaining particles.
>There is a plugin in my page called "BinaryFilterReconstruct" which does
>exactly that: removes particles that would disappear after n erosions, without
>modifiying the rest.

Thank you very much Gabriel. I will download the plugin and give it a try. Thanks and I appreciate your advice.