[Insight-users] importing 2D images to itk

lydia coin lydia_coin3d@yahoo.fr
Mon, 16 Dec 2002 12:41:07 +0100 (CET)


--0-725993148-1040038867=:5612
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit


Hi folks

Can anyone tell me what's wrong with these lines of code? I'm new at itk and I got an error at execution

 unsigned char *labeled_image= new unsigned char[size[0]*size[1]];

itk::ImportImageContainer<long unsigned int, unsigned char>::Pointer import;
   import = itk::ImportImageContainer<long unsigned int, unsigned char>::New();
   import->Initialize();
   import->Reserve(size[0]*size[1]);
   import->SetImportPointer(labeled_image,size[0],true);
   itk::Image<unsigned char, 2> *img = itk::Image<unsigned char, 2>::New();
    img->SetPixelContainer(import);

it's compiles fine but stops at img->SetPixelContainer(import)

May I add other information about the inage as the pixel size ? or is there another problem

Many thanks



---------------------------------
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Testez le nouveau Yahoo! Mail
--0-725993148-1040038867=:5612
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

<P>Hi folks</P>
<P>Can anyone tell me what's wrong with these lines of code? I'm new at itk and I got an error at execution</P>
<P>&nbsp;unsigned char *labeled_image= new unsigned char[size[0]*size[1]];</P>
<P>itk::ImportImageContainer&lt;long unsigned int, unsigned char&gt;::Pointer import;<BR>&nbsp;&nbsp;&nbsp;import = itk::ImportImageContainer&lt;long unsigned int, unsigned char&gt;::New();<BR>&nbsp;&nbsp;&nbsp;import-&gt;Initialize();<BR>&nbsp;&nbsp;&nbsp;import-&gt;Reserve(size[0]*size[1]);<BR>&nbsp;&nbsp;&nbsp;import-&gt;SetImportPointer(labeled_image,size[0],true);<BR>&nbsp;&nbsp;&nbsp;itk::Image&lt;unsigned char, 2&gt; *img = itk::Image&lt;unsigned char, 2&gt;::New();<BR>&nbsp;&nbsp;&nbsp;&nbsp;img-&gt;SetPixelContainer(import);</P>
<P>it's compiles fine but stops at img-&gt;SetPixelContainer(import)</P>
<P>May I add other information about the inage as the pixel size ? or is there another problem</P>
<P>Many thanks</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-725993148-1040038867=:5612--