[Insight-users] writing meta file

Wanmei Ou wanmei at MIT.EDU
Thu Mar 2 18:11:17 EST 2006


Hi,


I have some difficulty in writing a file in meta format. The ITK
Software Guide Section 7.3 provides an example
(Examples/IO/ImageReadExportVTK) about writing an file in vtk format. I
try to modify it as the following (with "//" indicates the original
code; without "//" indicates my modification)

//#include "itkVTKImageIO.h"
#include "itkMetaImageIO.h"

//typedef itk::VTKImageIO                    ImageIOType;
typedef itk::MetaImageIO                    ImageIOType;

//ImageIOType::Pointer vtkIO = ImageIOType::New();
ImageIOType::Pointer metaIO = ImageIOType::New();

//vtkIO->SetFileTypeToASCII();
metaIO->SetFileTypeToASCII();

//writer->SetImageIO( vtkIO );
writer->SetImageIO( metaIO );


then, i called the modified program with the following two arguments
(input file and output file)
/VTK-ITK/InsightToolkit-1.8.0/Examples/Data/BrainMidSagittalSlice.png
junk.mha


but junk.mha only contains the header information of the image without
indication of the *raw file, and no *raw file is created.

Could you please let me know what's wrong with my code?


thanks,
Wanmei






More information about the Insight-users mailing list