Skip to content
Roan LaPlante edited this page Apr 30, 2014 · 10 revisions

The color editor is a builtin tool to create customized color tables that is included with tvtk.

You'll notice that this command pops up a control widget as well as a VTK window. You can click on the VTK window and rotate the surface around in order to see the extent of the resulting colormap.

The color maps resulting have up to 256 distinct colors -- that is, they sample in between the control points you select 256 times, including the control points themselves.

You can add or remove control points by right clicking anywhere in the plots. Each control point is defined by all of the various color parameters -- RGB, HSV, and alpha. Alpha controls the transparency of the color -- note that the 3D brain view will respect the values of alpha for any colormaps you use, but the circle view will usually not.

Left clicking and dragging any box to the left or right causes the entire control point to shift location on the colormap. To adjust the RGBHSVA values for a single control point, drag the corresponding boxes up and down.

The feed and grad buttons refer to "instant feedback." If the grad button is checked, when the boxes are being dragged around, the gradient bar displayed at the top of the dialog updates concurrently with them. If it is unchecked, the gradient bar updates asynchronously, when the mouse is released. Similarly, the feed button causes the 3D VTK window showing the colormap on a hilly surface to switch between concurrent updating while the boxes are being dragged and asynchronous updating when the drag operation finishes. Presumably leaving these on may incur a small performance penalty but it made no observable difference on my workstation.

The box labeled nonlin appears to creates a drop down menu with some parameters to logistically scale the speed at which the gradient transitions between control points. However, this is not in fact what it does. Instead, it creates a drop down menu that, when manipulated, throws NotImplementedError and causes the window to become subsequently unresponsive (the color editor runs in its own forked process so cvu remains responsive). If you click the button (i.e., by accident), but don't manipulate the sliders, nothing bad happens. Even so, do not click the "nonlin" button. (The Tkinter based version of the gradient editor offers enough better features than the other toolkit-specific versions that it is worth overlooking, even though the toolkit-specific gradient editors do not crash in this way. I could fix this issue at some point -- and by fix this issue I mean preventing the dialog from becoming unresponsive, not implementing the math -- but this would increase the amount of code I need to maintain and seems like it is almost zero important).

When you save a color map, three files are created. These are -- a .grad, .png, and .lut file. The .grad file appears to be a minimalistic internal format used by the editor -- you could use this file to load a color map into the color editor. The .png as you might expect is an image file showing the gradient bar. The .lut file is a text file (corresponding to the structure of a VTK lookup table) that you would use when actually using the color map in cvu -- specify the file map for some map in the "Options -> Colors" menu, and then use the .lut file in the filename box (see Options).