# Lossy image conversion with FSL inputs

**URL:** <https://discourse.slicer.org/t/lossy-image-conversion-with-fsl-inputs/10938>\
**Category:** Support\
**Created:** [March 31, 2020, 2:36pm UTC](https://discourse.slicer.org/t/lossy-image-conversion-with-fsl-inputs/10938 "2020-03-31T14:36:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![LearningSlicerYay](https://avatars.discourse-cdn.com/v4/letter/l/8dc957/32.png) [@LearningSlicerYay](https://discourse.slicer.org/u/LearningSlicerYay)\
**Post date:** [March 31, 2020, 2:36pm UTC](https://discourse.slicer.org/t/lossy-image-conversion-with-fsl-inputs/10938/1 "2020-03-31T14:36:42Z")

</div>

System: Ubuntu 18.04 LTS  
Slicer: 4.10.2

Hi everyone,

I previously used the dMRI pipeline to conduct all my diffusion and tractography analyses and everything worked fine. However, I believe I need to use FSL to do some corrections, which outputs to .nii files.

The .nii’s (with 76 volumes) can be opened in Slicer with no issues, but it seems to only recognize the first volume. If I use DWIConvert FSLtoNRRD (with output, and NiftiFSL to NRRD parameters filled and all other areas with the defaults), I get the following error:

> Diffusion-weighted DICOM Import (DWIConvert) standard error:
> 
> Error: ReadVolume: Unsupported source pixel type.  
> Input volume: float  
> Output volume: short  
> The only supported output type is . You may consider using allowLossyConversion option.  
> However, use this option with caution! Conversion from images of a different type may cause data loss due to rounding or truncation.  
> terminate called without an active exception

If I check off “Allow lossy image conversion” it works fine. I’m just wondering what exactly it’s doing to the images - and if there’s any suggestions on how I could perhaps compare the FSL NIFTIs with Slicer’s NRRDs to ensure they’re the same? I’m worried that this may affect the tractography results we get later down the line.

Thanks for your input!

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [March 31, 2020, 3:35pm UTC](https://discourse.slicer.org/t/lossy-image-conversion-with-fsl-inputs/10938/2 "2020-03-31T15:35:58Z")

</div>

It’s a [data casting issue](https://github.com/BRAINSia/BRAINSTools/blob/a8c0c926a2c183b37786100f0d4d0ceb6725e9b4/DWIConvert/DWIConvertUtils.hxx#L131-L139) so if you investigate the types you will be able to tell what data might get lost.

dcm2niix now support nifti/nrrd conversion for dwi data. You could compare the results.

[https://www.nitrc.org/plugins/mwiki/index.php/dcm2nii:MainPage](https://www.nitrc.org/plugins/mwiki/index.php/dcm2nii:MainPage)

---

<div class="post-metadata">

**Author:** ![LearningSlicerYay](https://avatars.discourse-cdn.com/v4/letter/l/8dc957/32.png) [@LearningSlicerYay](https://discourse.slicer.org/u/LearningSlicerYay)\
**Post date:** [March 31, 2020, 4:22pm UTC](https://discourse.slicer.org/t/lossy-image-conversion-with-fsl-inputs/10938/3 "2020-03-31T16:22:17Z")

</div>

Hi Steve,

Thanks for your response. I’ll look into data casting.

Regarding dcm2niix, I don’t think it supports NIFTI-to-NRRD conversion does it? I’m looking to compare the outputs from FSL with the NRRD from dwiconvert, so it’s not the same as using the nifti converted from the raw DICOM data.

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [March 31, 2020, 7:46pm UTC](https://discourse.slicer.org/t/lossy-image-conversion-with-fsl-inputs/10938/4 "2020-03-31T19:46:25Z")

</div>

Yes, I understand dcm2niix does nifti-nrrd conversion for dwi. I haven’t used it myself.

---

<div class="post-metadata">

**Author:** ![ebrahim](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ebrahim/32/13403_2.png) [@ebrahim](https://discourse.slicer.org/u/ebrahim)\
**Post date:** [July 11, 2023, 4:43pm UTC](https://discourse.slicer.org/t/lossy-image-conversion-with-fsl-inputs/10938/5 "2023-07-11T16:43:49Z")

</div>

In case anyone runs into this topic during search as I did:

dcm2niix does not do NIFTI-to-NRRD conversion.

The situation is clarified a bit in [this discussion](https://discourse.slicer.org/t/nrrd-to-fsl-error-with-dwiconvert/11666/8), where it is suggested to use the tools here: [GitHub - pnlbwh/conversion: Various mri conversion/modification scripts](https://github.com/pnlbwh/conversion#introduction)

This is what ended up working for me.
