[Insight-users] setorigin and setspacing for itkimage problem
lydia coin
lydia_coin3d@yahoo.fr
Tue, 17 Dec 2002 18:21:45 +0100 (CET)
--0-1622300887-1040145705=:43379
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Hi everyone
Thanks Luis for your help of yesterday about smartPointers
Now I have another problem that maybe many of you know its solution.
by using this code, I get an execption at SetOrigin method. The execption is in the file itkimgae.txx, SetOrigin method, this->RebuildTransform() function.
Does someone know how to solve it?
typedef itk::Image<unsigned char, 2> ImageType;
ImageType:: Pointer img = ImageType::New();
float values[2]={0.76,0.76};// values[0]=0.76; values[1]=0.76;
float origin_x= ((size[0]/2)*0.76*(-1));
float origin_y=((size[1]/2)*0.76*(-1));
float origin[2] = {origin_x, origin_y};
ImageType::SizeType imagesize;
imagesize[0] = 256;
imagesize[1] = 256;
ImageType::RegionType region;
region.SetSize( imagesize );
img->SetLargestPossibleRegion( region );
img->SetBufferedRegion( region );
img->Allocate();
img->SetOrigin(origin);
img->SetSpacing(values);
img->SetPixelContainer(import);
img->Update();
---------------------------------
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Testez le nouveau Yahoo! Mail
--0-1622300887-1040145705=:43379
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
<P>Hi everyone</P>
<P>Thanks Luis for your help of yesterday about smartPointers</P>
<P>Now I have another problem that maybe many of you know its solution.</P>
<P>by using this code, I get an execption at SetOrigin method. The execption is in the file itkimgae.txx, SetOrigin method, this->RebuildTransform() function.</P>
<P>Does someone know how to solve it?</P>
<P> typedef itk::Image<unsigned char, 2> ImageType;<BR> ImageType:: Pointer img = ImageType::New();<BR> float values[2]={0.76,0.76};// values[0]=0.76; values[1]=0.76;<BR> float origin_x= ((size[0]/2)*0.76*(-1));<BR> float origin_y=((size[1]/2)*0.76*(-1));<BR> float origin[2] = {origin_x, origin_y};<BR> ImageType::SizeType imagesize;<BR> imagesize[0] = 256;<BR> imagesize[1] = 256;<BR> ImageType::RegionType region;<BR> region.SetSize( imagesize );<BR> img->SetLargestPossibleRegion( region );<BR> img->SetBufferedRegion( region );<BR> img->Allocate();<BR> img->SetOrigin(origin);<BR> img->SetSpacing(values);<BR> img->SetPixelContainer(import);<BR> img->Update();</P><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>
--0-1622300887-1040145705=:43379--