[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,&nbsp;SetOrigin method, this-&gt;RebuildTransform() function.</P>
<P>Does someone know&nbsp;how to solve it?</P>
<P>&nbsp;typedef itk::Image&lt;unsigned char, 2&gt; ImageType;<BR>&nbsp;&nbsp;&nbsp;ImageType::&nbsp;Pointer img = ImageType::New();<BR>&nbsp;&nbsp;&nbsp;float values[2]={0.76,0.76};// values[0]=0.76; values[1]=0.76;<BR>&nbsp;&nbsp;&nbsp;float origin_x= ((size[0]/2)*0.76*(-1));<BR>&nbsp;&nbsp;&nbsp;float origin_y=((size[1]/2)*0.76*(-1));<BR>&nbsp;&nbsp;&nbsp;float origin[2] = {origin_x, origin_y};<BR>&nbsp;&nbsp;&nbsp;ImageType::SizeType&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; imagesize;<BR>&nbsp;&nbsp;&nbsp;imagesize[0] = 256;<BR>&nbsp;&nbsp;&nbsp;imagesize[1] = 256;<BR>&nbsp;&nbsp;&nbsp;ImageType::RegionType region;<BR>&nbsp;&nbsp;&nbsp;region.SetSize( imagesize );<BR>&nbsp;&nbsp;&nbsp;img-&gt;SetLargestPossibleRegion( region );<BR>&nbsp;&nbsp;&nbsp;img-&gt;SetBufferedRegion( region );<BR>&nbsp;&nbsp;&nbsp;img-&gt;Allocate();<BR>&nbsp;&nbsp;&nbsp;img-&gt;SetOrigin(origin);<BR>&nbsp;&nbsp;&nbsp;img-&gt;SetSpacing(values);<BR>&nbsp;&nbsp;&nbsp;img-&gt;SetPixelContainer(import);<BR>&nbsp;&nbsp;&nbsp;img-&gt;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--