User Tools

Site Tools


Displaying the motion-parameters of a subject


While SPM writes out the motion parameters into a text file, sometimes only the files remain (e.g. after pruning the folders). For such cases, the motion parameters can be retrieved from the Analyze files and re-displayed using the showspmrparams function.


This function reads motion parameters from the following files:

  • realigned (but not resliced!) Analyze/NIftI files
  • SPM's rp_*.txt files (which then does NOT contain the information of motion between runs!)


The usage is straight forward. Simply change into the folder where the run folders are located and execute the following command:

% only read from run folders with "attention" in their name
% and read raw files (which begin with a capital letter S)
[f, rpf] = showspmrparams([pwd '/*attention*'], struct('source', 'S*.hdr'));


Next to the figure handle (in this example variable name f), the function also returns the motion parameters for further plotting or scripting commands such as max(rpf) - min(rpf) (which would give the peak-to-peak distance, a.k.a. as maximum motion in each of the six degrees of freedom).

The graphical output looks like this:

showspmrparams output with two runs and 200 volumes each

displaying_the_motion-parameters_of_a_subject.txt · Last modified: 2010/06/23 07:17 by jochen