User Tools

Site Tools


biac:analysis:resting_pipeline

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
biac:analysis:resting_pipeline [2012/07/09 18:57]
admin [Python/FSL Resting State Pipeline]
biac:analysis:resting_pipeline [2023/02/23 18:43] (current)
Line 17: Line 17:
     4 - normalize data     4 - normalize data
     5 - regress out WM/CSF     5 - regress out WM/CSF
-    6 - lowpass filter+    6 - bandpass filter
     7 - do parcellation and produce correlation matrix from label file     7 - do parcellation and produce correlation matrix from label file
       * or split it up:       * or split it up:
Line 25: Line 25:
               --corrts overrides default location for input parcellation               --corrts overrides default location for input parcellation
               results (outputpath/corrlabel_ts.txt)]               results (outputpath/corrlabel_ts.txt)]
 +    8 - functional connectivity density mapping
 +
  
  
Line 33: Line 35:
   --throwaway=4         number of timepoints to dis-regard from beginning of   --throwaway=4         number of timepoints to dis-regard from beginning of
                         run                         run
 +  --t1=/path/to/BXH     bxh ( or nifti ) file for the anatomical T1
   -p func, --prefix=func   -p func, --prefix=func
-                        prefix for all resulting images, defaults to name of                        +                        prefix for all resulting images, defaults to name of
                         input                         input
-  --t1=/path/to/BXH     bxh ( or nifti ) file for the anatomical T1 
   -s 0,1,2,3, --steps=0,1,2,3   -s 0,1,2,3, --steps=0,1,2,3
                         comma seperated string of steps. 'all' will run                         comma seperated string of steps. 'all' will run
Line 45: Line 47:
                         (1,3,5,2,4,6), up=ascending, down=descending,                         (1,3,5,2,4,6), up=ascending, down=descending,
                         even=interleaved (2,4,6,1,3,5) ).  Default is to read                         even=interleaved (2,4,6,1,3,5) ).  Default is to read
-                        this from input image, if available.+                        this from input BXH, if available.
   --tr=MSEC             TR of functional data in MSEC   --tr=MSEC             TR of functional data in MSEC
   --ref=FILE            pointer to FLIRT reference image if not using standard   --ref=FILE            pointer to FLIRT reference image if not using standard
Line 54: Line 56:
                         standard brain                         standard brain
   --refcsf=FILE         pointer to CSF mask of reference image if not using   --refcsf=FILE         pointer to CSF mask of reference image if not using
 +                        standard brain
 +  --refgm=FILE          pointer to GM mask of reference image if not using
                         standard brain                         standard brain
   --refbrainmask=FILE   pointer to brain mask of reference image if not using   --refbrainmask=FILE   pointer to brain mask of reference image if not using
Line 61: Line 65:
                         brain                         brain
   --betfval=0.4         f value to use while skull stripping. default is 0.4   --betfval=0.4         f value to use while skull stripping. default is 0.4
-  --anatbetfval=0.5     f value to use while skill stripping ANAT. default is 0.5+  --anatbetfval=0.5     f value to use while skull stripping ANAT. default is 
 +                        0.5
   --lpfreq=0.08         frequency cutoff for lowpass filtering in HZ.  default   --lpfreq=0.08         frequency cutoff for lowpass filtering in HZ.  default
-                        is .08hz+                        is .08hz.  highpass is fixed at .001hz.
   --corrlabel=FILE      pointer to 3D label containing ROIs for the   --corrlabel=FILE      pointer to 3D label containing ROIs for the
                         correlation search. default is the 116 region AAL                         correlation search. default is the 116 region AAL
Line 92: Line 97:
                         If --dvarsthreshold is specified, then                         If --dvarsthreshold is specified, then
                         --dvarsnumnumneighbors specifies how many neighboring                         --dvarsnumnumneighbors specifies how many neighboring
 +                        volumes, before and after the initially excluded
 +                        volumes, should also be excluded.  Default is 0.
 +  --fdthreshold=THRESH  If specified, this reprsents a FD threshold in mm.
 +                        Any volume contributing to a FD value greater than
 +                        this threshold will be excluded ("scrubbed") from the
 +                        (final) correlation step.  FD calculation is performed
 +                        on the results of the last pre-processing step, and is
 +                        calculated as described by Power, J.D., et al.,
 +                        "Spurious but systematic correlations in functional
 +                        connectivity MRI networks arise from subject motion",
 +                        NeuroImage(2011).  Note: data is only excluded during
 +                        the final correlation, and so will never affect any
 +                        operations that require the full signal, like
 +                        regression, etc.
 +  --fdnumneighbors=NUMNEIGHBORS
 +                        If --fdthreshold is specified, then
 +                        --fdnumnumneighbors specifies how many neighboring
                         volumes, before and after the initially excluded                         volumes, before and after the initially excluded
                         volumes, should also be excluded.  Default is 0.                         volumes, should also be excluded.  Default is 0.
