# MetaImage headers, how to get them?

**URL:** <https://discourse.itk.org/t/metaimage-headers-how-to-get-them/453>\
**Category:** Beginner Questions\
**Created:** [November 23, 2017, 11:01am UTC](https://discourse.itk.org/t/metaimage-headers-how-to-get-them/453 "2017-11-23T11:01:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cae2017](https://discourse.itk.org/letter_avatar_proxy/v4/letter/c/ce73a5/32.png) [@cae2017](https://discourse.itk.org/u/cae2017)\
**Post date:** [November 23, 2017, 11:01am UTC](https://discourse.itk.org/t/metaimage-headers-how-to-get-them/453/1 "2017-11-23T11:01:11Z")

</div>

Hi, I’m really new working with ITK and VTK and I’d really appreciate a little help. I’m trying out the examples available online and I’ve seen that I need a \*.mha or \*.mhd file.

My question is, is it possible to get these out my DICOM Images and if so, how do I get it?

Thank you very much.

Best regards,  
Erika

---

<div class="post-metadata">

**Author:** ![tim-evain](https://discourse.itk.org/user_avatar/discourse.itk.org/tim-evain/32/220_2.png) [@tim-evain](https://discourse.itk.org/u/tim-evain)\
**Post date:** [November 23, 2017, 11:24am UTC](https://discourse.itk.org/t/metaimage-headers-how-to-get-them/453/2 "2017-11-23T11:24:42Z")

</div>

Hello Erika,

You don’t necessarily need a MetaImage to work with ITK/VTK, this is just the historical format of the library.  
You can read images directly from your DICOM with the built-in GDCM lib.  
Refer to this example to see how you load a DICOM : [https://itk.org/Wiki/ITK/Examples/DICOM/ResampleDICOM](https://itk.org/Wiki/ITK/Examples/DICOM/ResampleDICOM)

HTH

Tim

---

<div class="post-metadata">

**Author:** ![cae2017](https://discourse.itk.org/letter_avatar_proxy/v4/letter/c/ce73a5/32.png) [@cae2017](https://discourse.itk.org/u/cae2017)\
**Post date:** [November 23, 2017, 2:02pm UTC](https://discourse.itk.org/t/metaimage-headers-how-to-get-them/453/3 "2017-11-23T14:02:26Z")

</div>

Thank you, Tim.

I tried the ResampleDICOM and it work, but when I try to read this files on the example [https://lorensen.github.io/VTKExamples/site/Cxx/Medical/TissueLens/](https://lorensen.github.io/VTKExamples/site/Cxx/Medical/TissueLens/) it still doesn’t work. This is waht the vtkOutputWindow shows:

> ERROR: In D:\VTK\Source\IO\Image\vtkMetaImageReader.cxx, line 84  
> vtkMetaImageReader (000000000041BBE0): MetaImage cannot parse file.
> 
> ERROR: In D:\VTK\Source\IO\Image\vtkMetaImageReader.cxx, line 237  
> vtkMetaImageReader (000000000041BBE0): MetaImage cannot read data from file.
> 
> ERROR: In D:\VTK\Source\Filters\Core\vtkMarchingCubes.cxx, line 417  
> vtkMarchingCubes (00000000023C85A0): Cannot contour data of dimension != 3

Any thoughs on this?

Best regards,  
Erika

---

<div class="post-metadata">

**Author:** ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)\
**Post date:** [November 23, 2017, 2:57pm UTC](https://discourse.itk.org/t/metaimage-headers-how-to-get-them/453/4 "2017-11-23T14:57:10Z")

</div>

The example you reference uses VTK and can only read MetaImage format. If you try to give it another type of image (e.g. DICOM) it will complain. That example doesn’t come with an image, so if you just tried running it no wonder it doesn’t work.
