# Convert Nrrd To Nifti

**URL:** <https://discourse.slicer.org/t/convert-nrrd-to-nifti/3118>\
**Category:** Development\
**Created:** [June 7, 2018, 8:58pm UTC](https://discourse.slicer.org/t/convert-nrrd-to-nifti/3118 "2018-06-07T20:58:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hikmat](https://avatars.discourse-cdn.com/v4/letter/h/ecccb3/32.png) [@Hikmat](https://discourse.slicer.org/u/Hikmat)\
**Post date:** [June 7, 2018, 8:58pm UTC](https://discourse.slicer.org/t/convert-nrrd-to-nifti/3118/1 "2018-06-07T20:58:30Z")

</div>

Operating system: Windows 10  
Slicer version: 4.8.1

Hi,

I am attempting to convert a Nrrd file (.nrrd) to a Nifti file (.nii.gz).  
I am aware of the DWIConvert module but I couldn’t understand how to get that to work as the U/I was confusing.

One could run this module from the Python interactor as well but I struggled with the syntax of this instruction and could find no apparent documentation.

So I tried this snippet of Python code (with the appropriate adjustments) and it seemed to work:  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/c/f/cfa0f12767a9178c760620bbda0a9a1806403f23.png)

However, upon loading the newly created Nifti file in Slicer, the images are of the incorrect type.  
That is to say, I get the Sagittal slice loaded in the Axial slice view and other such mishaps.  
In addition, my Sagittal slice has been rotated by 180.

Nrrd File:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/e/8/e86ffb4af7f61a552090d1ad6845659b7994ac71.jpeg)

Results of Conversion (Niftii File):

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/b/3/b324309c5a021cbb942e3bb95bf3d34496526581.jpeg)

I would appreciate any insight into this matter.

Thanks.

---

<div class="post-metadata">

**Author:** ![ihnorton](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ihnorton/32/9_2.png) [@ihnorton](https://discourse.slicer.org/u/ihnorton)\
**Post date:** [June 7, 2018, 9:23pm UTC](https://discourse.slicer.org/t/convert-nrrd-to-nifti/3118/2 "2018-06-07T21:23:13Z")

</div>

For non-DWI images you can use the normal File-\>Save. Slicer correctly loads and round-trips the [NIfTI test data](https://nifti.nimh.nih.gov/nifti-1/data). If you need to script the operation, see [here](https://nifti.nimh.nih.gov/nifti-1/data) – set the file extension to .nii and Slicer IO will do the rest. e.g. using the MRHead sample dataset:

```auto
>>> n = getNode("MRHead")
>>> saveNode(n, "/tmp/foo/test1.nii")
True

```

HTH
