[Insight-users] help needed please!
Miller, James V (Research)
millerjv@crd.ge.com
Wed, 18 Dec 2002 10:57:59 -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_01C2A6AE.3CEBF9CE
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Lydia,=20
=20
You can use the ImportImageFilter to set up the "imported" for ITK. =
This is easier than creating the
ITK image and ImportImageContainer.
=20
itk::ImportImageFilter<unsigned char, 2>::Pointer import =3D =
itk::ImportImageFilter<unsigned char,
2>::New();
import->SetImportPointer(label_image2, size[0]*size[1], false);
import->SetRegion( region );
import->SetSpacing( spacing );
import->SetOrigin( origin );
typedef itk::ConnectedThresholdImageFilter<ImageType,ImageType> =
FilterType;=20
FilterType::Pointer filter =3D FilterType::New();
filter->SetInput( import->GetOutput() ); // SET THE INPUT TO =
THE FILTER TO THE OUTPUT OF
THE IMPORT=20
FilterType::IndexType seed; seed[0] =3D 165; seed[1] =3D 90;
filter->SetSeed(seed);
filter->SetLower(0);
filter->SetUpper(255);
filter->SetReplaceValue(255);
filter-> Update();
=20
-----Original Message-----
From: lydia coin [mailto:lydia_coin3d@yahoo.fr]
Sent: Wednesday, December 18, 2002 10:08 AM
To: insight-users@public.kitware.com
Subject: [Insight-users] help needed please!
Could anyone tell what's wrong with these lines. I'm stagnating since =
yesterday and no solution is
suggested to my problem. Please it is urgent=20
/*** this is for importing pixel values from an unsigned char type =
pointer **/=20
itk::ImportImageContainer<long unsigned int, unsigned char>::Pointer =
import;
import =3D itk::ImportImageContainer<long unsigned int, unsigned =
char>::New();
import->Initialize();
import->Reserve(size[0]*size[1]);
import->SetImportPointer(labeled_image2,size[0]*size[1],false);
/****setting the pixel values in the itkimage****/ =20
typedef itk::Image<unsigned char, 2> ImageType;
ImageType:: Pointer img =3D ImageType::New();=20
double values[]=3D{2,2};
double origin_x=3D 0;
double origin_y=3D0;
double origin[] =3D {origin_x, origin_y};
ImageType::IndexType index;
img->SetOrigin(origin);
img->SetSpacing(values); // here I have already a problem at =
RebuildTransform() method=20
ImageType::SizeType imagesize;
imagesize[0] =3D 256;
imagesize[1] =3D 256;
=20
ImageType::RegionType region;
region.SetSize( imagesize );
=20
img->SetLargestPossibleRegion( region );
img->SetBufferedRegion( region );
img->SetRequestedRegion(region);
img->Allocate();
img->SetPixelContainer(import);
img->Update();=20
/******** connectedThresholdImageFilter***********/=20
typedef itk::ConnectedThresholdImageFilter<ImageType,ImageType> =
FilterType;=20
FilterType::Pointer filter =3D FilterType::New();
filter->SetInput(img);
FilterType::IndexType seed; seed[0] =3D 165; seed[1] =3D 90;
filter->SetSeed(seed);
filter->SetLower(0);
filter->SetUpper(255);
filter->SetReplaceValue(255);
filter-> Update();// here iot doesn't work because of the dynamic-cast =
of copyInformation method.=20
_____ =20
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en fran=E7ais !
Testez le nouveau Yahoo! <http://fr.mail.yahoo.com> Mail
------_=_NextPart_001_01C2A6AE.3CEBF9CE
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.2715.400" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=453305015-18122002><FONT color=#0000ff size=2>Lydia,
</FONT></SPAN></DIV>
<DIV><SPAN class=453305015-18122002><FONT color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=453305015-18122002><FONT color=#0000ff size=2>You can use the
ImportImageFilter to set up the "imported" for ITK. This is easier than
creating the</FONT></SPAN></DIV>
<DIV><SPAN class=453305015-18122002><FONT color=#0000ff size=2>ITK image and
ImportImageContainer.</FONT></SPAN></DIV>
<DIV><SPAN class=453305015-18122002><FONT color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=453305015-18122002><FONT color=#0000ff
size=2>itk::ImportImageFilter<unsigned char, 2>::Pointer import =
itk::ImportImageFilter<unsigned char, 2>::New();</FONT></SPAN></DIV>
<DIV><SPAN class=453305015-18122002><FONT color=#0000ff
size=2>import->SetImportPointer(label_image2, size[0]*size[1],
false);</FONT></SPAN></DIV>
<DIV><SPAN class=453305015-18122002><FONT color=#0000ff
size=2>import->SetRegion( region );</FONT></SPAN></DIV>
<DIV><SPAN class=453305015-18122002><FONT color=#0000ff
size=2>import->SetSpacing( spacing );</FONT></SPAN></DIV>
<DIV><SPAN class=453305015-18122002><FONT color=#0000ff
size=2>import->SetOrigin( origin );</FONT></SPAN></DIV>
<DIV><SPAN class=453305015-18122002>
<P><FONT color=#0000ff size=2>typedef
itk::ConnectedThresholdImageFilter<ImageType,ImageType> FilterType;
</FONT>
<P><FONT color=#0000ff size=2> FilterType::Pointer filter =
FilterType::New();<BR> filter->SetInput(<SPAN
class=453305015-18122002> </SPAN>i<SPAN
class=453305015-18122002>mport->GetOutput() </SPAN>);<SPAN
class=453305015-18122002> // SET
THE INPUT TO THE FILTER TO THE OUTPUT OF THE IMPORT </SPAN></FONT></P>
<P><FONT color=#0000ff size=2><SPAN
class=453305015-18122002></SPAN><BR> FilterType::IndexType
seed; seed[0] = 165; seed[1] = 90;<BR>
filter->SetSeed(seed);<BR>
filter->SetLower(0);<BR>
filter->SetUpper(255);<BR>
filter->SetReplaceValue(255);<BR> <SPAN class=453305015-18122002>
</SPAN><SPAN class=453305015-18122002> </SPAN>filter->
Update();</FONT></P></SPAN></DIV>
<DIV><SPAN class=453305015-18122002><FONT color=#0000ff
size=2></FONT></SPAN> </DIV>
<BLOCKQUOTE
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid">
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
size=2>-----Original Message-----<BR><B>From:</B> lydia coin
[mailto:lydia_coin3d@yahoo.fr]<BR><B>Sent:</B> Wednesday, December 18, 2002
10:08 AM<BR><B>To:</B> insight-users@public.kitware.com<BR><B>Subject:</B>
[Insight-users] help needed please!<BR><BR></FONT></DIV>
<P>Could anyone tell what's wrong with these lines. I'm stagnating since
yesterday and no solution is suggested to my problem. Please it is urgent
<P> /*** this is for importing pixel values from an unsigned char type
pointer **/
<BLOCKQUOTE
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">
<P>itk::ImportImageContainer<long unsigned int, unsigned
char>::Pointer import;<BR> import =
itk::ImportImageContainer<long unsigned int, unsigned
char>::New();<BR> import->Initialize();<BR> import->Reserve(size[0]*size[1]);<BR> import->SetImportPointer(labeled_image2,size[0]*size[1],false);</P>
<P>/****setting the pixel values in the itkimage****/
<P>typedef itk::Image<unsigned char, 2>
ImageType;<BR> ImageType:: Pointer img =
ImageType::New();
<P> double values[]={2,2};<BR> double
origin_x= 0;<BR> double
origin_y=0;<BR> double origin[] = {origin_x,
origin_y};<BR> ImageType::IndexType
index;<BR> img->SetOrigin(origin);<BR> img->SetSpacing(values);
// here I have already a problem at RebuildTransform() method
<P> ImageType::SizeType
imagesize;<BR> imagesize[0] =
256;<BR> imagesize[1] =
256;<BR> <BR> ImageType::RegionType
region;<BR> region.SetSize( imagesize
);<BR> <BR> img->SetLargestPossibleRegion(
region );<BR> img->SetBufferedRegion( region
);<BR> img->SetRequestedRegion(region);<BR> img->Allocate();<BR> img->SetPixelContainer(import);<BR> img->Update();
<P>/******** connectedThresholdImageFilter***********/
<P>typedef itk::ConnectedThresholdImageFilter<ImageType,ImageType>
FilterType;
<P> FilterType::Pointer filter =
FilterType::New();<BR>
filter->SetInput(img);<BR> FilterType::IndexType seed;
seed[0] = 165; seed[1] = 90;<BR>
filter->SetSeed(seed);<BR>
filter->SetLower(0);<BR>
filter->SetUpper(255);<BR>
filter->SetReplaceValue(255);<BR> filter-> Update();// here iot
doesn't work because of the dynamic-cast of copyInformation method.
</P></BLOCKQUOTE>
<P><BR>
<HR SIZE=1>
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !<BR><A
href="http://fr.mail.yahoo.com">Testez le nouveau Yahoo!
Mail</A></BLOCKQUOTE></BODY></HTML>
------_=_NextPart_001_01C2A6AE.3CEBF9CE--