[Insight-users] Clear image borders
Miller, James V (Research)
millerjv at crd.ge.com
Mon, 29 Mar 2004 15:06:43 -0500
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C415C9.5B2839B6
Content-Type: text/plain;
charset="iso-8859-1"
David,
There are some geodesic morphology techniques that will eliminate the
foreground objects that touch the borders of the image. The book
Pierre Soille. "Morphological Image Analysis: Principles and Applications",
Second Edition, Springer, 2003.
describes a number of geodesic morphology algorithms. ITK has several of
these algorithms:
GrayscaleGeodesicErodeImageFilter
GrayscaleGeodesicDilateImageFilter
GrayscaleFillholeImageFilter
GrayscaleConnectedOpeningImageFilter
GrayscaleConnectedClosingImageFilter
The Fillhole algorithm removes all local minima that are not connected to
the boundary. In your case, you could flip the intensities of your
processed image (so the sperm are black on white). Running the
GrayscaleGeodesicFillholeImageFilter will remove any of the sperm that are
not connected to the boundary. So this will be a mask of the objects that
are connected to the boundary. If you xor the input to the
GrayscaleGeodesicFillholeImageFilter with its output, you should be left
with the objects that do not touch the border.
Jim
-----Original Message-----
From: David Llanos [mailto:gva02 at elai.upm.es]
Sent: Monday, March 29, 2004 10:58 AM
To: insight-users at itk.org; Luis Ibanez (ITK); Julien
Subject: [Insight-users] Clear image borders
Hi all,
I am working in a project where I carry out processing of sperm. For they
give me to it pictures and I have to return characteristic as density, radio
of the halo, radio of the core, etc.. The problem this in that in the
pictures some sperms come cut, and these they should be eliminated.
I wonder if in ITK some class exists with the one that can eliminate parts
of an image, in short those that are cut by the border of the image.
To clarify my problem I attach you three images:
1. - original.jpg The original image
2. - process.jpg The processing image
3. - clearborder.jpg The image without cut sperms
Thanks in advange and regards.
David.
----------------------------------------------------------------------------
--------------------------------------------------------------------------
NOTA: in MATLAB the procedure that makes this function is "imgclearborder",
I attach you the example:
imgEspermasRGB = imread ( NomFichImg );
hist = imhist(imgEspermasRGB(:,:,2)); %Componente del verde
umbralEspermas =
BIN_EntropiaKSW(hist,size(imgEspermasRGB,1)*size(imgEspermasRGB,2));
seEspermas = strel('disk',20);
imgEsperBW = imclearborder(...
imopen((imgEspermasRGB(:,:,2)<umbralEspermas),seEspermas));
----------------------------------------------------------------------------
--------------------------------------------------------------------------
PD: if it interests you to some I send you the function BIN_EntropiaKSW,
necessary to run the application, in MATLAB or in C
------_=_NextPart_001_01C415C9.5B2839B6
Content-Type: text/html;
charset="iso-8859-1"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1276" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><SPAN class=064065319-29032004><FONT color=#0000ff size=2>David,
</FONT></SPAN></DIV>
<DIV><SPAN class=064065319-29032004><FONT color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=064065319-29032004><FONT color=#0000ff size=2>There are some
geodesic morphology techniques that will eliminate the foreground objects that
touch the borders of the image. The book</FONT></SPAN></DIV>
<DIV><SPAN class=064065319-29032004><FONT color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=064065319-29032004><FONT color=#0000ff size=2>Pierre Soille.
"Morphological Image Analysis: Principles and Applications", Second
Edition, Springer, 2003.</FONT></SPAN></DIV>
<DIV><SPAN class=064065319-29032004><FONT color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=064065319-29032004><FONT color=#0000ff size=2>describes a
number of geodesic morphology algorithms. ITK has several of these
algorithms:</FONT></SPAN></DIV>
<DIV><SPAN class=064065319-29032004><FONT color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=064065319-29032004><FONT color=#0000ff
size=2>GrayscaleGeodesicErodeImageFilter</FONT></SPAN></DIV>
<DIV><SPAN class=064065319-29032004><FONT color=#0000ff
size=2>GrayscaleGeodesicDilateImageFilter</FONT></SPAN></DIV>
<DIV><SPAN class=064065319-29032004><FONT color=#0000ff
size=2>GrayscaleFillholeImageFilter</FONT></SPAN></DIV>
<DIV><SPAN class=064065319-29032004><FONT color=#0000ff
size=2>GrayscaleConnectedOpeningImageFilter</FONT></SPAN></DIV>
<DIV><SPAN class=064065319-29032004><FONT color=#0000ff
size=2>GrayscaleConnectedClosingImageFilter</FONT></SPAN></DIV>
<DIV><SPAN class=064065319-29032004><FONT color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=064065319-29032004><FONT color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=064065319-29032004><FONT color=#0000ff size=2>The Fillhole
algorithm removes all local minima that are not connected to the boundary.
In your case, you could flip the intensities of your processed image (so the
sperm are black on white). Running the
GrayscaleGeodesicFillholeImageFilter will remove any of the sperm that are not
connected to the boundary. So this will be a mask of the objects that are
connected to the boundary. If you xor the input to the
GrayscaleGeodesicFillholeImageFilter with its output, you should be left with
the objects that do not touch the border.</FONT></SPAN></DIV>
<DIV><SPAN class=064065319-29032004><FONT color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=064065319-29032004><FONT color=#0000ff
size=2>Jim</FONT></SPAN></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
size=2>-----Original Message-----<BR><B>From:</B> David Llanos
[mailto:gva02 at elai.upm.es]<BR><B>Sent:</B> Monday, March 29, 2004 10:58
AM<BR><B>To:</B> insight-users at itk.org; Luis Ibanez (ITK);
Julien<BR><B>Subject:</B> [Insight-users] Clear image
borders<BR><BR></FONT></DIV>
<DIV><BR> </DIV>
<DIV><FONT face=Arial size=2>Hi all,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I am working in a project where I carry out
processing of sperm. For they give me to it pictures and I have to return
characteristic as density, radio of the halo, radio of the core, etc.. The
problem this in that in the pictures some sperms come cut, and these they
should be eliminated. <BR> <BR>I wonder if in ITK some class
exists with the one that can eliminate parts of an image, in short those that
are cut by the border of the image. <BR> <BR>To clarify my problem
I attach you three images:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>1. - original.jpg
The original image <BR>2. -
process.jpg The processing
image <BR>3. -
clearborder.jpg The image without cut
sperms </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Thanks in advange and regards.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>David.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial
size=2>------------------------------------------------------------------------------------------------------------------------------------------------------</FONT></DIV>
<DIV><FONT face=Arial size=2>NOTA: in MATLAB the procedure that makes this
function is "imgclearborder", I attach you the example:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>imgEspermasRGB = imread ( NomFichImg
);</FONT><FONT face=Arial size=2><BR>hist = imhist(imgEspermasRGB(:,:,2));
%Componente del verde<BR>umbralEspermas =
BIN_EntropiaKSW(hist,size(imgEspermasRGB,1)*size(imgEspermasRGB,2));
</FONT></DIV>
<DIV><FONT face=Arial size=2>seEspermas = strel('disk',20);</DIV>
<DIV>imgEsperBW =
imclearborder(...<BR>
imopen((imgEspermasRGB(:,:,2)<umbralEspermas),seEspermas));</DIV>
<DIV>------------------------------------------------------------------------------------------------------------------------------------------------------</DIV>
<DIV> </DIV>
<DIV>PD: if it interests you to some I send you the function BIN_EntropiaKSW,
necessary to run the application, in MATLAB or in
C</FONT></DIV></BLOCKQUOTE></BODY></HTML>
------_=_NextPart_001_01C415C9.5B2839B6--