[Insight-users] problems reading meta headers???
Fernando Rannou
rannou@mednet.ucla.edu
Thu, 27 Mar 2003 14:32:28 -0800
Hello,
I'm having problems to manipulate meta images.
Here is the header file:
ObjectType = Image
NDims = 3
BinaryData = True
BinaryDataByteOrderMSB = False
ElementSpacing = 0.4 0.4 1.22
DimSize = 128 128 63
ElementType = MET_FLOAT
ElementDataFile = rp_pet.mhd.raw
and here's my program that prints out the image spacing:
#include "itkImage.h"
#include "itkImageFileReader.h"
int main( int argc, char **argv )
{
const unsigned int Dimension = 3;
typedef float PixelType;
typedef itk::Image< PixelType, Dimension > ImageType;
typedef itk::ImageFileReader< ImageType > ImageReaderType;
ImageReaderType::Pointer imageReader = ImageReaderType::New();
imageReader->SetFileName( argv[1] );
ImageType::Pointer myimage = imageReader->GetOutput();
const double * spacing = myimage->GetSpacing();
std::cout << "Spacing: " << spacing[0] << ", " << spacing[1] << ", "
<< spacing[2] << std::endl;
return 0;
}
When I run the program I get:
Spacing: 1, 1, 1
----
This is probably something very obvious but I don't see it right now.
Thanks
Fernando