The CANlab Core Tools package

The CANlab Core Tools package is a set of Matlab functions that are designed to serve miscellaneous purposes. Many of them have stand-alone command line function, but the toolbox also contains functions that are used in other CANlab toolboxes, and so this package should be downloaded and put on the Matlab path when using any of the toolboxes.

Some functions are experimental/in development, and the toolbox is provided on an as-is basis, with no claims about quality or correctness expressed or implied.

Our vision is that the package will be developed into an extensible package that will allow developers and statisticians to create new tools and make them available to the community without rew-writing basic image manipulation and visualization code. We call this framework "statistical plug-in for neuroimaging analysis" (SPINN).

There are several general ways to use these tools stand-alone:

  1. A new set of object-oriented tools offers a command-line interface for working with fMRI data and other data types interactively.
  1. Many of the functions work by turning a brain image (.img or .nii) into a "clusters" structure, a vector of structures that stores information about a continuous activation 'blob'. You can turn a thresholded image (some values are zero or NaN) into a clusters structure using mask2clusters.m. Once you have done this, you can visualize, extract data, perform analyses, etc. on the clusters.
  2. You can run any analysis that you can run on a single voxel over the whole brain with image_eval_function and image_eval_function_multisubj.
  3. Another set of functions, with names beginning with iimg_*, works by turning one or more 3-D image files (.img or .nii) into a single-column vector per image file. This makes the images easier to work with. They can be converted to/from clusters structures or 3-D/4-D volumes. Functions exist for defining masks, extracting data, and other things.
  4. The toolbox also contains a number of miscellaneous statistical functions used in other toolboxes, and some stand-alone tools for cross-validation (xval_***).


There are a number of visualization functions for creating montages, brain surfaces, clickable 3-slice orthviews displays (thanks to SPM) and others. The documentation below gives a quick snapshot of some functions, but the tools are evolving and are necessarily incompletely documented (sorry!) Object-oriented tools have their own display/visualization methods as well.

For a quick guide to some figure types and code snippets that created them, see our figure gallery page.

Brain slices with activation blobs

cluster_orthviews.m : View 'clusters' in 3-view orthviews pane; many options


montage_clusters.m : View 'clusters' on slices cluster_orthviews_montage.m : Copy current image in orthviews pane to axial, sagittal, or coronal slices cluster_orthviews_showcenters.m : Montage plot of existing orthviews image with slices only at cluster (blob) centers

                                  montage_clusters_maxslice.m, montage_clusters_medial.m, montage_clusters_points.m, montage_clusters_text.m, montage_clusters_text2.m, montage_image_Worsley.m

iimg_multi_threshold : Multi-threshold application and orthview display of blobs in different colors

                                  multi_threshold.m, multi_threshold2.m

Basic bar/scatter plots

barplot_colored.m, barplot_columns.m, barplot_grouped.m, cluster_barplot.m barplotter.m : Jared Van Snellenberg's bar plot tool

plot_correlation_samefig.m : Scatterplot, with robust weights and other options logitScatter.m : logistic regression/logit fit

prplot.m : Partial regression scatterplot


tor_fill_steplot.m, fill_around_line.m : Line plots with shaded areas for standard error

3-D surfaces

addbrain.m : Add 3-D brain surface; activation clusters can be rendered onto this with cluster_surf cluster_surf.m: Render activation 'clusters' on existing or new surface

cluster_cutaways.m, cluster_surf_batch.m, cluster_surf_batch2.m, make_figure_into_orthviews.m

Multidimensional scaling figures

nmdsfig.m : MDS/NMDS figure, many options

                     nmdsfig_fill.m, nmdsfig_legend.m

Movie tools

movle_tools.m : Support for creating movies out of any figure movie_of_slice_timeseries.m, movie_stillframes.m

Misc. visualization

create_figure.m : Create/activate a figure with a particular tag.

scn_export_papersetup.m : Paper size setup for better saving of figures as png images cluster_image_sphere.m surf_plot_tor.m : fancy 3-D surface plot for any data (non-brain) conf_region.m : 3-D confidence region image_histogram.m : Histogram plots of a brain data image file (.img)

Colormap tools

colormap_tor.m, spm_orthviews_change_colormap.m, spm_orthviews_hotcool_colormap.m,

Basic line and design matrix plotting support

plotDesign.m, plot_horizontal_line.m, plot_matrix_cols.m, plot_model_fit.m, plot_parallel_coords.m, plot_vertical_line.m

Data extraction and preprocessing

help/core/can_core_tools.txt · Last modified: 2016/08/19 18:00 (external edit)
CC Attribution-Noncommercial-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0