PhysIO is a toolbox for model-based physiological noise correction of fMRI data.
PhysIO stands for Physiological Input/Output toolbox, which summarizes its core purpose. A quote from our paper:
In short, the toolbox transforms physiological input, i.e. peripheral recordings, into physiological output, i.e. regressors encoding components of physiological noise [...] A modular Matlab implementation supports command-line operation and is compatible with all major fMRI analysis packages via the export of regressor text-files. For the Statistical Parametric Mapping SPM software package in particular, PhysIO features a full integration as a Batch Editor Tool, which allows user-friendly, GUI-based setup and inclusion into existing preprocessing and modeling pipelines.
2. How does PhysIO differ from other toolboxes for physiological noise correction for fMRI using peripheral recordings?
Please cite this paper if you use PhysIO in your work. Moreover, this paper is also a good source for more information on PhysIO (see next question).
A standard snippet to include in your method section could look like the following, assuming you use our specific implementation of RETROICOR, which uses Fourier expansions of different order for the estimated phases of cardiac pulsation (3rd order), respiration (4th order) and cardio-‐respiratory interactions (1st order) following (Harvey et al., 2008)
Correction for physiological noise was performed via RETROICOR [1,2] using Fourier
expansions of different order for the estimated phases of cardiac pulsation (3rd order),
respiration (4th order) and cardio-‐respiratory interactions (1st order) : The
corresponding confound regressors were created using the Matlab PhysIO Toolbox (,
open source code available as part of the TAPAS software collection:
Glover, G.H., Li, T.Q. & Ress, D. Image-‐based method for retrospective correction
of PhysIOlogical motion effects in fMRI: RETROICOR. Magn Reson Med 44, 162-‐
Hutton, C. et al. The impact of PhysIOlogical noise correction on fMRI at 7 T.
NeuroImage 57, 101-‐112 (2011).
Harvey, A.K. et al. Brainstem functional magnetic resonance imaging:
Disentangling signal from PhysIOlogical noise. Journal of Magnetic Resonance
Imaging 28, 1337-‐1344 (2008).
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. doi:10.1016/j.jneumeth.2016.10.019
If you use respiratory‐volume-per time (RVT), heart-‐rate
variability (HRV), noise ROIs or 12/24 regressor motion modeling, also include the
Behzadi, Y., Restom, K., Liau, J., Liu, T.T., 2007. A component based noise
correction method (CompCor) for BOLD and perfusion based fMRI. NeuroImage 37,
Birn, R.M., Smith, M.A., Jones, T.B., Bandettini, P.A., 2008. The respiration response
function: The temporal dynamics of fMRI s ignal fluctuations related to changes in
respiration. NeuroImage 40, 644–654. doi:10.1016/j.neuroimage.2007.11.059
PhysIO Toolbox | Citing this work 20
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.
Siegel, J.S., Power, J.D., Dubis, J.W., Vogel, A.C., Church, J.A., Schlaggar, B.L.,
Petersen, S.E., 2014. Statistical improvements in functional magnetic resonance
imaging analyses produced by censoring high-motion data points. Hum. Brain Mapp.
35, 1981–1996. doi:10.1002/hbm.22307
4. Where do I find more documentation for PhysIO?
The paper describing its structure, objective and modules
5. I am using FSL, AFNI, BrainVoyager, etc., for my fMRI analyses. Do I need SPM for PhysIO to work?
No, the basic functionality of PhysIO, i.e. creating nuisance regressors for your GLM analysis, is available in plain Matlab. The following extra functionality related to automatizing and assessing noise correction, require the installation of SPM:
GUI (SPM Batch Editor)
Pipeline dependencies (automatic input of realignment parameters, feed-in of multiple regressors file to GLM)
Model assessment via F-tests and automatic F-map/tSNR report
Noise-ROIs model (read-in of nifti files via SPM)
6. I am using device X for physiological recordings. Does PhysIO support the physiological logfile format Y?
Currently, PhysIO natively supports the following physiological logfile types:
Furthermore, physiological recordings can be entered via a custom data format, i.e., providing one text file per device. The files should contain one amplitude value per line. The corresponding sampling interval(s) are provided as a separate parameter in the toolbox.
If your favourite logfile format is not supported, please contact the developers. We try everything to accomodate the read-in flexibility of the toolbox to your needs.
7. I am running the toolbox for a lot of subjects / on a remote server without graphics. Can I somehow reproduce the output figures relevant to assess the data quality?
Yes you can, using the toolbox function tapas_physio_review. This function takes the physio-structure as an input argument, which is per default saved as physio.mat in the specified output folder of your batch job.
8. How do I interpret the various output plots of the toolbox?
The figures there give a good overview of the toolbox output figures, in particular:
Fig. S1 (supplementary): Philips Scan Timing Sync from gradient_log (explanation of thresh.zero, thresh.sli, thresh.vol, thresh.vol_spacing
Fig. 3: Diagnostic Raw Time Series (cardiac cycle length curve, respiration histogram)
Fig. 8C: Single Subject F-contrast results (cardiac regressors)
Fig. 9: Group results/typical activation sites for F-contrasts of RETROICOR regressors (cardiac/resp/interaction)
9. I want to access subject's physiological measures, e.g. heart rate or respiratory volume (per time), before they enter the regressors. Where can I do that?
All intermediate data processing steps (e.g. filtering, cropping) of the peripheral data, including the computation of physiologically meaningful time courses, such as heart rate and respiratory volume, are saved in the substructure ons_secs ("onsets in seconds) of the physio-structure mentioned in question 7. This structure is typically saved in a file physio.mat.
physio.ons_secs then contains the different time courses, cropped to the acquisition window synchronized to your fMRI scan (the same values before synchronization/cropping, is found in physio.ons_secs.raw). Here are the most important ones:
ons_secs.t = ; % time vector corresponding to c and r
ons_secs.c = ; % raw cardiac waveform (ECG or PPU)
ons_secs.r = ; % raw respiration amplitude time course
ons_secs.cpulse = ; % onset times of cardiac pulse events (e.g. R-peaks)
ons_secs.fr = ; % filtered respiration amplitude time series
ons_secs.c_sample_phase = ; % phase in heart-cycle when each slice of each volume was acquired
ons_secs.r_sample_phase = ; % phase in respiratory cycle when each slice of each volume was acquired
ons_secs.hr = ; % [nScans,1] estimated heart rate at each scan
ons_secs.rvt = ; % [nScans,1] estimated respiratory volume per time at each scan
ons_secs.c_outliers_high = ; % onset of too long heart beats
ons_secs.c_outliers_low = ; % onsets of too short heart beats
ons_secs.r_hist = ; % histogram of breathing amplitudes
For a detailed list of all properties and their documentation, read the source code of tapas_physio_new.m
10. What is the order of the regressor columns in the multiple regressors file?
This depends on the physiological models (and their order) specified in the model-submodule of physio (or in the batch editor). The general order is outlined in Fig. 7A of the Main PhysIO Toolbox Paper. The -brackets indicate the number of regressors:
RETROICOR cardiac regressors [2 x nOrderCardiac]
RETROICOR respiratory regressors [2 x nOrderRespiratory]
RETROICOR cardXResp interaction regressors [4 x nOrderCardiacXRespiratory]
Noise ROIs (PCA signatures and mean of each region) [nNoiseROIs x (nComponents+1)]
Other (included other text file) [nColumnsOtherFile]
Motion [6 or 12 or 24, depending on motion model]
If any of the models was not specified, the number of regressors is reduced accordingly.
11. How do I know whether the physiological noise correction worked?
The best way to assess the quality of the correction is an F-test over the respective physiological noise model regressors in the design matrix. Luckily, if you use SPM, the toolbox can create these contrasts and corresponding output plots with overlays of your brain automatically via calling the following function in the Matlab command window:
Of course, you will have to adapt all paths to your SPM.mat, physio.mat and anatomy.nii files. There are more parameters to set (e.g. F-contrast thresholds), type help tapas_physio_report_contrasts for a list of options.
There should be whole-brain multiple-comparison corrected "activation" in physiological noise sites (similar to Fig. 8C or 9 in our paper.
If your F-contrast results differ or are absent, have a look at the Diagnostic raw physiological time series-plot and check whether it resembles Fig. 3 in the paper or whether there are any suspicious spikes in the heart cycle length.
Other than that, scan timing synchronisation is a major source of error, so always check the Cutout actual scans plot, whether the curves and scan events, TR etc. make sense.
12. Philips: I would like to use the gradient log for timing synchronization, but how do I set the thresholds?
Have a look at the following figure:
This figure can be found as figure S1 in the supplementary material of our paper.
The following heuristics might help with the threshold settings in the sync
Note that these thresholds have to be set correctly only once for each
functional sequence, i.e., usually once per study. Even small changes to scan
geometry (e.g. slice tilt) between subjects shouldn't affect them significantly.
Setting the thresholds is an iterative procedure. You might start with the
defaults, probably running into an error or warning (Warning: Invalid MinPeakHeight. There are no data points greater than MinPeakHeight. or Not enough volume/slice scan events found). Then you inspect the figure output
resembling the one above and adjust (usually lower) the thresholds in the
order mentioned below.
There are three time courses in the upper of the three subplots shown in the
figure. These time courses show the traces of the three gradient directions
x,y,z. Choose the one as sync.grad_direction parameter that has the
highest peaks and most regular features reflecting slice and/or volume scan
sync.zero has to be smaller than sync.slice and sync.vol. It should
be about 4/5 of the typical peak height in the gradient trace. Note that you can
set this thresholds (and all other) either in absolute values or relative to the
maximum peak height. Set a value below 1, if you prefer the latter.
sync.slice should be about 9/10 of the typical peak height of a slice scan
sync.vol, if you set it, should be larger than sync.slice. It should be
9/10 of the peak height that stands out at the beginning of a volume, and is
followed by some dozens of smaller peaks (for the slices) typically. It might
be, however, that there is no such peak marking the start of a volume. If so,
you might try sync.vol_spacing or leave it empty and rely on the slice
sync.vol_spacing, if set, should reflect the temporal spacing (in seconds),
between the end of the previous volume and the start of the next one. The figure
above gives some idea how to do that based on the bottom subplot that shows peak
onset differences. If once every few seconds (your TR) you find an exposed
peak, its height will give you the value for sync.vol_spacing (maybe reduce
it by about 5-10ms to allow for timing inaccuracies).
13. How do I know which logfile type ('vendor') I have to choose?
Typically, you will know your scanner manufacturer or the supplier of your peripheral recording device. The currently supported vendors can always be found in the SPM Batch Editor, as dropdown options for the vendor parameter in any PhysIO batch, and are also listed as cases in tapas_physio_read_physlogfiles.m.
For Siemens, since there are a couple of formats, it is often helpful to check the extensions of the files (or the file name structure in general) see question 7.
Sometimes you will have to look in the log files themselves and compare them to the examples provided on the Data Section of our homepage.
14. What does Parameter XY mean and what is its best setting?
Before you ask us directly, there are two simple ways to find out more about the parameters and options of the PhysIO toolbox:
In SPM, you can use the Batch Editor as a Help GUI directly. If you open or create a TAPAS PhysIO Batch and click on any parameter, there will be useful information about its meaning and suitable values in the help window, located in the lower part of the Batch Editor.
Within Matlab, type edit tapas_physio_new. This constructor function lists all parameters of the physio-structure with inline comments on their purpose and possible values.
15. I cannot find the answer to my question in the FAQ. Whom do I ask for help?
We are very happy to provide support on how to use the PhysIO Toolbox. However,
as every researcher, we only have a limited amount of time. So please excuse, if
we might not provide a detailed answer to your request, but just some general
pointers and templates. Before you contact us, please try the following:
A first look at the FAQ
(which is frequently extended) might already answer your questions.