MRTrix vs. Slicer color information

Hello,

I am having trouble using Slicer to view a directionally-encoded color track density imaging (DEC-TDI) map created in MRtrix (documentation: https://mrtrix.readthedocs.io/en/latest/reference/commands/tckmap.html). The volume displays in color in MRtrix, but displays in grayscale in Slicer. In order to compare to a DEC-FA map that correctly displays in color in Slicer, I am trying to determine how I can alter the MRtrix file to display in color in Slicer.

The two DEC files (FA and TDI maps) can be found in this Dropbox folder: https://www.dropbox.com/sh/5vw4bexypqyxr1r/AAATxL0pLsoU2jyLbTeGh3Pla?dl=0
“Subject1_FA_DEC.nii” is the file that displays in color in Slicer.
“Subject1_TDI_DEC.nii.gz” is the MRtrix-generated file that displays in grayscale in Slicer (want color).

From the Volumes module, we see that,
Subject1_FA_DEC.nii has:
Scalars: 3
Scalar type: unsigned char
Volume type: vector
Subject 1_TDI_DEC.nii.gz has:
Scalars: 1
Scalar type: float
Volume type: scalar

From the NIFTI headers, we see that,
Subject1_FA_DEC.nii has image dimensions: [112×112×60×3 uint8]
Subject1_TDI_DEC.nii.gz has image dimensions:
[448×448×240×3 single]

From this information, we believe that Slicer may only be reading one component of the three-component MRtrix data, thus resulting in grayscale, and not color, display.

If anyone else has encountered this problem, or something similar, please let me know.

Thanks in advance.

We followed up on this off-list, here’s a way to get it working:

One needs to pip_install("nibabel"). Then the key lines are:

b = "/home/pieper/Downloads/AG2003_CSD_TDI_5_dec_b0.nii.gz"
ii = nibabel.load(b)
slicer.util.addVolumeFromArray(ii.get_data(), nodeClassName="vtkMRMLVectorVolumeNode")

I also manually edited the space directions so the volume was roughly oriented correctly, but it may still be left-right flipped.

1 Like