Line 119: Line 141:
                         perform motion correction, then this option is                         perform motion correction, then this option is
                         ignored.                         ignored.
 +  --scrubop=SCRUBOP     If --motionthreshold, --dvarsthreshold, or
 +                        --fdthreshold are specified, then --scrubop specifies
 +                        the aggregation operator used to determine the final
 +                        list of excluded volumes.  Default is 'or', which
 +                        means a volume will be excluded if *any* of its
 +                        thresholds are exceeded, whereas 'and' means all the
 +                        thresholds must be exceeded to be excluded.
 +  --powerscrub          Equivalent to specifying --fdthreshold=0.5
 +                        --fdnumneighbors=0 --dvarsthreshold=0.5%
 +                        --dvarsnumneigbhors=0 --scrubop='and', to mimic the
 +                        method used in the Power et al. article.  Any
 +                        conflicting options specified before or after this
 +                        will override these.
   --scrubkeepminvols=NUMVOLS   --scrubkeepminvols=NUMVOLS
-                        If --motionthreshold or --dvarsthreshold are +                        If --motionthreshold--dvarsthreshold, or 
-                        specified, then --scrubminvols specifies the minimum +                        --fdthreshold are specified, then --scrubminvols 
-                        number of volumes that should pass the threshold +                        specifies the minimum number of volumes that should 
-                        before doing any correlation.  If the minimum is not +                        pass the threshold before doing any correlation.  If 
-                        met, then the script exits with an error.  Default is +                        the minimum is not met, then the script exits with an 
-                        to have no minimum.+                        error.  Default is to have no minimum. 
 +  --fcdmthresh=THRESH   R-value threshold to be used in functional 
 +                        connectivity density mapping ( step8 ). Default is set 
 +                        to 0.6. Algorithm from Tomasi et al, PNAS(2010), vol. 
 +                        107, no. 21. Calculates the fcdm of functional data 
 +                        from last completed step, inside a dilated gray matter 
 +                        mask
   --cleanup             delete files from intermediate steps?   --cleanup             delete files from intermediate steps?
 </code> </code>
Line 140: Line 181:
   * run fsl's slice time correction ( slicetimer )   * run fsl's slice time correction ( slicetimer )
   * if starting with a BXH header, you'll likely have the sliceorder field which will be used to create a custom sliceorder file to be used by fsl   * if starting with a BXH header, you'll likely have the sliceorder field which will be used to create a custom sliceorder file to be used by fsl
 +  * the default is to run bxh_slicetiming to extract a timing file from the BXH header
   * if this isn't present, then you'll need to define **--sliceorder** so that we can generate the file for you   * if this isn't present, then you'll need to define **--sliceorder** so that we can generate the file for you
     * "odd" is interleaved with odd, then even slice ordering: 1,3,5,2,4,6,etc     * "odd" is interleaved with odd, then even slice ordering: 1,3,5,2,4,6,etc
Line 145: Line 187:
     * "up" is ascending data, from the bottom up: 1,2,3,4,5,6     * "up" is ascending data, from the bottom up: 1,2,3,4,5,6
     * "down" is descending data, from the top down: 6,5,4,3,2,1     * "down" is descending data, from the top down: 6,5,4,3,2,1
 +  * this gets much more complicated with multi-band data, so using the default extraction is recommended 
  
 ==== Step 2 ==== ==== Step 2 ====
Line 153: Line 196:
   * the functional run is meaned across time with fslmaths, then bet is applied.  the resulting mask is then applied to the entire run of data   * the functional run is meaned across time with fslmaths, then bet is applied.  the resulting mask is then applied to the entire run of data
   * if you find that bet is doing a poor job finding the edges you can adjust the intensity threshold with **--betfval**   * if you find that bet is doing a poor job finding the edges you can adjust the intensity threshold with **--betfval**
-    * this is equivalent of **-f** when actually running bet.  the default is 0.5, but smaller values will be more conservative in finding the edges of the brain ( ie: larger mask ) +    * this is equivalent of **-f** when actually running bet.  the default is 0.4 (same as feat), but smaller values will be more conservative in finding the edges of the brain ( ie: larger mask ) 
 +  * if provided T1 anatomical is skull stripped. **--anatbetfval** is used to control intensity threshold, the default is 0.5 (same as feat)
 ==== Step 4 ==== ==== Step 4 ====
   * normalize the data using flirt   * normalize the data using flirt
