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:
image

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:
image

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

The question is: Why 255?

Thanks for your help!

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:

https://slicer.readthedocs.io/en/latest/user_guide/modules/segmentations.html?highlight=labelmap#import-an-existing-segmentation-from-volume-file

You can also convert a scalar volume to labelmap volume after you loaded it, by using “Convert to labelmap” in Volumes module / Volume information section.

1 Like

Oh, thanks for this information - especially the first option is very nice. Additionally to having the segments available, it would be very advantageous to be able to also import colors and labels for the segments. This way, the atlas representation would be complete.

Unfortunately, the initial question about the color lookup table settings remains a mystery for me.

One more tip: If you work with hundreds of segments then you must use Slicer-4.11, as it has huge performance improvements for managing such large segmentations. It also has search and filter to make it easy to select a subset of segments that you are working on. Right-click on the segment list and choose “Show filter bar” to enable this feature.

image

A post was split to a new topic: Rendering at higher than 8 bits per pixel