help > customize colorbar
Showing 1-3 of 3 posts
Display:
Results per page:
Mar 4, 2019  03:03 PM | Allison Shapiro - UC Santa Barbara
customize colorbar
Thanks so much for providing such a wonderful tool!! I love its accessibility out of the box and have found the scripting tools extremely powerful for customization and reproducibility :-)

I'm working with stat maps from fMRI analyses and I'm admittedly a bit fussy about color themes for data visualization. Is it possible to customize the color scale called with OVERLAYCOLORNAME(1, 'filename') in the Scripting module? I'd like to specify my own colors rather than using the scales that came packaged with the software (e.g. winter, hot, etc.).
If the software is accessing a text file or matrix to pull up color scales (e.g. a list of HSV values or something like that), what is the format of that file and can I create my own? How can I direct the software to the location where I've stored that file? Can I specify the path before filename when I call OVERLAYCOLORNAME(1, 'filename')?

Thanks again for your work on Surf Ice!!

Allison
Mar 5, 2019  09:03 AM | Chris Rorden
RE: customize colorbar
You can create your own color tables, but Surfice expects them to be in its 'lut' folder. The benefit of this is that your color scheme is loaded and accessible through the graphical interface as well as with scripts. The idea with Surfice's scripts is automate actions you can do with the graphical interface, but the script functions do not provide features that are impossible with the graphical interface.


The color lookup tables (clut files) are saved in the folder Resources/lut folder. If you are using MacOS, you will need to select the Surfice executable in the Finder, control-click on the icon and choose the "Show Package Contents" - this will reveal the folders.

You can create new cluts with a text editor or using MRIcroGL's color editor:

1.) To use MRIcroGL, make sure you have version 1.2. Choose Color/ColorEditor to display the graphical color editor. You can move the position of the nodes (left-right for intensity, up-down for opacity), you can double-click a node to set its color, you can command-click to add a new node, and shift click to delete a node. When you are happy with your new color scheme, alt-click the color editor and you will be asked to provide a name to save your new color scheme. The color scheme will be saved to MRIcroGL's lut folder, so at that stage you can move it to the Surfice folder. The attached image shows the color editor, and it is the same color scheme described as text below.

2.) You can also use a text editor to create new color schemes - you can start with one that is close to what you want.
 a.) The [FLT] section sets default contrasts, and is only relevant for CT scans.
 b.) The [INT] section allows you to define how many nodes are in your color scheme. In the example below there are three nodes.
 c.) The [BYT] section sets the color intensity for each node - this is a value from 0 to 255. The first node should have a value of 0 and the last one a value of 255. In the example below the middle node is set to "67" so its intensity position is closer to the first node than the last one.
 d.) The [RGBA] section defines the color Red|Green|Blue|Alpha for each of your nodes. Each component has a value in the range 0..255. In the example below the first node is full black (0,0,0) and the last node is full white (255,255,255), while the middle row is a medium red (247,128,128). The "Alpha" column influences the opacity, and this only matters for MRIcroGL, not Surfice. It is easiest to understand this using the graphical editor described above. The tradition is to set the darkest node as transparent (0) and three brightest to about 50% translucent (128). For Surfice you can set this to any value from 0..255.


[FLT]
min=0
max=0

[INT]
numnodes=3
[BYT]
nodeintensity0=0
nodeintensity1=67
nodeintensity2=255
[RGBA255]
nodergba0=0|0|0|0
nodergba1=247|128|128|114
nodergba2=255|255|255|168
Attachment: clut.png
Mar 5, 2019  09:03 PM | Allison Shapiro - UC Santa Barbara
RE: customize colorbar
Thank you so much for your extremely clear and thorough tutorial. I followed your steps for creating a lookup table with MRIcro and moving it to surfice and - everything worked perfectly! 
Thank you!!