[Insight-users] help needed in using neighbourhood class

cspl affable at hd2 . dot . net . in
Tue, 23 Jul 2002 14:30:22 +0530


This is a multi-part message in MIME format.

------=_NextPart_000_0079_01C23255.7A017500
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Dear Mr.Luise,
 I am working on morphological operations on Images.I used the class  =
"itk::BinaryDilateImageFilter .h".
I have created structuring element using the Neighbourhood class.
But,I got the output image as the input image with out any effect.I =
tested the application with both MRI and CT Scan Images.
I found many classes on neighbourhood.I could understand the each class =
but,what is sequence of using them in order to create required =
structuring element.
Here, I am enclosing code.

// code to dilate an image
itk::Size<2> size =3D {256, 256}; //used for setting radius
=20
    typedef itk::NeighborhoodAllocator<PixelType>   NAllocator;
    NAllocator  *nat=3Dnew NAllocator;
=20
    typedef itk::Neighborhood<PixelType,(unsigned int)2,NAllocator>  =
KernelType;
    KernelType  *NA=3Dnew KernelType;

    //To set radius

    NA->SetRadius(size);

    unsigned short cv=3DNA->GetCenterValue();=20

  =20
    typedef                 =
itk::BinaryDilateImageFilter<ImageType,ImageType,KernelType>            =
Morphology;
    Morphology::Pointer  GMF=3D Morphology::New();
 =20
=20
 GMF->SetInput(image);
=20
 GMF->SetDilateValue(25000);
 =20
 ImageType::Pointer  image1 =3D GMF->GetOutput();

 //code to write a raw file

Regards,
CSPL

------=_NextPart_000_0079_01C23255.7A017500
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 5.50.4134.600" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Dear Mr.Luise,<BR>&nbsp;I am working on =

morphological operations on Images.I used the class&nbsp;=20
"itk::BinaryDilateImageFilter .h".<BR>I have created structuring element =
using=20
the Neighbourhood class.<BR>But,I got the output image as the input =
image with=20
out any effect.I tested the application with both MRI and CT Scan =
Images.<BR>I=20
found many classes on neighbourhood.I could understand the each class =
but,what=20
is sequence of using them in order to create required structuring=20
element.<BR>Here, I am enclosing code.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>// code to dilate an =
image<BR>itk::Size&lt;2&gt;=20
size =3D {256, 256}; //used for setting =
radius<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;=20
typedef itk::NeighborhoodAllocator&lt;PixelType&gt;&nbsp;&nbsp;=20
NAllocator;<BR>&nbsp;&nbsp;&nbsp; NAllocator&nbsp; *nat=3Dnew=20
NAllocator;<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp; typedef=20
itk::Neighborhood&lt;PixelType,(unsigned int)2,NAllocator&gt;=20
&nbsp;KernelType;<BR>&nbsp;&nbsp;&nbsp; KernelType&nbsp; *NA=3Dnew=20
KernelType;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; //To set =
radius</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp;=20
NA-&gt;SetRadius(size);</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; unsigned short=20
cv=3DNA-&gt;GetCenterValue(); </FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;=20
typedef&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
itk::BinaryDilateImageFilter&lt;ImageType,ImageType,KernelType&gt;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
Morphology;<BR>&nbsp;&nbsp;&nbsp; Morphology::Pointer&nbsp; GMF=3D=20
Morphology::New();<BR>&nbsp;=20
<BR>&nbsp;<BR>&nbsp;GMF-&gt;SetInput(image);<BR>&nbsp;<BR>&nbsp;GMF-&gt;S=
etDilateValue(25000);<BR>&nbsp;=20
<BR>&nbsp;ImageType::Pointer&nbsp; image1 =3D =
GMF-&gt;GetOutput();</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;//code to write a raw =
file</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Regards,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>CSPL</FONT></DIV></BODY></HTML>

------=_NextPart_000_0079_01C23255.7A017500--