[Insight-developers] itkImageFileWriter

Leila baghdadi baghdadi at sickkids.ca
Fri Jun 17 11:57:41 EDT 2005


Hi guys,

I just noticed something weird!

I created an image and set the origin of my image before I used
itkImageFileWriter to write it but then it changes the origin

the this the code that I have

  size[0] = 300;
  size[1] = 270;
  size[2] = 270;

  m_TriangleToImage->SetSize(size);
  float origin[3];
  
  
  origin[0] = -14.95;
  origin[0] = -13.45;
  origin[2] = -13.45;
 
  m_TriangleToImage->SetOrigin(origin);
  float spacing[3];
  spacing[0] = 1;
  spacing[1] = 1;
  spacing[2] = 1;

  m_TriangleToImage->SetSpacing(spacing);

  m_TriangleToImage->Update();

  m_ImageWriter->SetInput(m_TriangleToImage->GetOutput() );
  m_ImageWriter->SetFileName("myimage.mhd");
  m_ImageWriter->UseInputMetaDataDictionaryOn();
  m_ImageWriter->Update();
  

and then if I look at the .mhd file


ObjectType = Image
NDims = 3
BinaryData = True
BinaryDataByteOrderMSB = False
TransformMatrix = 1 0 0 0 1 0 0 0 1
Offset = -13.45 5.60519e-44 -13.45
CenterOfRotation = 0 0 0
ElementSpacing = 1 1 1
DimSize = 300 270 270
AnatomicalOrientation = ???
ElementType = MET_UCHAR
ElementDataFile = myimage.raw


also how does ordering of data come into effect with these classes, it
is always xyz??

Thanks for your time


Leila



More information about the Insight-developers mailing list