PhysIO Toolbox

The PhysIO Toolbox can be downloaded as part of the TAPAS software collection of the TNU.


The general purpose of this toolbox is the model-based physiological noise correction of fMRI data using peripheral measures of respiration and cardiac pulsation. A comprehensive description of the toolbox can be found in the remainder of this article and in the accompanying quick start manual and handbook.

Current Version: r671 (February 2nd, 2015)

(Code | Examples | GettingStarted | Handbook)

New features include:

  • SPM Batch Editor GUI implemented (Call via Batch -> SPM -> Tools -> TAPAS PhysIO Toolbox)
  • Read-in of physiological logfiles from all major vendors: Siemens, GE, Philips, Brain Voyager
  • Improved, automatic heartbeat detection for noisy ECG now standard for ECG and Pulse oximetry (courtesy of Steffen Bollmann)
  • Compatibility tested for SPM12, Matlab R2014b, small bugfixes Batch Dependencies
  • New model: ‘none’ to just read out physiological raw data and preprocess,
    without noise modelling
  • Cardiac and Respiratory response function regressors integrated in workflow (heart rate and breathing volume computation)




The PhysIO Toolbox provides physiological noise correction for fMRI-data from peripheral measures (ECG/pulse oximetry, breathing belt). It is model-based, i.e. creates nuisance regressors from the physiological monitoring that can enter a General Linear Model (GLM) analysis, e.g. SPM8.
Furthermore, for PHILIPS SCANPHYSLOG logfiles, it provides means to statistically assess peripheral data (e.g. heart rate variability) and recover imperfect measures (e.g. distorted R-peaks of the ECG).

Facts about physiological noise in fMRI

  • Physiological noise can explain 20-60 % of variance in fMRI voxel time series (Birn2006, Hutton2011, Harvey2008).
    • Physiological noise affects a lot of brain regions (s. figure, e.g. brainstem or OFC), especially next to CSF, arteries (Hutton2011).
    • If not accounted for, this is a key factor limiting sensitivity for effects of interest.
  • Physiological noise contributions increase with field strength; they become a particular concern at and above 3 Tesla (Kasper2009, Hutton2011).
  • In resting state fMRI, disregarding physiological noise may lead to differing connectivity results (Birn2006).

→ Some kind of physiological noise correction is highly recommended for every statistical fMRI analysis.

Model-based correction of physiological noise

  • Physiological noise can be decomposed into periodic time series following heart rate and breathing cycle.
  • The Fourier expansion of cardiac and respiratory phases was introduced as RETROICOR (RETROspective Image CORrection, Glover2000, see also Josephs1997).
  • These Fourier Terms can enter a General Linear Model (GLM) as nuisance regressors, analogous to movement parameters.
  • As the physiological noise regressors augment the GLM and explain variance in the time series, they increase sensitivity in all contrasts of interest.


Features of this Toolbox

Physiological Noise Modeling

  • Modeling physiological noise regressors from peripheral data (breathing belt, ECG, pulse oximeter)
  • State of the art RETROICOR cardiac and respiratory phase expansion
  • Cardiac response function (Chang et al, 2009) and respiratory response function (Birn et al. 2006) modelling of heart-rate variability and respiratory volume per time influence on physiological noise
  • Flexible expansion orders to model different contributions of cardiac, respiratory and interaction terms (see Harvey2008, Hutton2011)
  • Automatic creation of nuisance regressors, full integration into standard GLMs, tested for SPM8 (“multiple_regressors.mat”)

Philips SCANPHYSLOG-file handling

The toolbox is dedicated to seamless integration into a clinical research setting and therefore offers correction methods to recover physiological data from imperfect peripheral measures. For Philips SCANPHYSLOG-files, this includes

  • Automatic alignment of scan volume timing and physiological time series from logged gradient timecourses
  • Automatic detection of ECG-R-peak events from raw ECG-signal, even if online detection (and logging) was unsuccessful

General Electric (GE)-file handling

There is now also a test implementation of reading physiological logfiles from GE, i.e. ECGData*- and RespData*-files. We are developing this feature in collaboration with colleagues from the Children’s Hospital Zurich.

