MetaImage headers, how to get them?

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,

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 :



1 Like

Thank you, Tim.

I tried the ResampleDICOM and it work, but when I try to read this files on the example 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,

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.