[Insight-developers] itkImageFileWriter

Karthik Krishnan Karthik.Krishnan at kitware.com
Fri Jun 17 12:09:06 EDT 2005



Leila baghdadi wrote:

>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;
>  
>
BUG... origin[1] :)   

>  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
>
>_______________________________________________
>Insight-developers mailing list
>Insight-developers at itk.org
>http://www.itk.org/mailman/listinfo/insight-developers
>
>  
>


More information about the Insight-developers mailing list