Convert Nrrd To Nifti

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

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:

Results of Conversion (Niftii File):

I would appreciate any insight into this matter.

Thanks.

For non-DWI images you can use the normal File->Save. Slicer correctly loads and round-trips the NIfTI test data. If you need to script the operation, see here – set the file extension to .nii and Slicer IO will do the rest. e.g. using the MRHead sample dataset:

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

HTH

1 Like