# Question about color lookup tables

Hi,

I have a question about using color lookup tables. I wanted to display an atlas nifti file WHS_SD_rat_atlas_v3.nii.gz in its original colors according to WHS_SD_rat_atlas_v3.label.

I converted the lookup table to a Slicer lookup table and imported it:

I changed the lookup table of the imported atlas volume to the imported lookup table, set its Window/Level settings to Manual Min/Max and the values to 0 and 164 (according to the volume information). This range also fits to the color indices of the lookup table.

Now, the scalars were not colored correctly. I made a dummy nifti using MATLAB to investigate:

V = zeros(165, 2, 2);
V(:, 1, 1) = linspace(0, 164, 165);
V=uint16(V);
niftiwrite(V,'path\to\testnifti.nii');


With the same slicer settings (lookup table, window/level settings), the result is as follows:

With this, I soon discovered, that the correct settings for Window/Level Manual Min/Max are 0 and 255 leading to this:

When I use the same settings for the atlas, it is displayed in its original colors.

The question is: Why 255?

Can you share the Slicer color file that you generated? If you want 1:1 mapping then you need to set the scalar range to match the number of colors.

By the way, if you load a labelmap volume, then I think the color table is used as is - there is no intensity mapping.

Have you created a script that converted ITK-snap to Slicer color table? Can you share it?

Sure - it can be downloaded from here. This version contains entries for the missing color indices in the original file, as I was thinking that missing entries might be an issue here.

I was playing around with the scalar range - I guess that the standard (as depicted in the screenshot) should be fine.

A labelmap volume was one of the first things that came into my mind in connection with atlas-related applications. However, the atlas in question is distributed as a nifti and I couldn’t find a way in my quick research to convert it to a labelmap volume. So I extract the desired regions with the segment editor (thresholding the relevant scalar). Is there a better way to do this?

No, I did this by hand.

You can import a labelmap stored in a nifti file as described here: