[Insight-users] How to get the information of an opened Analyze image?

liujs liujs at csie.nctu.edu.tw
Fri May 12 00:25:35 EDT 2006


Dear all,

As metioned in the manual, I read an Analyze image sucessfull
by code:
------------------------------------------------------------
typedef itk::Image<double,3>            ImageType;
typedef itk::ImageFileReader<ImageType> ReaderType;

ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(inFileName);

reader->Update();
------------------------------------------------------------

Then, I try to write a function which receives a file name and returns an 
opened object which contains all information of the .hdr and .img files.

My questions is:
   What kind object can contain all these information? Does
   itkAnalyzeImageIO can achieve this? I try to take a AnalyzeImageIO
   pointer as the parameter as following:
   ---------------------------------------------
   void fun1()
   {
     typedef itk::AnalyzeImageIO  ImageIOType;
     ImageIOType::Pointer analyzeImageIO = ImageIOType::New();

     fun2(analyzeImageIO);
     ...
   }
   void fun2(itk::AnalyzeImageIO *analyzeImageIO)
   {
     ...
     reader->SetFileName(inFileName);
     reader->SetImageIO(analyzeImageIO);

     reader->Update();
   }
   ---------------------------------------------
   After the execution, I can read information (such as dimentions)
   from the pointer. However, I do not know how to get the opened .img
   information (the pixel or voxel detail in any specified location)?

Could some one tell me whether this is the right way or not? 
Any help will be appreciated!


joshua


More information about the Insight-users mailing list