# MRTrix vs. Slicer color information

**URL:** <https://discourse.slicer.org/t/mrtrix-vs-slicer-color-information/14334>\
**Category:** Support\
**Created:** [October 30, 2020, 4:20pm UTC](https://discourse.slicer.org/t/mrtrix-vs-slicer-color-information/14334 "2020-10-30T16:20:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jaredsullivan](https://avatars.discourse-cdn.com/v4/letter/j/f9ae1b/32.png) [@jaredsullivan](https://discourse.slicer.org/u/jaredsullivan)\
**Post date:** [October 30, 2020, 4:20pm UTC](https://discourse.slicer.org/t/mrtrix-vs-slicer-color-information/14334/1 "2020-10-30T16:20:37Z")

</div>

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](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](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.

---

<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:** [November 5, 2020, 11:36pm UTC](https://discourse.slicer.org/t/mrtrix-vs-slicer-color-information/14334/2 "2020-11-05T23:36:23Z")

</div>

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:

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

```

 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/9/6/966731b66113d55943092dea9a95e2e74e45ed28.jpeg)

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