Scroll to navigation

glm(1) The Computational Morphometry Toolkit glm(1)


glm - General Linear Model


glm [options] ctlfile imgfile_pattern [ctlfile imgfile_pattern ...]


Statistical modeling of pixel intensities in multiple images using a General Linear Model.

The independent variables of the model are defined in one of more control files. Each control file is a text file with one whitespace-separated column per independent variable.

The first line of the control file defines the variable names, i.e., the labels that identify each variable. Each following line contains one value per independent variable.


ID age sex
01 20 0
02 30 1

Each control file name is followed by a file name pattern. In that pattern, a single '%s' place holder is replaced by the value found in the first column of each control file row. The resulting string is the path of the image read and associated with the model variables listed on that particular control file line.

Using the above control file example, the pattern 'images/subject%s.nii' would expand to the image file names 'images/subject01.nii' and 'images/subject02.nii'.

Multiple control files can be used, each with a different image file pattern.


Global Toolkit Options (these are shared by all CMTK tools)

Write list of basic command line options to standard output.
Write complete list of basic and advanced command line options to standard output.
Write list of command line options to standard output in MediaWiki markup.
Write man page source in 'nroff' markup to standard output.
Write toolkit version to standard output.
Write the current command line to standard output.
Set verbosity level.
Increment verbosity level by 1 (deprecated; supported for backward compatibility).
Set maximum number of parallel threads (for POSIX threads and OpenMP).

Input Settings

To save space/time, crop images: x0,y0,z0,x1,y1,z2

Model Settings

Normalize model parameters w.r.t. data variances.
Use exponential model rather than linear model.

Selection of Independent Variables

Exclude automatic constant parameter from model.
Ignore parameter with given NUMBER (0..n-1). Can be repeated.
Select parameter with given NAME for model. Can be repeated.

Output Settings

Filename pattern for output.

%s is replaced with image type ('fstat', 'tstat', or 'param')
%d is replaced with independent variable number (0 for entire model)
%s is replaced with independent variable name ('model' for entire model)

[Default: model_%s_%02d_%s.nii ]


Torsten Rohlfing, with contributions from Michael P. Hasak, Greg Jefferis, Calvin R. Maurer, Daniel B. Russakoff, and Yaroslav Halchenko



Report bugs at


CMTK is developed with support from the NIAAA under Grant AA021697, National Consortium on Alcohol and Neurodevelopment in Adolescence (N-CANDA): Data Integration Component. From April 2009 through September 2011, CMTK development and maintenance was supported by the NIBIB under Grant EB008381.

Jun 6 2022 CMTK 3.3.1p2