Siemens logfile and Tics-logfile handling

Together with colleagues from Charite Berlin and the MPI in Cologne, we are currently testing an implementation of the logfile readin for classical Siemens physiology recording and the new Tics-based logging of e.g. the new 3T Prisma system. It works on our test cases, but other systems might be different. So, please try out this feature and let us know about your experience.

Compatibility and Support

  • Matlab Toolbox
  • Input: Fully integrated to work with physiological logfiles of Philips MR systems (SCANPHYSLOG)
    • also: Beta-Version for reading physiological logfiles of General Electric (GE) MR systems and Siemens logfiles
    • plus: interface for general heart-beat time stamps & breathing volume time courses from other log formats (e.g. Brain Voyager)
  • Output: Nuisance regressors for mass-univariate statistical analysis with SPM5,8,12
  • Part of the TNU Software Edition: long term support and ongoing development


Downloads & Release Information

Current Release

Download of the code as part of the TAPAS software collection of the TNU.

Stable Releases and Example Data

PhysIO Toolbox 15
(Code | Examples | GettingStarted | Handbook)

revision: $Revision: 671 $
February 2nd, 2015

Release Notes:

Minor Release Notes (r665):

  • Compatibility tested for SPM12, small bugfixes Batch Dependencies
  • Cleaner Batch Interface with grouped sub-menus (cfg_choice)
  • New model: ‘none’ to just read out physiological raw data and preprocess,
    without noise modelling
  • Philips: Scan-timing via gradient log now automatized (gradient_log_auto)
  • Siemens: Tics-Logfile read-in (proprietary, needs Siemens-agreement)
  • All peak detections (cardiac/respiratory) now via auto_matched algorithm
  • Adapt plots/saving for Matlab R2014b

PhysIO Toolbox 14
August 28th, 2014

Release Notes:

Major Release Notes (r534):

    • Read-in of Siemens plain text log files; new example dataset for Siemens
    • Speed up and debugging of ‘auto’-detection method for noisy cardiac data => new method thresh.cardiac.initial_cpulse_select.method = ‘auto_matched’
    • Error handling for temporary breathing belt failures (Eduardo Aponte, TNU Zurich)
    • slice-wise regressors can be created by setting sqpar.onset_slice to a index vector of slices

Major Release Notes (r497):

      • SPM matlabbatch GUI implemented (Call via Batch -> SPM -> Tools -> TAPAS PhysIO Toolbox)
      • improved, automatic heartbeat detection for noisy ECG now standard for ECG and Pulse oximetry (courtesy of Steffen Bollmann)
      • QuickStart-Manual and PhysIO-Background presentation expanded/updated
      • job .m/.mat-files created for all example datasets
      • bugfixes cpulse-initial-select method-handling (auto/manual/load)

PhysIO Toolbox 14a
February 26th, 2014

Release Notes:
Major Release Notes (r429):

      • Cardiac and Respiratory response function regressors integrated in workflow (heart rate and breathing volume computation)
      • Independent handling of Cardiac and Respiratory Logfiles
      • Expanded documentation (Quickstart.pdf and Handbook.pdf)
      • Read-in of custom log files, e.g. for BrainVoyager peripheral data
      • More informative plots and commenting (especially in tapas_physio_new)

Minor Release Notes (r354):
– computation of heart and breathing rate in Philips/PPU/main_PPU.m
– prefix of functions with tapas_*

PhysIO Toolbox 13 (Code| Examples)
May 10th, 2013

revision: 183

The TNU CheckPhysRETROICOR Toolbox has been vastly improved and renamed to PhysIO Toolbox.

Release Notes:

      • complete modularization of readin/preprocessing/regressor creation for peripheral physiological data
      • manual selection of missed heartbeats in ECG/pulse oximetry (courtesy of Jakob Heinzle, TNU Zurich)
      • support for logfiles from GE scanners (courtesy of Steffen Bollmann, KiSpi Zurich)
      • improved detection of pulse oximetry peaks (courtesy of Steffen Bollmann, KiSpi Zurich)
      • improved documentation
      • consistent function names (prefixed by “physio_”)


