Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

PhysIO

Example workflow for the PhysIO Toolbox

This tutorial was created by Lars Kasper.

Github: @mrikasper

Twitter: @mrikasper

Getting Set Up with Neurodesk

Origin

The PhysIO Toolbox implements ideas for robust physiological noise modeling in fMRI, outlined in this paper:

  1. Kasper, L., Bollmann, S., Diaconescu, A.O., Hutton, C., Heinzle, J., Iglesias, S., Hauser, T.U., Sebold, M., Manjaly, Z.-M., Pruessmann, K.P., Stephan, K.E., 2017. The PhysIO Toolbox for Modeling Physiological Noise in fMRI Data. Journal of Neuroscience Methods 276, 56-72. Kasper et al. (2017)

PhysIO is part of the open-source TAPAS Software Package for Translational Neuromodeling and Computational Psychiatry, introduced in the following paper:

  1. Frässle, S., Aponte, E.A., Bollmann, S., Brodersen, K.H., Do, C.T., Harrison, O.K., Harrison, S.J., Heinzle, J., Iglesias, S., Kasper, L., Lomakina, E.I., Mathys, C., Müller-Schrader, M., Pereira, I., Petzschner, F.H., Raman, S., Schöbi, D., Toussaint, B., Weber, L.A., Yao, Y., Stephan, K.E., 2021. TAPAS: an open-source software package for Translational Neuromodeling and Computational Psychiatry. Frontiers in Psychiatry 12, 857. Frässle et al. (2021)

Please cite these works if you use PhysIO and see the FAQ for details.

Neurodesk offers the possibility of running PhysIO without installing MATLAB or requiring a MATLAB license. Debugging and extending the toolbox require the MATLAB version. Current source code is hosted in the PhysIO repository.

More general information about PhysIO is available in the README.

Purpose

The general purpose of the PhysIO toolbox is model-based physiological noise correction of fMRI data using peripheral measures of respiration and cardiac pulsation (respiratory bellows, ECG, pulse oximeter/plethysmograph).

It incorporates noise models of

While the toolbox is particularly well integrated with SPM via the Batch Editor GUI, its output text files can be incorporated into any major neuroimaging analysis package for nuisance regression, e.g., within a GLM.

Core design goals for the toolbox were: flexibility, robustness, and quality assurance to enable physiological noise correction for large-scale and multi-center studies.

Some highlights:

The accompanying technical paper about the toolbox concept and methodology can be found at: Kasper et al. (2017)

Download Example Data

This walkthrough uses the official PhysIO examples v9.1.0 archive on Zenodo. This version was tested with Neurodesk’s physio/r2021a container in October 2026.

  1. Open Firefox inside the Neurodesk desktop and visit the archive page.

  2. Under Files, click Download (1). The archive is about 38.5 MB.

Download the official PhysIO examples archive: click Download under Files
  1. Open Downloads in the file manager, right-click the downloaded ZIP and select Extract Here.

  2. Rename the extracted ComputationalPsychiatry-PhysIO-Examples-9343a40 folder to physio-demo and move it into ~/neurodesktop-storage/.

  3. Open physio-demo/Philips/ECG3T/. It should contain SCANPHYSLOG.log, rp_fMRI.txt and the philips_ecg3t_* scripts and batch files.

Copy your own data

Example: Running PhysIO in the GUI

Start SPM

In the bottom-left Applications menu, select Neurodesk (1) → Functional Imaging (2) → physio (3) → physioGUI r2021a (4).

Follow the four numbered menu choices to open PhysIO

If the menu does not open SPM, open LXTerminal from the desktop panel and enter these two commands, one at a time:

ml physio/r2021a
spm12 fmri

Wait for the SPM windows to appear. This command selects fMRI mode directly. The remaining steps use the SPM GUI.

Select the working directory

  1. In SPM’s main Menu window, open Utils… (1) and choose CD (2).

SPM main menu: open Utils, then choose CD
  1. Navigate to ~/neurodesktop-storage/physio-demo/Philips/ using the left-hand directory list. In the right-hand list, click ECG3T, then Done. The selected directory appears in the box at the bottom before you click Done.

The batch uses relative input paths, so SPM must be working in the folder containing SCANPHYSLOG.log and rp_fMRI.txt.

Load and run the batch

  1. Click Batch (1) in SPM’s main Menu window.

Open Batch Editor using the Batch button
  1. In Batch Editor, choose File → Load Batch, or click the open-folder icon (1 in the next screenshot).

  2. Select philips_ecg3t_spm_job.m, then Done. Wait for TAPAS PhysIO Toolbox to appear in the Module List. The corresponding .mat file is also supplied; do not select philips_ecg3t_matlab_script.m.

  3. Leave the example parameters unchanged. save_dir is physio_out, a subfolder of the selected working directory.

  4. Click the green Play button (2).

Loaded PhysIO batch: open-folder icon and green Play button

Several quality-control figures open during processing. The final figure is Model: RETROICOR GLM regressors, showing the nuisance regressor matrix. Maximize this figure to see all scan rows and regressor labels.

PhysIO nuisance regressor matrix from the Philips ECG3T example

The tested example produced physio_out/multiple_regressors.txt with 495 rows and 24 columns, plus physio.mat and saved quality-control figures. If the final matrix does not appear, check the terminal associated with SPM for errors. For missing input files, check the working directory and the paths under log_files and the movement-regressor settings in Batch Editor.

To create a new batch from scratch, use SPM → Tools → TAPAS PhysIO Toolbox in Batch Editor. Loading the supplied example already creates this module.

Further Info on PhysIO

Please check out the README and FAQ.

References
  1. Kasper, L., Bollmann, S., Diaconescu, A. O., Hutton, C., Heinzle, J., Iglesias, S., Hauser, T. U., Sebold, M., Manjaly, Z.-M., Pruessmann, K. P., & Stephan, K. E. (2017). The PhysIO Toolbox for Modeling Physiological Noise in fMRI Data. Journal of Neuroscience Methods, 276, 56–72. 10.1016/j.jneumeth.2016.10.019
  2. Frässle, S., Aponte, E. A., Bollmann, S., Brodersen, K. H., Do, C. T., Harrison, O. K., Harrison, S. J., Heinzle, J., Iglesias, S., Kasper, L., Lomakina, E. I., Mathys, C., Müller-Schrader, M., Pereira, I., Petzschner, F. H., Raman, S., Schöbi, D., Toussaint, B., Weber, L. A., … Stephan, K. E. (2021). TAPAS: An Open-Source Software Package for Translational Neuromodeling and Computational Psychiatry. Frontiers in Psychiatry, 12. 10.3389/fpsyt.2021.680811