CANlab neuroimaging analysis tools
The CANlab imaging analysis tools are a set of linked Github repositories that enable interactive analysis of fMRI and other neuroimaging data using objects with simple methods (commands) customized for neuroimaging. Take preprocessed data or single-subject results, load them into lightweight data objects, and explore with commands like plot, predict, montage, and surface.
New here? Start with the Setup page and the Quick-start walkthrough. Looking for something specific? Try the search page.
Interactive brain viewer
Results objects render to a portable, self-contained web viewer with one command — canlab_niivue(t). Try it below: switch layouts, recolor with the Colormap menu, outline the region at the crosshair with Atlas region, raise the Threshold, fade layers, and click to move the crosshair (its MNI coordinate, value, and atlas region print below the image).
One-sample t-test on the CANlab emotionreg sample dataset (p < .005 uncorrected, k ≥ 10), warm/cool blobs over a 2 mm MNI underlay. If the frame is blank, open the demo directly. See the NiiVue viewer guide.
Repositories
The tools are distributed across linked GitHub repositories. CanlabCore and Neuroimaging_Pattern_Masks are the foundation and are meant to be used together — the core object-oriented code plus the masks, signature patterns, and meta-analysis maps it operates on.
| Core repository | Description |
|---|---|
| CanlabCore | Object-oriented fMRI analysis tools used across all other toolboxes |
| Neuroimaging_Pattern_Masks | Masks, predictive signature patterns, atlases, and meta-analysis maps |
Additional toolboxes are semi-stand-alone but require CanlabCore:
| Toolbox | Description |
|---|---|
| M3 Multilevel Mediation Toolbox | Single- and multi-level mediation for any data type, including brain images |
| CANlab Robust Regression Toolbox | Robust regression for 2nd-level (group) analysis |
| MKDA Coordinate-Based Meta-Analysis Toolbox | Coordinate-based meta-analysis and multivariate tools |
| CANlab_help_examples | Walkthroughs and the 2nd-level batch-script system |
Other CANlab repositories contain code and data for experiments and procedures:
| Repository | Description |
|---|---|
| Paradigms_Public | Experimental paradigms |
| FMRI_simulations | Brain movies, effect-size and power analyses |
| CANlab_data_public | Published datasets |
| DCC | Martin Lindquist’s dynamic correlation toolbox |
| CanlabScripts | In-lab Matlab / Python / bash utilities |
Why interactive analysis?
Much of neuroimaging has moved toward standardized pipelines — an essential foundation. But discovery also requires exploring data: visualizing it in many ways, understanding its quirks and outliers, and adapting analyses to the question at hand. The CANlab toolboxes were built for this. They provide a high-level language for neuroimaging data, so complex operations become single, readable commands. Some values we aspire to:
- Interactivity & transparency — cross-validated multivariate prediction, surface/slice rendering, and results tables are each one command. A basic group analysis, including publication-quality figures and tables, takes about five lines of readable code.
- Reproducibility & fewer errors — simple, shared commands are easy to reproduce, and core object code is re-used and vetted across analyses and users. Executable walkthroughs and unit tests check that core functions still produce expected results.
- Efficiency — a batch system runs standard QC and analyses and saves date-stamped HTML reports with figures and statistics, good for archiving, sharing, and writing papers.
- Extensibility — the object framework is extensible: images are stored in a flat, space-efficient
voxels × imagesmatrix familiar to data scientists, and core code handles rendering results back into brain space with anatomical labeling.
For the full rationale — the object model, storage design, and how new methods plug in — see the Interactive fMRI analysis page.
Core objects
Interactive analysis is organized around a small set of objects with simple, high-level methods. Click a class for its full documentation.
| Object | Description |
|---|---|
fmri_data | The workhorse: holds images plus metadata; most analysis methods (predict, regress, ica, ttest) live here |
statistic_image | Statistic maps (t / p / effect size) with thresholding state |
atlas | Brain atlases / parcellations with labels and probability maps |
region | Data grouped by contiguous cluster / ROI as a unit of analysis |
fmri_surface_data | New. CIFTI-style cortical-surface / grayordinate data — native CIFTI/GIFTI, no external toolbox |
fmridisplay | Container for slice/surface figure handles, for layered visualization |
glm_map | New. scikit-learn-style estimator for first- and second-level GLM / regression |
predictive_model | New. A fitted multivariate prediction model and its artifacts |
See the Object methods index for the complete class list, and the Docs page for all references, workflows, and visualization guides.
Learn more
- Interactive fMRI analysis — the philosophy, object model, and a simple analysis flow.
- Docs — object references, workflows, visualization guides, walkthroughs, and tutorials.
- Walkthroughs — step-by-step, runnable analyses.
- Setup — install the toolboxes and dependencies.
Issues and bugs
Please raise issues or document errors on the CANlab Github page.
