[Insight-users] importing a 2D array into a itk::Image
Zecrou@aol.com
Zecrou at aol . com
Wed, 07 Aug 2002 05:25:59 -0400
Hi everybody
I would like to import an 512*512 2D array of unsigned char into an itk::Image<unsigned char, 2>
itk::ImportImageContainer<long unsigned int, unsgned char> *import;
import = itk::ImportImageContainer<long unsigned int, unsigned char>::New();
import->Initialize();
import->Reserve(512*512);
import->SetImportPointer(pointer_to_my_array,512,true);
itk::Image<unsigned char, 2> *img = itk::Image<unsigned char, 2>::New();
img->SetPixelContainer(import);
the problem is that when I launch the program, there's a segmentation fault with the import->Initialize()
I tried to remove the initialization but there is a new segmentation fault with the import->Reserve(512*512)
Does anyone have an idea?
Is there any other way to import my array?
Thank you in advance
zecrou