# convert .mha data to .mnc data

**URL:** https://discourse.itk.org/t/convert-mha-data-to-mnc-data/2230
**Category:** Engineering
**Created:** [September 6, 2019, 11:27am UTC](https://discourse.itk.org/t/convert-mha-data-to-mnc-data/2230 "2019-09-06T11:27:45Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![EE18D504\_SINDHURA\_C](https://discourse.itk.org/letter_avatar_proxy/v4/letter/e/b3f665/32.png) [@EE18D504\_SINDHURA\_C](https://discourse.itk.org/u/EE18D504_SINDHURA_C)
#### Post date: [September 6, 2019, 11:27am UTC](https://discourse.itk.org/t/convert-mha-data-to-mnc-data/2230/1 "2019-09-06T11:27:45Z")

</div>

Using diffeomorphic demons registration I need to do registration for brain images. This is the code which I am working on [https://github.com/BIC-MNI/EZminc](https://github.com/BIC-MNI/EZminc). I need to give input in .mnc format. Can someone suggest me how to convert my data which is in dicom format, mha and .mhd to .mnc??

---

<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: [September 6, 2019, 2:44pm UTC](https://discourse.itk.org/t/convert-mha-data-to-mnc-data/2230/2 "2019-09-06T14:44:43Z")

</div>

For DICOM, you can use this [example](https://itk.org/ITKExamples/src/IO/GDCM/ReadDICOMSeriesAndWrite3DImage/Documentation.html). For the other formats, changing dimension from 2 to 3 in this [example](https://github.com/InsightSoftwareConsortium/ITK/blob/master/Examples/IO/ImageReadWrite.cxx) should be enough. Then invoke as `ImageReadWrite.exe something.mha something.mnc`

---

<div class="post-metadata">

### Author: ![EE18D504\_SINDHURA\_C](https://discourse.itk.org/letter_avatar_proxy/v4/letter/e/b3f665/32.png) [@EE18D504\_SINDHURA\_C](https://discourse.itk.org/u/EE18D504_SINDHURA_C)
#### Post date: [September 7, 2019, 8:15am UTC](https://discourse.itk.org/t/convert-mha-data-to-mnc-data/2230/3 "2019-09-07T08:15:00Z")

</div>

Is there any software like ITK-snap to visualize .mnc files?  
Also how to know the data type of that image?  
I converted my image in .mha to .mnc by using `imagereadcastwrite.cxx` giving dim=3 and datatype short to float.  
I used this images as input to the above mentioned code, it says it couldn.t read image information. Please help me with this

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.itk.org/user_avatar/discourse.itk.org/lassoan/32/27_2.png) [@lassoan](https://discourse.itk.org/u/lassoan)
#### Post date: [September 7, 2019, 10:17pm UTC](https://discourse.itk.org/t/convert-mha-data-to-mnc-data/2230/4 "2019-09-07T22:17:08Z")

</div>

3D Slicer can read/write, segment, register, analyze .mnc files.

---

<div class="post-metadata">

### Author: ![matt.mccormick](https://discourse.itk.org/user_avatar/discourse.itk.org/matt.mccormick/32/7_2.png) [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)
#### Post date: [September 24, 2019, 8:11pm UTC](https://discourse.itk.org/t/convert-mha-data-to-mnc-data/2230/5 "2019-09-24T20:11:08Z")

</div>

Another option is [itk-vtk-viewer](https://kitware.github.io/itk-vtk-viewer/). Just [click on the the application](https://kitware.github.io/itk-vtk-viewer/app/), and select your _.mnc_ file.

A [command line interface](https://kitware.github.io/itk-vtk-viewer/docs/cli.html) is also available, so you can run

```auto
$ itk-vtk-viewer ./image.mnc

```

if you prefer the terminal.

Here is an example _mnc_ file from the [MNI Average Brain (305)](http://nist.mni.mcgill.ca/?p=957):

https://kitware.github.io/itk-vtk-viewer/app/?fileToLoad=https://data.kitware.com/api/v1/file/5d8a7729d35580e6dc3c7f1e/download/average305_t1_tal_lin.mnc

Only MINC version 2 is supported (this version is what the example @dzenanz referenced will produce).
