Skip to content

Render brain with an overlay

fahsuanlin edited this page Apr 16, 2018 · 5 revisions

Render brain with an overlay

In neuroimaging studies, it is common to overlay some values over brain structures. Here we show how to do that with a few examples. Again, remember to set the environment variable SUBJECTS_DIR correctly before trying these examples.

Note: without the loss of generality, here we save values corresponding to different locations in a brain with the "stc" format, which was a format to store two-dimensional space (rows) x time (columns) values. Functions inverse_read_stc.m and inverse_write_stc.m are two means to read and write these values. You may use other file formats.

Note two example overlay value files render_example_overlay-lh.stc and render_example_overlay_stc-lh.stc can be downloaded from Google drive.

An image of overlay values

The overlay vales are fist loaded and then displayed. Here we set a threshold to display the overlay with value higher than 0.5 and no higher than 0.8.

[value_lh,v_lh]=inverse_read_stc('render_example_overlay-lh.stc');
etc_render_fsbrain('overlay_value',value_lh(:,1),'overlay_vertex',v_lh,'overlay_threshold',[0.5 0.8]);

Turn on and off a colorbar

Click the figure with key 'c' allows you to turn on and off the colorbar

Change the threshold

Click the figure with key 'd' allows you to change the threshold for displaying overlay values. After you press 'd', you need to supply two numbers (separated by a space or a comma) to set the lower and upper bound of the threshold. The following example change the threshold from [0.5 0.8] to [0.2 1.0]

Smooth overlay values

By defaults, overlay values are spatially smoothed by 5 iteration steps. Each iteration will average values of all brain locations in the vicinity of a brain location. The "vicinity" was defined by the vertices and faces of the 3D brain structural model.

You can change the number of smoothing steps by click "s" in the figure. Alternatively, you can also explicitly specify the smoothing step as the following:

etc_render_fsbrain('overlay_value',value_lh(:,1),'overlay_vertex',v_lh,'overlay_threshold',[0.5 0.8],'overlay_smooth',0);

The above example sets the number of smoothing step to 0, apply that no smoothing is applied. The result is that overlay values are visually coarser.

Values within a label

You can first load a list of labels from label files or an annotation file. Then click the area of your interest in the label list box. This area will be colored in the brain figure. Now as you click around the brain, values associated with the selected area (average, standard deviation, maximal value, and minimal value) will be reported.

The example below first load a label vtx-lh.label. (This label can be downloaded). After selecting it in the label list box, the average, standard deviation, maximal, and minimal overlay values in that region is reported.

Clone this wiki locally