User Tools

Site Tools


biac:analysis:physiological

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
biac:analysis:physiological [2011/11/03 18:41]
petty [AFNI]
biac:analysis:physiological [2011/12/08 20:46]
petty [AFNI details]
Line 3: Line 3:
 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. 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'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.+===== physio_run.py ===== 
 +There is currently tool for running AFNI-based correction of functional image data using physiological data.  In the future it may support FSL-based correction.
  
-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.+<code> 
 +physio_run.py --help 
 +</code> 
 + 
 +<code> 
 +Usage:  
 +physio_run.py /path/to/run4.bxh /path/to/pdigm5_12345_4_2 OUTPUTPREFIX [ -f FORMAT ] 
 + 
 +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 
 +    OUTPUTPREFIX is the prefix for the physio-corrected output 
 +    FORMAT: what pipeline to use, only supports 'afni' for now (default) 
 + 
 +Options: 
 +  -h, --help            show this help message and exit 
 +  -f string, --format=string 
 +                        output format ( afni ) 
 +</code> 
 + 
 +''physio_run.py'' runs ''physio_create.py'' under the hood to write physiological data in the format AFNI requires (see below for how to run ''physio_create.py'' yourself to create data usable by FSL), and then runs various AFNI tools to actually create the physio-corrected image data. 
 + 
 +The outputs will be OUTPUTPREFIX.bxh, OUTPUTPREFIX.nii.gz, OUTPUTPREFIX_cardiac.txt and OUTPUTPREFIX_respiration.txt.  OUTPUTPREFIX.bxh can be used as the input for ''resting_pipeline.py''
 + 
 +===== physio_create.py ===== 
 + 
 +The underlying tool used by ''physio_run.py'' to create the regressors is ''physio_create.py'' It takes an input image 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" (physiological) data/regressors.  "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. The python tool will call cigal functions directly to do the corrections, then output new text data in the format requested.
Line 24: Line 53:
         - fsl = cardio,resp,TR pulse ( 3 column file )          - fsl = cardio,resp,TR pulse ( 3 column file ) 
         - npm = time,cardio,resp ( 3 column file )         - npm = time,cardio,resp ( 3 column file )
-        - afni = cardiac.txt, respiration.txt+        - afni = cardiac.txt, respiration.txt, script.m
  
  
Line 40: Line 69:
 </code> </code>
  
-===== AFNI =====+===== AFNI details ===== 
 + 
 +This section details the steps that the tool ''physio_run.py'' (described above) does for you automatically.
  
 Create the AFNI formated physiological text data. Create the AFNI formated physiological text data.
 <code bash>physio_create.py -b Data/Func/20111025_12345/run004.bxh -p Data/Behav/12345/pdigm5_12345_4_2 -f afni --hz 100 </code> <code bash>physio_create.py -b Data/Func/20111025_12345/run004.bxh -p Data/Behav/12345/pdigm5_12345_4_2 -f afni --hz 100 </code>
  
-This would create my "cardiac.txt" and "respiration.txt". +This would create my "cardiac.txt" and "respiration.txt", and a MATLAB script script.that will create the regressors, and has the following contents:
- +
-Now set-up build the regressors that will be used in afni with their matlab tool.+
  
 <code matlab> <code matlab>
Line 56: Line 85:
 Opt.Nslices = 34 Opt.Nslices = 34
 Opt.PhysFS = 100 Opt.PhysFS = 100
 +Opt.SliceOrder = 'alt+z'
 +%please choose the correct order if not running interleaved: **'alt+z'**/'alt-z'/'seq+z'/'seq-z'
  
 RetroTS(Opt) RetroTS(Opt)
 </code> </code>
  
-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.+The output of runnning the MATLAB script 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: Convert your data to 4D nifti if you haven't already done so:
Line 72: Line 103:
 <code bash>tcsh -xef proc.12345 |& tee output.proc.12345</code> <code bash>tcsh -xef proc.12345 |& tee output.proc.12345</code>
  
-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:+There will be a resulting folder with all the afni data inside.  You can convert the afni HEAD/BRIK to a nifti file, then proceed to whatever you're doing afterwards:
 <code bash> <code bash>
 #convert afni to nii, create bxh #convert afni to nii, create bxh
-3dAFNItoNIFTI 12345.results/pb02.12345.r01.ricor+orig.BRIK +bxh2analyze --niigz -s 12345.results/pb02.12345.r01.ricor+orig.BRIK physiocorrected
-fslwrapbxh pb02.12345.r01.ricor.BRIK+
 </code> </code>
  
 Run the resting state pipeline: Run the resting state pipeline:
-<code bash>resting_pipeline.py -f pb02.12345.r01.ricor.bxh -s 1,2,3,4,5,6,7 -p func --sliceorder odd</code>+<code bash>resting_pipeline.py -f physiocorrected.bxh -s 0,1,2,3,4,5,6,7 -p func --sliceorder odd</code>
  
  
biac/analysis/physiological.txt · Last modified: 2023/02/23 18:43 (external edit)