neurolabusc / MRIcroGL10_OLD

DEPRECATED development has moved to https://github.com/rordenlab/MRIcroGL
https://www.nitrc.org/plugins/mwiki/index.php/mricrogl:MainPage
BSD 2-Clause "Simplified" License
58 stars 24 forks source link

Need of a cyclic corolmap #35

Closed seralouk closed 4 years ago

seralouk commented 4 years ago

Hi all,

I am using MRIcroGL in order to create some brain visualizations.

I have an activation map and I need to use a cyclic colormap such as the HSV colormap. however, such option is not available.

Any tip?

I also posted this here: https://www.nitrc.org/forum/forum.php?thread_id=11413&forum_id=4442

neurolabusc commented 4 years ago

You can create new color lookup tables with a text editor. The format is very simple. You describe the number of nodes, each node has an intensity associated with it (the color index horizontal position). Finally, each node has a red/green/blue/alpha value associated with it. Intensity and RGBA are values in the range 0..255. To make the colormap cyclic, just make the final node have the same color (red, green and blue values) as the first node. Save the text file with the extension ".clut" and place the file in MRIcroGL's /Resources/lut folder (for MacOS, select the MRIcroGL application and Show Package Contents to see these folders). When you re-launch MRIcroGL it will include the new color table. Here is an example for the HSV color table:

[FLT]
min=0
max=0
[INT]
numnodes=7
[BYT]
nodeintensity0=0
nodeintensity1=43
nodeintensity2=85
nodeintensity3=128
nodeintensity4=170
nodeintensity5=213
nodeintensity6=255
[RGBA255]
nodergba0=255|0|0|0
nodergba1=255|255|0|14
nodergba2=0|255|0|28
nodergba3=0|255|255|43
nodergba4=0|0|255|57
nodergba5=255|0|255|71
nodergba6=255|0|0|85

When designing color maps, please be mindful of how people with color blindness will perceive your colors. Criticisms of the classic Matlab color maps and modern alternatives (such as the Viridis and Plasma schemes provided with MRIcroGL) are here, here and here. @CPernet provides tools for controlling luminance in color maps.

hsv2

seralouk commented 4 years ago

Amazing answer thank you a lot! i have now created my colormap successfully and MRIcroGL is able to recognize it. One last thing.

mahirtazwar commented 1 year ago

What would be the color table if I want to generate random colormap (similar to the random colormap in fsleyes, or how segmentations are loaded on ITK-SNAP)? In this case, each region of interest with a unique label will have a unique or repeated color (since I have more than 200+ ROIs).

neurolabusc commented 1 year ago

Set the intent_code of your NIfTI header to 1002 to specify NIFTI_INTENT_LABEL. This will use the same random color scheme as FSLeyes and use nearest neighbor interpolation (to solve the partial volume issue that a voxel that is a mixture of area 17 and area 19 should not be identified as area 18).

To see examples, choose any of the images listed under the File/AddAtlas menu item.

neurolabusc commented 1 year ago

You can always create your own random color schemes, just specify a lot of nodes for your color scheme each with a distinct color. For more details on color schemes, see the NiiVue documentation which links to a live demo that allows you to experiment with color schemes.