CANlab Visualization Walkthrough

July 6, 2026 · View on GitHub

A hands-on guide to visualizing brain data and results with the CanlabCore MATLAB tools — montages, 3‑D surfaces, the interactive display controller, colormaps, and atlases. Every section pairs runnable code with the figure it produces, and shows both the command-line commands and the equivalent controller (GUI) actions.

All examples use the bundled emotionreg sample dataset, so they run anywhere CanlabCore is installed:

obj = load_image_set('emotionreg', 'noverbose');
t   = threshold(ttest(obj), .05, 'unc');

Contents

1. Getting started

The object classes you'll display (fmri_data, statistic_image, region, atlas, fmridisplay), loading data, quick QC with plot, and a first interactive look with orthviews.

orthviews

2. Montages and slices

Publication slice arrays with canlab_results_fmridisplay (compact2, full, …), a close-up of every blob in its own axis (regioncenters), and blob customization — color, outline, transparency, overlaying maps.

full montage

3. Surfaces and 3‑D rendering

Cortical surfaces (foursurfaces), recoloring with render_on_surface, cutaways and coronal slabs, subcortical close-ups built with addbrain, and 3‑D isosurfaces from atlases and images.

surfaces subcortical

4. Colors and colormaps

The shared value→color pipeline: one colormap drives montages, surfaces, and the legend identically. Split / single / solid / continuous / indexed modes, and color limits (cmaprange) for comparable maps.

colormaps

5. The display controller

The interactive panel bound to an fmridisplay object — opacity, threshold, colormap, visibility, per layer — acting on montages and surfaces together, with a one-line command-line equivalent for every control.

controller

6. Atlases and regions

Parcellations in unique colors — regions and atlases on slices, on cortical surfaces, and as 3‑D subcortical isosurfaces — plus labeling your own results from an atlas.

atlas isosurface atlas surface


Two ways to work

Everything here can be done two ways, interchangeably:

  • From the command line — scriptable, reproducible, good for papers and pipelines.
  • From the display controller — an interactive panel for exploring thresholds, colors, and opacity, that echoes the equivalent code to the command window as you click.

Because fmridisplay is a handle class whose layers remember their source and options, both routes update every montage and surface of an object in place. Section 5 shows the correspondence in detail.

Reproducing the figures

Every figure in this walkthrough is produced by a single master script, _gen/visualization_walkthrough.m — one section per page (1.1, 1.2, … 6.5). Run it in MATLAB with CanlabCore (and, for the atlas sections, Neuroimaging_Pattern_Masks) on the path to regenerate every PNG in figures/, or copy any section as a starting point. The per-page generators (gen_02_montages.m, gen_03_surfaces.m, …) remain in _gen/ for regenerating one page at a time. All of them write via the helper wt_save.m.

See also