= Tutorial 18: Colormaps = ''Authors: Francois Tadel, Elizabeth Bock, Sylvain Baillet'' When displaying signals on the sensor array or on the cortex surface, we need to convert the amplitude of the signal into a color. The way the values are mapped to colors has a lot of influence over the visual interpretation of the figures. The selection of the appropriate colormap is an important step of the data exploration. <> == Colormap menus == Brainstorm keeps track of many user-defined colormaps: anatomy, EEG, MEG, sources, stat, time, time-frequency, etc. You can go to the Colormaps menu in the main window to see this list. . {{attachment:colormap_all.gif||height="330",width="353"}} Usually, you will use only popup menus from specific figures to edit the colormaps. * Open a topography view for the standard average (right-click > MEG > 2D Sensor cap). * Right-click on the figure, you will only see the menu "'''Colormap: MEG recordings'''". * If you modify a colormap, the changes will be applied to all the figures, saved in your user preferences and available the next time you start Brainstorm. == Set the color array == A colormap is an array of colors that are indexed and then mapped to values. It is represented by a [Nx3] matrix, where N is the number of colors available in it. Each color is coded with three values corresponding its relative levels of red, green and blue. In Matlab, the colors are coded between 0 and 1. To get an example, type "jet" in the Matlab command window, you will get the default values for the "jet" colormap. We offer two ways of creating this array of colors in Brainstorm: you can use standard color arrays (modulated in contrast and brightness) or define your own. * '''Colormap name''': The standard colormaps are referred to with names (bone, grey, jet, rwb, etc). Just pick a different color set in the menu to update all the figures with similar data types.<
><
> {{attachment:colormap_name.gif||height="115",width="450"}} * '''Brightness''': Moves the center of the color array up and down. Example values: -80, 0, +80.<
><
> {{attachment:colormap_brightness.gif||height="115",width="450"}} * '''Contrast''': Changes the distance between the first and last colors. Example values: -80,0,+80.<
><
> {{attachment:colormap_contrast.gif||height="115",width="450"}} * The term "brightness" is not well adapted for colormaps such as ''rbw, jet'' or ''hsv. ''It makes more sense for colormaps with only one tint that varies in intensity, such as the ''grey'' colormap. We use it here for lack for a better word. * You can modify those values by '''clicking directly on the color bar'''. Hold the mouse button, then: * Move '''up/down''' to change the ''' brightness''' , * Move '''left/right''' to change the '''contrast'''. <> == Custom color array == To edit your own list of colors, use the menu "'''New...'''" at the end of the standard colormaps. * Open a 2D sensor cap view for the MEG sensors the standard average file for Run#01. <
> Right-click on the figure Colormap: MEG recordings > Colormap > New. * Enter the name of the new colormap and the number of colors it will contain. <
>Enter a small number to better get the feeling of how it works. <
><
> {{attachment:colormap_new.gif||height="188",width="159"}} {{attachment:colormap_edit1.gif||height="189",width="250"}} * Each color in this colormap is represented with a little square. The arrows in the the second row can be selected and deleted (delete key) or edited (double-click). They represent the key colors between which Matlab interpolates the other colors. Click on the second row to add more control colors. <
><
> {{attachment:colormap_edit2.gif||height="189",width="250"}} * Once you are satifsied with your new colormap, click on [Ok]. <
>It will update the figure. A new menu is now available in the list of available colormaps.<
><
> {{attachment:colormap_edit3.gif||height="275",width="500"}} * To delete the custom colormap currently selected, select the menu "'''Delete'''". == Set the color mapping == After defining the colors, we need to define how we want to map them with the values. The information necessary to do this color mapping is the value corresponding to first color and the value corresponding to the last color. The color indices will be scaled linearly between those extrema. * '''Absolute values''': Display the absolute values of the recordings, instead of the original values. This has the effect of constraining the color mapping to positive values only. It is not very useful for exploring the recordings: in EEG and MEG, the sign of the values is very important. <
><
> {{attachment:colormap_absolute.gif}} * '''Maximum''': How are the minimum and maximum values of the colorbar estimated. * '''Global''': The bounds of the colormap are set to the extrema values found in the entire file. <
> Example: if you use the ''rbw'' colormap and the min and max values are [-200ft, +200ft], the colors will be mapped in the following way: -200ft is blue, +200ft is red, 0ft is white. The display is identical for each time sample. If you select this option at '''t=0ms''', the 2D topography figure will turn almost white because the average values are low before the response. * '''Local''': Uses the local min and max values at the current time frame AND for each figure, instead of the global min and max. Example: A t=0ms, the extrema values are roughly [-30ft, +30ft]. So the colors will be mapped in order to have: -30ft = blue, and +30ft = red. * '''Custom''': You can set manually the min/max bounds of the colorbar. It does not have to be symmetrical around zero. If you set the values to [-40,+20] ft, the white colors would correspond to values around -10ft, and values around 0ft would be displayed in pale red. <
><
> {{attachment:colormap_max.gif}} * You can usually keep the option ''Local'' when looking at recordings, it is easier to read. <
> But keep in mind that it is not because you see flashy colors that you have necessarily strong effects. It's always a matter of colormap configuration. * '''Range''': Use symmetrical or non-symmetrical colormaps. * '''[-max, max]''': Symmetrical colorbar around the absolute value of the maximum. Eg. at t=47ms, the range is [-80ft, +100ft], and the colorbar used is [-100ft, +100ft], white is zero. * '''[min, max]''': Uses the real min and max. Eg. at t=47ms, the colorbar used is [-80ft, +100ft], white is NOT zero. * This option is ignored when the option "Maximum: Custom" is selected. {{http://neuroimage.usc.edu/brainstorm/Tutorials/TutExploreRecodings?action=AttachFile&do=get&target=colormapMax5.gif|colormapMax5.gif|class="attachment"}} ''Fig.1: [-max,max]; Fig.2: [min,max] '' == Colormap management == Remember that when you change any of the options above, it is saved in your user preferences. If you close Brainstorm and start it again, the colormap configuration stays the same. * '''Display colorbar''': Just in case you want to hide the color bar. * '''Permanent menu''': Open a window that displays this colormap sub-menu. Might be useful when you do a lot of colormap adjustments. * '''Restore defaults''': Click on it '''now '''so all your experiments will be discarded. * You can also reset the colormap by '''double-clicking on the color bar'''. <)>> <> <>