Line 161: Line 204:
   * if your subject has already been normalized during standard pre-processing of other runs, please provide the flirt matrix from pre-stats with **--flirtmat** ( most likely example_func2standard.mat)   * if your subject has already been normalized during standard pre-processing of other runs, please provide the flirt matrix from pre-stats with **--flirtmat** ( most likely example_func2standard.mat)
     * this will apply the previously determined flirt matrix to your functional data instead of trying to calculate a new matrix based on the functionals.  the matrix from pre-stats was likely calculated using a high-resolution anatomical, also this will assure that your resting state runs are in the same space as the other runs from your subject.     * this will apply the previously determined flirt matrix to your functional data instead of trying to calculate a new matrix based on the functionals.  the matrix from pre-stats was likely calculated using a high-resolution anatomical, also this will assure that your resting state runs are in the same space as the other runs from your subject.
 +  * if you've provided at T1 anatomical image then this sequence is followed:
 +    * func-2-t1
 +    * t1-2-standard
 +    * flirt matrices are concatenated to create func-2-standard
 +  * if no T1 is provided, then the functional is used for the flirt normalization
  
 ==== Step 5 ====  ==== Step 5 ==== 
Line 170: Line 218:
 ==== Step 6 ====  ==== Step 6 ==== 
   * this step will band-pass filter data to remove high-frequency noise using custom python code   * this step will band-pass filter data to remove high-frequency noise using custom python code
-  * the default is 0.08 HZ+  * the default lowpass is 0.08 HZ 
 +  * highpass is fixed at .001 HZ
   * if you'd like to chose a different frequency, please use ** --lpfreq **   * if you'd like to chose a different frequency, please use ** --lpfreq **
 ==== Step 7 ====  ==== Step 7 ==== 
Line 197: Line 246:
 * that is the zr_values from the subject.graphml displayed in matplotlib.  the cursor shows the intersecting region at the bottom, and if you click, time courses are displayed.  we're working on a release (cp - 3/30/12) * that is the zr_values from the subject.graphml displayed in matplotlib.  the cursor shows the intersecting region at the bottom, and if you click, time courses are displayed.  we're working on a release (cp - 3/30/12)
  
-For a beta version of the viewer:+For the rs-pipeline viewer:
 <code> <code>
-/usr/local/packages/biacpython/bin/beta_viewer.py --help+/usr/local/packages/biacpython/bin/rspipe_viewer.py --help
 Usage:  Usage: 
-beta_viewer.py --graphml /path/to/subject.graphml --stat zrvalue+rspipe_viewer.py --graphml /path/to/subject.graphml --stat zrvalue
  
 Program to display graphml output from resting_pipeline Program to display graphml output from resting_pipeline
Line 218: Line 267:
 </code> </code>
  
 +
 +==== Step 8 ==== 
 +  * Functional connectivity density mapping
 +  * Takes functional data from last step and calculates how connected they are to the voxels around them
 +  * uses ( --fcdmthresh and --refgm ) as the pearson r-value and gray matter mask
 +  * if defaults are used, then a dilated gray matter mask is used from FAST segmentation of MNI brain and a pearson r value of 0.6
 +  * Iteratively goes to all neighboring voxels and counts the number that have correlated signal until they are under the r threshold
 +  * adapted from Dardo Tomasi, PNAS(2010), vol. 107, no. 21. 9885–9890
 +  * resulting file with be "fcdm.nii.gz"; higher voxel values indicate more correlation from neighbors
 +
 +{{:biac:analysis:fcdm.png?direct&400|}}
 ===== Things to consider ===== ===== Things to consider =====
   * this was designed to be modular, so that you only need to run the steps you need   * this was designed to be modular, so that you only need to run the steps you need
Line 357: Line 417:
  
  
-Still under-development 
 3D VTK: 3D VTK:
  
Line 364: Line 423:
  
  
 +
 +
 +----
 +
 +===== Download Source =====
 +{{:biac:analysis:rsfmri_python.tgz|}}
 +  - source files assume you have a working install of FSL and all imported python modules
 +  - need a working install of the [[http://www.nitrc.org/projects/bxh_xcede_tools/|BIRN BXH/Xcede tools]]
 +  - will need to edit any paths that may be different at your install location ( FSL FAST segmentations of the MNI brain and base sets of ROIs )
 +  - **Chou et al. AJNAR(2012), May; 33(5): 833–838 **
 +  - fcdm algorithm adapted from **Dardo Tomasi, PNAS(2010), vol. 107, no. 21. 9885–9890**
  
  
  
  
biac/analysis/resting_pipeline.1341860279.txt.gz · Last modified: 2014/08/04 16:03 (external edit)