[Insight-users] Meta image writer

Stephen R. Aylward aylward@unc.edu
Wed, 09 Oct 2002 21:46:29 -0400


This works on the current ITK release.

An example is given in Insight/Examples/MetaImageReadWrite

The code is:

   typedef itk::ImageFileWriter< ImageType > VolumeWriterType;
   VolumeWriterType::Pointer writer = VolumeWriterType::New();

   // Add the MetaImage format to the writer
   itk::MetaImageIO::Pointer metaWriter = itk::MetaImageIO::New();
   writer->SetImageIO( metaWriter );

   // **** THIS IS THE LINE TO USE TO WRITE THE DATA INTO THE HEADER FILE
   metaWriter->SetDataFileName( "LOCAL" );

   // Set the filename
   writer->SetFileName( "test.mhd" );

   // Set the image to write
   writer->SetInput( im );

   writer->Write();

Stephen

Zein Salah wrote:
> Hello all,
>  
> How can I force the Meta Image Writer to write to one single file, NOT 
> header+raw files??
>  
> Thanks,
> Zein
>  
>  
> ->8<------------->8<------------->8<------------->8<------------->8<------------->8<-
> Zein I. Salah
> Universität Tübingen, WSI-GRIS
> Sand 14
> 72076 Tübingen
> Email: salah@gris.uni-tuebingen.de <mailto:salah@gris.uni-tuebingen.de>  
> / zeinsalah@hotmail.com <mailto:zeinsalah@hotmail.com>
> Tel.: (07071) 29 75465 (GRIS) , (07071) 96 44 39 (privat)
> Fax: (07071) 29 54 66


-- 
===============================================
Dr. Stephen R. Aylward
Assistant Professor of Radiology
Adjunct Assistant Professor of Computer Science
http://caddlab.rad.unc.edu
aylward@unc.edu
(919) 966-9695