CheckPhysRETROICOR_13 (Code | Examples)
March 6th, 2013

revision: 168

NOTE: Your main_ECG/PPU.m etc. scripts from previous versions will not work with this one any more. Please adapt one of the example scripts for your needs (~5 min of work). The main benefit of this version is a complete new variable structure that is more sustainable and makes the code more readible.

Release Notes:

      • Complete re-design of function interfaces to disentangle up logfile- (and vendor-) specific code from general purpose functions for SPM usage
      • Support for General Electric (GE) read-in of physiological logfiles
      • GPL 3.0 license


CheckPhysRETROICOR_13 (Code | Examples)
February 11th, 2013

revision: 159

Release Notes:

      • slice timing can be created without gradient logging from nominal values in sqpar


CheckPhysRETROICOR_12 (CodeExamples)
December 3rd, 2012

revision: 156

Release Notes:

      • ECG-Trigger example
      • Updated Manual



Lead Programmer: Lars Kasper

Send bug reports and suggestions to:


      • Download zip-file(s) and extract archive (e.g. using the free software 7-zip)
        • If you download the examples, make sure to put the code-directory and the examples-directory as separate subfolders of the same Toolbox path (default: CheckPhysRETROICOR)
      • Run main_ECG3T.m in subdirectory “examples” of the toolbox
      • See subdirectory “manual”



Birn, Rasmus M., Jason B. Diamond, Monica A. Smith, and Peter A. Bandettini. 2006. “Separating Respiratory-variation-related Fluctuations from Neuronal-activity-related Fluctuations in fMRI.” NeuroImage 31 (4) (July 15): 1536–1548. doi:10.1016/j.neuroimage.2006.02.048.

Birn, R.M., Smith, M.A., Jones, T.B., Bandettini, P.A., 2008. The respiration response function: The temporal dynamics of fMRI signal fluctuations related to changes in respiration. NeuroImage 40, 644–654. doi:10.1016/j.neuroimage.2007.11.059

Chang, C., Cunningham, J.P., Glover, G.H., 2009. Influence of heart rate on the BOLD signal: The cardiac response function. NeuroImage 44, 857–869. doi:10.1016/j.neuroimage.2008.09.029

Glover, G H, T Q Li, and D Ress. 2000. “Image-based Method for Retrospective Correction of Physiological Motion Effects in fMRI: RETROICOR.” Magnetic Resonance in Medicine: Official Journal of the Society of Magnetic Resonance in Medicine / Society of Magnetic Resonance in Medicine 44 (1) (July): 162–7. Moneygram en ligne doi:10893535.

Harvey, Ann K., Kyle T.S. Pattinson, Jonathan C.W. Brooks, Stephen D. Mayhew, Mark Jenkinson, and Richard G. Wise. 2008. “Brainstem Functional Magnetic Resonance Imaging: Disentangling Signal from Physiological Noise.” Journal of Magnetic Resonance Imaging 28 (6): 1337–1344. doi:10.1002/jmri.21623.

Hutton, C., O. Josephs, J. Stadler, E. Featherstone, A. Reid, O. Speck, J. Bernarding, and N. Weiskopf. 2011. “The Impact of Physiological Noise Correction on fMRI at 7 T.” NeuroImage 57 (1) (July 1): 101–112. doi:10.1016/j.neuroimage.2011.04.018.

Josephs, O., Howseman, A.M., Friston, K., Turner, R., 1997. “Physiological noise modelling for multi-slice EPI fMRI using SPM.” Proceedings of the 5th Annual Meeting of ISMRM, Vancouver, Canada, p. 1682

Kasper, Lars, Sarah Marti, S. Johanna Vannesjö, Chloe Hutton, Ray Dolan, Nikolaus Weiskopf, Klaas Enno Stephan, and Klaas Paul Prüssmann. 2009. “Cardiac Artefact Correction for Human Brainstem fMRI at 7 Tesla.” In Proc. Org. Hum. Brain Mapping 15, 395. San Francisco.