Flipped NIFTI image compared to original Nrrd File

Operating system:
Slicer version:
Expected behavior:
Actual behavior:

Hello Slicer Experts,

I had done some initial processing of my DTI data in Slicer.

Now, I have converted the files to nifti via DWIConvert so that I can use some FSL tools.

When I load the nifti versus the .nrrd in Slicer, I notice the nifti file is flipped compared to the nrrd.

Indeed, when I look at the headers of both files, one says left-posterior-superior and the other says right-superior-anterior. How can I rectify this?

Thank you for your help!

Emily

Hi Emily -

Is there any chance you can share a dataset that exhibits this issue along with the specific tools and steps that lead to the problem? Maybe you could reproduce the issue using the DWI dataset that is available in Slicer’s SampleData module? Or maybe a scan of a phantom?

There are lots of ways to flip the image data, but correctly transforming the gradients can be tricky and maybe there’s an issue with the converter.

Best,
Steve

Hi Steve,

Thanks for the reply. I am attaching my .nrrd file that I have been using in Slicer.

Than I used the following command via Slicer to convert the .nrrd file to nifti. Looks like I cannot upload these types of files. Could I perhaps email them to you?

The command:

DWIConvert --allowLossyConversion --conversionMode NrrdToFSL --inputVolume X.nrrd --outputVolume X.nii --output BVectors x.bvec --output BValues X.bval

I appreciate any thoughts you have. I am not 100% sure if I have a problem or not.

Thanks,

Emily

To share images, upload to your cloud storage account (Dropbox, OneDrive, Google drive) and copy-paste the link here.

Hi Steve,

Here is the link to the data.

Thank you so much!

Emily

[https://drive.google.com/open?id=0BxJP5A6fFyuULVRjR19JSl9CZDA]

Thank you very much!

Hi Emily -

Thanks for sharing the data - I was able to load it and work with it but wasn’t able to replicate the flipping issue you reported.

The command line I tested (below) was pretty much the same as yours. I tried converting the nrrd you sent and when I loaded the resulting nii file there was no flipping. Then I also downloaded the nii file you provided and again I didn’t see any flipping compared to the nrrd.

Can you doublecheck that when you load the nii and nrrd you uploaded into Slicer they don’t match?

I was using the nightly build from May 29 2017 on a mac. If you were using the 4.6.2 version you might try a more recent nightly although I don’t think this code has changed much.

If you loaded and re-saved the nii file in other software then perhaps other things happened (nifti can be a tricky format which is why we try to avoid using it).

-Steve

./Contents/lib/Slicer-4.7/cli-modules/DWIConvert --conversionMode NrrdToFSL --inputVolume /tmp/ELS_002_dwi-xc_QCed_permute_Ed_epi.nrrd --outputVolume /tmp/ELS_002_dwi-xc_QCed_permute_Ed_epi-cli.nii --outputBValues /tmp/b.vals --outputBVectors /tmp/b.vecs

Best,
Steve

Hi Steve,

Thanks so much!!!

I am noticing that the nrrd file and the nifti file look the same on Slicer. However, when I load the nifti file in the fsl viewer, things look a bit different. It may just be a matter of differences in how Slicer and FSL present the data.

I had initially (not the files I sent you) converted the nrrd file from a type unsigned short to just a short and then converted the file to nifti. In that process, the nifti file was flipped compared to the nrrd file in Slicer. When I left out the conversion to short from unsigned short, I did not see the flipping issue (the files I sent you).

Thanks,

Emily

Thanks for doublechecking Emily - there are a lot of issue with coordinates
that can pop up when going between packages and formats. This wiki page
might help but also check the display options for other software (some use
"neurological" convention while Slicer strictly uses "radiological"
convention for display).

https://www.slicer.org/wiki/Coordinate_systems