[Insight-users] characteristics

David Llanos gva02 at elai.upm.es
Thu, 22 Apr 2004 19:17:13 +0200


This is a multi-part message in MIME format.

------=_NextPart_000_0016_01C4289E.6ACADCC0
Content-Type: multipart/alternative;
	boundary="----=_NextPart_001_0017_01C4289E.6ACADCC0"


------=_NextPart_001_0017_01C4289E.6ACADCC0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

hi all,

I am looking for classes and methods to obtain characteristic of several =
objects on a binary image, being the objects separate white parts on =
black bottom. Of each object I want to obtain the radius and the gravity =
center. =20
With Ivan Macia's help I believe that I have gotten the first =
requirement for this objective that is to label this objects, by means =
of the following code (please, indicate me you if there is some error or =
if the one labeled is not correct):
-------------------------------------------------------------------------=
---------------------------------
                    .....
 xorfilter->SetInput1( grindpeak->GetOutput() );
 xorfilter->SetInput2( binaryDilate->GetOutput() );
 imgEsperBWsin->SetInput( xorfilter->GetOutput() );
 imgEsperBWsin->Update();
 std::cout << "Numero de iteraciones: " << =
grindpeak->GetNumberOfIterationsUsed() << "  .....bordes borrados" << =
std::endl;
    std::cout << "Imagen imgEsperBWsin.jpg creada... " << std::endl;

// Etiquetado de la imagen
 itkConnectedComponentFilterType::Pointer labeller =3D=20
  itkConnectedComponentFilterType::New();
 labeller->SetInput( xorfilter->GetOutput() );
 labeller->Update();

 itkRelabelComponentFilterType::Pointer relabeller =3D =
itkRelabelComponentFilterType::New();
 relabeller->SetInput( labeller->GetOutput() );
 relabeller->Update();

 // Muestra de resultados
 unsigned long nObjects =3D relabeller->GetNumberOfObjects();
 const std::vector<unsigned long> sizeOfObjects =3D =
relabeller->GetSizeOfObjectsInPixels();
 std::cout << "Number of objects : " << nObjects << std::endl;
 std::vector<unsigned long>::const_iterator it;
 int i; =20
 for(i =3D 0, it =3D  sizeOfObjects.begin(); it !=3D =
sizeOfObjects.end(); ++i, ++it) {=20
  std::cout << "Size of object " << i+1 << ": " << (*it) << " pixels" << =
std::endl;
 }
-------------------------------------------------------------------------=
-------------------------------------

I now need to obtain the radius and the gravity center (two coordinates) =
of each object, but the classes itkRelabelComponentImageFilter and =
itkConnectedComponentImageFilter they don't have the methods for it, I =
eat for example -> GetRadius (). =20
Do I have that instantiate "labeller" or "relabeller" with another =
class? which advise me you that it uses?

I attach an example image so that you see to that refer

Thanks in advange and regards,

