Data
What is MetaImage?
MetaImage is a medical and scientific image format with a tagged text header and pixel data, handled by ITK's MetaIO. A .mha file combines header and pixels; a .mhd file separates the header and usually references a data file such as .raw. The header can record dimensionality, axis sizes, element type, byte order, and spacing.
When to choose this format
- Combining header and pixel data in .mha
- Referencing an external data file from a .mhd header
When to avoid this format
- Preserving all DICOM study, patient, and clinical workflow attributes
- Assuming image orientation is consistent without checking reader behavior and coordinate conventions
Common uses
- Exchanging medical or research image volumes with ITK- and VTK-based tools
- Recording pixel type, dimensions, spacing, and related image properties in a text header
Features
- Uses text tags to describe dimensions, pixel type, and channel count
- Offers an attached .mha layout and a detached .mhd plus external data layout
- Can specify byte order and element spacing in the header
- Support for compression and other options depends on the implementation and reader or writer
Advantages and disadvantages
Advantages
- The text header makes key image parameters inspectable
- Used by medical-imaging and visualization toolkits such as ITK and VTK
- The detached layout lets pixel data be handled separately from its header
Disadvantages
- May require software or libraries compatible with MetaIO or ITK
- Breaking the relationship between a header and its external data can make the image unreadable
- Coordinate and orientation handling varies by application, and MetaImage does not replace all DICOM attributes
Open and convert
How to open
Open it with ITK, 3D Slicer, or another MetaImage-compatible viewer. Check NDims, DimSize, ElementType, ElementSpacing, byte order, compression settings, and coordinate conventions. For .mhd, keep the file referenced by ElementDataFile with its relative path, and confirm reader support.
How to convert
After conversion to NRRD, NIfTI, DICOM, or another format, compare pixel values, dimensions, type, channels, spacing, origin and direction, and coordinate system. Target formats may not preserve every MetaImage header field. Keep the source DICOM as well if patient or study attributes are required.
Cautions
- An .mhd file may contain no pixel data by itself; it can depend on the external file named by ElementDataFile. Preserve its filename and relative path.
- Pixels may be misread if the declared byte order, header size, type, or dimensions do not match the actual data.
- 3D Slicer documents that it interprets MetaImage in LPS coordinates and ignores the header's AnatomicalOrientation field. Validate coordinate meaning in the software you use.
- Check images for patient information or sensitive research data before sharing.
FAQ
What is the difference between .mha and .mhd?
.mha usually combines the header and image data. .mhd separates the text header and references a separate pixel-data file.
Is MetaImage the same as DICOM?
No. MetaImage describes pixel arrays and image geometry; it does not provide an equivalent guarantee of retaining all clinical study, patient, and equipment attributes from DICOM.
What should I send with an .mhd file?
Include the file referenced by ElementDataFile and preserve the relative path, filename, pixel type, dimensions, and coordinate convention.