[Insight-users] writing meta file

Sylvain Jaume sylvain.jaume at kitware.com
Thu Mar 2 22:49:11 EST 2006


Hi Wanmei,

The .mha file contains the header and the raw data.
Did you try reading your .mha file (and convert it back to PNG) to check 
if the raw data are included?
Another option is to use 'junk.mhd'. Then you should get a 'junk.raw' file.
Let me know how it goes.

Regards,
Sylvain

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


More information about the Insight-users mailing list