[Insight-users] Retrieving the number of dimensions and datay pe from an image

Miller, James V (Research) millerjv at crd.ge.com
Tue Oct 19 14:33:30 EDT 2004


Image<>::PixelType and Image<>::ImageDimension can be used to determine the 
pixel type and image dimension.

Note that these are compile time definitions.  

Jim



-----Original Message-----
From: Vijay Prashanth [mailto:vijay_prashanth at mindtree.com]
Sent: Tuesday, October 19, 2004 12:22 AM
To: insight-users at itk.org
Subject: [Insight-users] Retrieving the number of dimensions and dataype
from an image


Hi Everybody,
 
I am storing a  (512*512)  2D array of unsigned char into an
itk::Image<unsigned char, 2> as in the following pseudocode
 
itk::ImportImageContainer<long unsigned int, unsgned char> Pointer import;
//initialise and reserve code

 import = itk::ImportImageContainer<long unsigned int, unsigned
char>::New();

 import->SetImportPointer(pointer_to_dataarray,512,true);
 
itk::Image<unsigned char, 2> *img = itk::Image<unsigned char, 2>::New();
 img->SetPixelContainer(import);

Now I want to retrieve the information from the image and remake the array,
does any body knows how to retrieve the number of dimensions, dataype and
other info  from the already formed image.
 
Thanks in advance,
Vijay.


More information about the Insight-users mailing list