Erode/Dilate

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

Erode/Dilate

Alfred Wagner
Hello ImageJ Users,

Is there any way to dilate or erode a binary image in one axis/direction
only, rather than symmetrically around the objects?
The binary images I'm using are primarily shapes with 90 or 180 degree
corners, i.e. not many rounded shapes.

I've considered shifting  duplicate images along one axis and ORing with
the original image, but the run time starts to get very long when
processing large numbers of images.

Any suggestions would be much appreciated.

Thanks.

Al Wagner
IBM Watson Research Center
Reply | Threaded
Open this post in threaded view
|

Re: Erode/Dilate

vischer
Hi Alfred,
the macro below uses "Convolve" to do horizontal-only dilation/erosion:
First, a binary image is created with a square object of 3*3 pixels.
After convolving, it is 9 * 3 pixels.
Next, erosion is performed by convolving the inverse image:
the object is eroded back to the original shape of 3*3 pixels.

Norbert Vischer

newImage("A", "8-bit White", 280, 250, 1);
makeRectangle(100, 100, 3, 3);
run("Invert");
run("Make Binary");
wait(1000);
run("Convolve...", "text1=[1 1 1 1 1 1 1\n]");
wait(1000);
run("Select All");
run("Invert");
run("Convolve...", "text1=[1 1 1 1 1 1 1\n]");
run("Invert");
run("Select None");
Reply | Threaded
Open this post in threaded view
|

Re: Erode/Dilate

Michael Schmid
In reply to this post by Alfred Wagner
Hi Alfred,

for erosion or dilation in x or y direction only you can use the  
minimum or maximum of "Fast Filters"
   http://imagejdocu.tudor.lu/doku.php?
id=plugin:filter:fast_filters:start

Michael
________________________________________________________________

On 17 Feb 2011, at 18:56, Alfred Wagner wrote:

> Hello ImageJ Users,
>
> Is there any way to dilate or erode a binary image in one axis/
> direction
> only, rather than symmetrically around the objects?
> The binary images I'm using are primarily shapes with 90 or 180 degree
> corners, i.e. not many rounded shapes.
>
> I've considered shifting  duplicate images along one axis and ORing  
> with
> the original image, but the run time starts to get very long when
> processing large numbers of images.
>
> Any suggestions would be much appreciated.
>
> Thanks.
>
> Al Wagner
> IBM Watson Research Center
Reply | Threaded
Open this post in threaded view
|

Re: Erode/Dilate

Daniel James White
In reply to this post by Alfred Wagner
Hi Alfred,

On Feb 18, 2011, at 6:01 AM, IMAGEJ automatic digest system wrote:

>
> Date:    Thu, 17 Feb 2011 12:56:19 -0500
> From:    Alfred Wagner <[hidden email]>
> Subject: Erode/Dilate
>
> Hello ImageJ Users,
>
> Is there any way to dilate or erode a binary image in one axis/direction
> only, rather than symmetrically around the objects?

Yes, but you need to understand how spatial filtering works.

read the wikipedia articles on spatial filters and their kernels,
and on morphological filters.

Morphological filters can be implemented as spatial filters using a kernel of a certain shape.

try the
convolve
plugin

using this , asymmetrical "kernel"
0 1 0
0 1 0
0 1 0

ot this one
0 0 0
1 1 1
0 0 0

(tip, turn off normalize Kernel, and you can only use kernels that have odd numbers of ca;lues in x and y,
meaning there must be a central value....
values should be separated by spaces.

you will be interested to see what happens!

If you understand how this works, you can perform the magic you require... and much much more.

cheers

Dan



> [hidden email]


> The binary images I'm using are primarily shapes with 90 or 180 degree
> corners, i.e. not many rounded shapes.
>
> I've considered shifting  duplicate images along one axis and ORing with
> the original image, but the run time starts to get very long when
> processing large numbers of images.
>
> Any suggestions would be much appreciated.
>
> Thanks.
>
> Al Wagner
> IBM Watson Research Center

Dr. Daniel James White BSc. (Hons.) PhD
Senior Microscopist / Image Visualisation, Processing and Analysis
Light Microscopy and Image Processing Facilities
Max Planck Institute of Molecular Cell Biology and Genetics
Pfotenhauerstrasse 108
01307 DRESDEN
Germany

+49 (0)15114966933 (German Mobile)
+49 (0)351 210 2627 (Work phone at MPI-CBG)
+49 (0)351 210 1078 (Fax MPI-CBG LMF)

http://www.bioimagexd.net  BioImageXD
http://pacific.mpi-cbg.de                Fiji -  is just ImageJ (Batteries Included)
http://www.chalkie.org.uk                Dan's Homepages
https://ifn.mpi-cbg.de  Dresden Imaging Facility Network
dan (at) chalkie.org.uk
( white (at) mpi-cbg.de )
Reply | Threaded
Open this post in threaded view
|

Re: Erode/Dilate

Prodanov Dimiter
In reply to this post by Alfred Wagner
Hi Daniel

Try line erode in Gray  Morphology

Best regards,

Dimiter

-----Original Message-----
From: Daniel James White [mailto:[hidden email]]
Sent: Friday 18 February 2011 14:35
Subject: Re: Erode/Dilate

Hi Alfred,

On Feb 18, 2011, at 6:01 AM, IMAGEJ automatic digest system wrote:

>
> Date:    Thu, 17 Feb 2011 12:56:19 -0500
> From:    Alfred Wagner <[hidden email]>
> Subject: Erode/Dilate
>
> Hello ImageJ Users,
>
> Is there any way to dilate or erode a binary image in one axis/direction
> only, rather than symmetrically around the objects?

Yes, but you need to understand how spatial filtering works.

read the wikipedia articles on spatial filters and their kernels,
and on morphological filters.

Morphological filters can be implemented as spatial filters using a kernel of a certain shape.

try the
convolve
plugin

using this , asymmetrical "kernel"
0 1 0
0 1 0
0 1 0

ot this one
0 0 0
1 1 1
0 0 0

(tip, turn off normalize Kernel, and you can only use kernels that have odd numbers of ca;lues in x and y,
meaning there must be a central value....
values should be separated by spaces.

you will be interested to see what happens!

If you understand how this works, you can perform the magic you require... and much much more.

cheers

Dan



> [hidden email]


> The binary images I'm using are primarily shapes with 90 or 180 degree
> corners, i.e. not many rounded shapes.
>
> I've considered shifting  duplicate images along one axis and ORing with
> the original image, but the run time starts to get very long when
> processing large numbers of images.
>
> Any suggestions would be much appreciated.
>
> Thanks.
>
> Al Wagner
> IBM Watson Research Center

Dr. Daniel James White BSc. (Hons.) PhD
Senior Microscopist / Image Visualisation, Processing and Analysis
Light Microscopy and Image Processing Facilities
Max Planck Institute of Molecular Cell Biology and Genetics
Pfotenhauerstrasse 108
01307 DRESDEN
Germany

+49 (0)15114966933 (German Mobile)
+49 (0)351 210 2627 (Work phone at MPI-CBG)
+49 (0)351 210 1078 (Fax MPI-CBG LMF)

http://www.bioimagexd.net  BioImageXD
http://pacific.mpi-cbg.de                Fiji -  is just ImageJ (Batteries Included)
http://www.chalkie.org.uk                Dan's Homepages
https://ifn.mpi-cbg.de  Dresden Imaging Facility Network
dan (at) chalkie.org.uk
( white (at) mpi-cbg.de )