[vtkusers] MetaImage support

Mathieu Malaterre mathieu.malaterre at kitware.com
Mon Oct 4 09:17:53 EDT 2004


Rocky,

	Please use:

http://www.vtk.org/doc/nightly/html/classvtkMetaImageReader.html

[read binary UNC meta image data

One of the formats for which a reader is already available in the 
toolkit is the MetaImage file format. This is a fairly simple yet 
powerful format consisting of a text header and a binary data section. 
The following instructions describe how you can write a MetaImage header 
for the data that you download from the BrainWeb page.

The minimal structure of the MetaImage header is the following:

NDims = 3 DimSize = 181 217 181 ElementType = MET_UCHAR ElementSpacing = 
1.0 1.0 1.0 ElementByteOrderMSB = False ElementDataFile = brainweb1.raw

NDims indicate that this is a 3D image. ITK can handle images of 
arbitrary dimension. DimSize indicates the size of the volume in pixels 
along each direction. ElementType indicate the primitive type used for 
pixels. In this case is "unsigned char", implying that the data is 
digitized in 8 bits / pixel. ElementSpacing indicates the physical 
separation between the center of one pixel and the center of the next 
pixel along each direction in space. The units used are millimeters. 
ElementByteOrderMSB indicates is the data is encoded in little or big 
endian order. You might want to play with this value when moving data 
between different computer platforms. ElementDataFile is the name of the 
file containing the raw binary data of the image. This file must be in 
the same directory as the header.

MetaImage headers are expected to have extension: ".mha" or ".mhd"

Once you write this header text file, it should be possible to read the 
image into your ITK based application using the itk::FileIOToImageFilter 
class.]

HTH
Mathieu

Rocky Rhodes wrote:
> I have used MetaIO headers for reading binary 3d image data files into itk.
> I assumed the vtkImageReader would know about this format as well, but it
> doesn't seem to.  I don't see anything in the documentation, but wondered if
> there was a vtk MetaIO image reader anywhere; or support for any similar
> format, where a small text header file contains a pointer to the file
> containing the raw binary data.  Nrrd headers are like this as well.  I was
> hopeful when I saw the vtk XML file formats, but didn't see any version of
> these that allowed the binary data to reside in separate files.
> 
> Thanks for the help.
> 
> 	Rocky
> 
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
> 






More information about the vtkusers mailing list