This is an old revision of the document!
Table of Contents
Physiological Correction Methods
Currently this assumes that you have recorded your physiological responses through Cigal. Also, these types of corrections should be done before any type of slice-time correction or pre-processing.
There's a python program, than can take your run's bxh header along with your cigal pdigm file to create various types of corrected text files to be used for physio corrections in a number of different packages.
This tool uses various fields from the bxh and pdigm file to output “corrected” data. “Corrected” here means accounting for potential time-locking issues, different TR in the cigal recording verses the actual data acquisition, ddqs, etc.
The python tool will call cigal functions directly to do the corrections, then output new text data in the format requested.
physio_create.py --help
physio_create.py --bxh /path/to/run4.bxh --pdigm /path/to/pdigm5_12345_4_2 -f fsl --outpath /here/ Program to produce formatted physiological data: Data will be corrected and recreated from the pdigm file based on information from run data BXH and PDIGM required OUTPATH defaults to PWD FORMAT: defaults to fsl - fsl = cardio,resp,TR pulse ( 3 column file ) - npm = time,cardio,resp ( 3 column file ) - afni = cardiac.txt, respiration.txt Options: -h, --help show this help message and exit -b FILE, --bxh=FILE bxh file for run -p FILE, --pdigm=FILE pdigm file for run -f string, --format=string output format ( fsl,npm,afni ) -o PATH, --outpath=PATH location to store output files
AFNI
Create the AFNI formated physiological text data.
physio_create.py -b Data/Func/20111025_12345/run004.bxh -p Data/Behav/12345/pdigm5_12345_4_2 -f afni
This would create my “cardiac.txt” and “respiration.txt”.
Now set-up build the regressors that will be used in afni with their matlab tool.
addpath /usr/local/packages/MATLAB/afni/ Opt.Respfile = '/path/to/respiration.txt' Opt.Cardfile = '/path/to/cardiac.txt' Opt.VolTR = 1.5 Opt.Nslices = 34 Opt.PhysFS = 100 RetroTS(Opt)
The output will be “oba.slibase.1D”, which is a text file containing regressors to remove from your data on a slice-by-slice basis.
Convert your data to 4D nifti if you haven't already done so:
bxh2analyze --niigz -s input.bxh run004
Create the afni script which you will use to actually run the 3dretroicor functionality:
afni_proc.py -subj_id 12345 -dsets run004.nii.gz -blocks despike -do_block ricor -tcat_remove_first_trs 0 -ricor_regs *.slibase.1D -ricor_regs_nfirst 0 -ricor_regre ss_method 'per-run'
The result of the above command would be a tcsh script, which would run the despiking and 3dretroicor correction only. Run it:
tcsh -xef proc.12345 |& tee output.proc.12345
There will be a resulting folder with all the afni data inside. You can convert the afni BRIK to a nifti file, then wrap it with a BXH, then proceed to whatever you're doing afterwards:
#convert afni to nii, create bxh 3dAFNItoNIFTI 12345.results/pb02.12345.r01.ricor+orig.BRIK fslwrapbxh pb02.12345.r01.ricor.BRIK
Run the resting state pipeline:
resting_pipeline.py -f pb02.12345.r01.ricor.bxh -s 1,2,3,4,5,6,7 -p func --sliceorder odd
FSL Feat
We've gotten the FSL beta functions for physiological correction, which we'll test.
They are based on the same algorithms used in afni with retroicor. Once things are functioning, they'll be installed on the cluster.
More information can be seen here: http://www.fmrib.ox.ac.uk/Members/jon/physiological-noise-correction
The beta options will allow you to plug in the resulting regressors directly into Feat. After pre-processing you can use the res4d.nii.gz files for further analysis ( filtered_func_data would not have the physio regressor removed ).