David



  
------=_NextPart_001_0017_01C4289E.6ACADCC0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>hi all,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I am looking for classes and methods to =
obtain=20
characteristic of several objects on a binary image, being the objects =
separate=20
white parts on black bottom. Of each object I want to obtain the radius =
and the=20
gravity center.&nbsp; <BR>With Ivan Macia's help I believe that I have =
gotten=20
the first requirement for this objective that is to label this objects, =
by means=20
of the following code (please, indicate me you if there is some error or =
if the=20
one labeled is not correct):</FONT></DIV>
<DIV><FONT face=3DArial=20
size=3D2>----------------------------------------------------------------=
------------------------------------------</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
.....</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;xorfilter-&gt;SetInput1(=20
grindpeak-&gt;GetOutput() );<BR>&nbsp;xorfilter-&gt;SetInput2(=20
binaryDilate-&gt;GetOutput() );<BR>&nbsp;imgEsperBWsin-&gt;SetInput(=20
xorfilter-&gt;GetOutput() =
);<BR>&nbsp;imgEsperBWsin-&gt;Update();</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;std::cout &lt;&lt; "Numero de =
iteraciones: "=20
&lt;&lt; grindpeak-&gt;GetNumberOfIterationsUsed() &lt;&lt; "&nbsp; =
.....bordes=20
borrados" &lt;&lt; std::endl;<BR>&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; =
"Imagen=20
imgEsperBWsin.jpg creada... " &lt;&lt; std::endl;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>//&nbsp;Etiquetado de la=20
imagen<BR>&nbsp;itkConnectedComponentFilterType::Pointer labeller =3D=20
<BR>&nbsp;&nbsp;itkConnectedComponentFilterType::New();<BR>&nbsp;labeller=
-&gt;SetInput(=20
xorfilter-&gt;GetOutput()=20
);<BR>&nbsp;labeller-&gt;Update();<BR><BR>&nbsp;itkRelabelComponentFilter=
Type::Pointer=20
relabeller =3D=20
itkRelabelComponentFilterType::New();<BR>&nbsp;relabeller-&gt;SetInput(=20
labeller-&gt;GetOutput() =
);<BR>&nbsp;relabeller-&gt;Update();</FONT></DIV>
<DIV><FONT face=3DArial size=3D2><BR>&nbsp;// Muestra de=20
resultados<BR>&nbsp;unsigned long nObjects =3D=20
relabeller-&gt;GetNumberOfObjects();<BR>&nbsp;const =
std::vector&lt;unsigned=20
long&gt; sizeOfObjects =3D =
relabeller-&gt;GetSizeOfObjectsInPixels();</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;std::cout &lt;&lt; "Number of =
objects : "=20
&lt;&lt; nObjects &lt;&lt; std::endl;<BR>&nbsp;std::vector&lt;unsigned=20
long&gt;::const_iterator it;<BR>&nbsp;int i;&nbsp;&nbsp;<BR>&nbsp;for(i =
=3D 0, it=20
=3D&nbsp; sizeOfObjects.begin(); it !=3D sizeOfObjects.end(); ++i,=20
++it)&nbsp;{&nbsp;<BR>&nbsp;&nbsp;std::cout &lt;&lt; "Size of object " =
&lt;&lt;=20
i+1 &lt;&lt; ": " &lt;&lt; (*it) &lt;&lt; " pixels" &lt;&lt;=20
std::endl;<BR>&nbsp;}</FONT></DIV>
<DIV><FONT face=3DArial=20
size=3D2>----------------------------------------------------------------=
----------------------------------------------</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I now need to obtain the radius and the =
gravity=20
center (two coordinates) of each object, but the classes=20
itkRelabelComponentImageFilter and itkConnectedComponentImageFilter they =
don't=20
have the methods for it, I eat for example -&gt; GetRadius ().&nbsp; =
<BR>Do I=20
have that instantiate "labeller" or "relabeller" with another class? =
which=20
advise me you that it uses?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I attach an example image so that you =
see to that=20
refer</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks in advange and =
regards,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>David</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;</DIV>
<DIV><BR>&nbsp;&nbsp;</FONT></DIV></BODY></HTML>

------=_NextPart_001_0017_01C4289E.6ACADCC0--

------=_NextPart_000_0016_01C4289E.6ACADCC0
Content-Type: image/png;
	name="binar.png"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
	filename="binar.png"

iVBORw0KGgoAAAANSUhEUgAAAecAAAFsCAAAAADTES6TAAAACXBIWXMAAC4jAAAuIwF4pT92AAAE
bUlEQVR4nO3dy1ZVMRBFUf7/p7EhooLIeSSVnVNzdmyyU0s6cMfg5QUAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAADo6vWD1XuY42NnpR/pc2axH+Utp86P9lVenZ/k28o6P8GBzELv71Bmnbd3rLPU
uzvcWemd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