Differences between revisions 5 and 17 (spanning 12 versions)
Revision 5 as of 2011-01-14 11:58:52
Size: 2931
Editor: TylerTriggs
Comment:
Revision 17 as of 2011-01-27 10:59:52
Size: 5104
Editor: TylerTriggs
Comment:
Deletions are marked like this. Additions are marked like this.
Line 5: Line 5:
For general tips on using FsFast, download this powerpoint: For general tips on using FsFast, download this [[http://surfer.nmr.mgh.harvard.edu/pub/docs/freesurfer.fsfast.ppt|FS-FAST powerpoint]]
Line 7: Line 7:
  [[http://surfer.nmr.mgh.harvard.edu/pub/docs/freesurfer.fsfast.ppt|Using FS-FAST]] This walkthrough demonstrates how to run a functional connectivity analysis on resting state fMRI data.
Line 9: Line 9:
*STEP 1: Unpack Data into the FSFAST Hierarchy using "unpackscmdir" *STEP 1: Unpack Data into the FSFAST Hierarchy using [[https://surfer.nmr.mgh.harvard.edu/fswiki/unpacksdcmdir|unpacksdcmdir]]
Line 11: Line 11:
[[https://surfer.nmr.mgh.harvard.edu/fswiki/unpacksdcmdir|unpacksdcmdir]] Sample cmd:
Line 13: Line 13:
1.QA Check after unpacking: unpacksdcmdir -src dicomdir/subject/ALLDICOMS -targ fcMRI_dir/subject -cfg subject_config.txt -fsfast -unpackerr

In this sample command...

 * Have all fMRI dicoms linked into "ALLDICOMS" directory
 * Arguement for "-targ" specifies output directory
 * subject_config.txt is a configuration text file you create (format below)
 * Use "-fsfast" to generate fsfast hierarchy

subject_config.txt format:

28 bold nii f.nii 29 bold nii f.nii

Col.1: scan acquisition number Col.2: output dir name will be created within "fcMRI_dir/subject" Col.3: output file format - this example is nifti format Col.4: output filename. In this example, 2 files will be created:

 . fcMRI_dir/subject/028/f.nii fcMRI_dir/subject/029/f.nii

*QA Check after unpacking:
Line 18: Line 35:
*STEP 2: Reconstruction Anatomical data using "recon-al -all" *STEP 2: Reconstruction Anatomical data using [[https://surfer.nmr.mgh.harvard.edu/fswiki/recon-all|recon-all]]
Line 20: Line 37:
1.Set SUBJECTS_DIR Sample cmd:
Line 22: Line 39:
2.QA Check: setenv SUBJECTS_DIR /path/to/recon_dir/ recon-all -s subject_dirname -all -i pathtoT1dicom_scan1.dcm -i pathtoT1dicom_scan2.dcm

In this sample command...

 * set your SUBJECTS_DIR variable to your FreeSurfer subject recon directory
 * set the subject's directory name with "-s" ... the arguement you provide will become the directory name within $SUBJECTS_DIR
 * use "-i" to supply the dicoms to reconstruct. Use one "-i" per T1 acquisition.

A. QA Check:
Line 27: Line 52:
 * D - Check hierarchy of reconstructed anatomical data  [[https://surfer.nmr.mgh.harvard.edu/fswiki/recon-all| recon-all]]  * D - Check hierarchy of reconstructed anatomical data
Line 29: Line 54:
1.Make FSFAST basic hierarchy (only if data are not unpacked in FSFAST hierarchy) B. Use FSFAST basic hierarch:
Line 31: Line 56:
2.Link to FreeSurfer anatomical analysis {{attachment:fsfast-hierarchy.jpg}}
Line 33: Line 58:
A - Make subjectname’ file in the session directory to link a subject's functional & structural data C. Link to FreeSurfer anatomical analysis: Create "subjectname" text file in the session directory. Write in it the subject's recon directory name (as labeld in $SUBJECTS_DIR).
Line 35: Line 60:
3.Create a sessid file (text file with list of your sessions)in your Study DIR. D. Create a sessid file (text file with list of your sessions)in your Study DIR (optional)
Line 37: Line 62:
4.Create a Stimulus Schedule (Paradigm file) in bold folder (A "paradigm" file is a record of which stimulus was presented when & for how long. *STEP 3: Pre-process your bold data using preproc-sess [[http://surfer.nmr.mgh.harvard.edu/fswiki/preproc-sess|preproc-sess]]
Line 39: Line 64:
Each paradigm file has four columns: Sample cmd:
Line 41: Line 66:
A - Stimulus onset time (sec) preproc-sess -s <subjid> -fwhm <#>
Line 43: Line 68:
B - Condition ID code (0, 1, 2, ...) A. By default this will do motion correction, smoothing & brain masking
Line 45: Line 70:
C - Stimulus Duration (sec) B. Quality Check (plot-twf-sess)
Line 47: Line 72:
D - Stimulus Weight (usually 1) C.Examine additions to FSFAST hierarchy (in each run of bold dir):
Line 49: Line 74:
*STEP 3: Pre-process your bold data using preproc-sess [[http://surfer.nmr.mgh.harvard.edu/fswiki/preproc-sess| preproc-sess]]
# Preprocessing of fMRI Data ()
preproc-sess -s <subjid> -fwhm <#>
1.By default this will do motion correction, smoothing & brain masking
2.Quality Check (plot-twf-sess)
3.Examine additions to FSFAST hierarchy (in each run of bold dir):
 f.nii (the raw data)
 fmc.nii (motion corrected-MC)
 fmcsm5.nii (MC & smoothed)
 fmc.mcdat - text file with the MC parameters (AFNI)
 mcextreg.bhdr - binary mask of the brain
  ||f.nii ||(Raw fMRI data) ||
 ||fmc.nii ||(Motion corrected-MC) ||
 ||fmcsm5.nii ||(MC & smoothed) ||
 ||fmc.mcdat ||(Text file with the MC parameters (AFNI)) ||
 ||brain.mgz ||(Binary mask of the brain) ||
Line 61: Line 80:
# Function-Structure Registration View unregistered
tkregister-sess -s <subjid> -regheader)
Run automatic registration spmregister-sess -s <subjid>
Check automatic registration tkregister-sess -s <subjid>
Line 66: Line 81:
A - Make edits if needed using scale as the last resort Check talairach registration tkregister2 --s <subjid> --fstal --surf
NOTE: you ''may'' need to convert the file "fmcpr.mgz" to fmcpr.nii using [[http://surfer.nmr.mgh.harvard.edu/fswiki/mri_convert | mri_convert ]]

Found in each bold scan dir. Sample cmd:

mri_convert session/bold/002/fmcpr.mgz session/bold/002/fmcpr.nii

mri_convert session/bold/003/fmcpr.mgz session/bold/003/fmcpr.nii
Line 70: Line 92:
*STEP 5: Use mkanalysis-sess to setup an analysis for your FC data This example will use the FreeSurfer cortical segmentation for the left posterior cingulate (segID: 1010). For seed regions, we recommend generating the mean signal timecourse by using "-mean"
Line 72: Line 94:
*STEP 6: Use selxavg3-sess to run the subject-level analysis Sample cmd (mean seed region timecourse):
Line 74: Line 96:
*STEP 7: Use mri_glmfit or selxavg3-sess to run a group-level analysis fcseed-sess -segid 1010 -o mean.L_Posteriorcingulate.dat -s <session> -fsd bold -mean

Sample cmd (Principal component analysis for nuisance regressors):

for white matter:

 . fcseed-sess -wm -o wm.dat -s <session> -fsd bold -pca

for ventricles + CSF:

 . fcseed-sess -vcsf -o vcsf.dat -s <session> -fsd bold -pca

*STEP 5: Use [[http://surfer.nmr.mgh.harvard.edu/fswiki/mkanalysis-sess|mkanalysis-sess]] to setup an analysis for your FC data

Sample cmd:

mkanalysis-sess -a <analysisname>

 . -surface fsaverage <hemi> -notask -taskreg mean.L_Posteriorcingulate.dat 1 -nuisreg vcsfreg.dat 3 -nuisreg wmreg.dat 3 -nuisreg global.waveform.dat 1 -fwhm 5 -fsd bold -TR <TR> -mcextreg -polyfit 2 -nskip 4

*STEP 6: Use [[http://surfer.nmr.mgh.harvard.edu/fswiki/selxavg3-sess|selxavg3-sess]] to run the subject-level analysis outlined by the above mkanalysis-sess cmd.

 . selxavg3-sess -s <session> -a <analysisname>

*STEP 7: Use[[http://surfer.nmr.mgh.harvard.edu/fswiki/mri_glmfit|mri_glmfit]] or[[http://surfer.nmr.mgh.harvard.edu/fswiki/selxavg3-sess|selxavg3-sess]] to run a group-level analysis

work in progress...

About

Walkthrough: How to use FsFast and fcseed-sess for functional connectivity analysis including example commands.

For general tips on using FsFast, download this FS-FAST powerpoint

This walkthrough demonstrates how to run a functional connectivity analysis on resting state fMRI data.

*STEP 1: Unpack Data into the FSFAST Hierarchy using unpacksdcmdir

Sample cmd:

unpacksdcmdir -src dicomdir/subject/ALLDICOMS -targ fcMRI_dir/subject -cfg subject_config.txt -fsfast -unpackerr

In this sample command...

  • Have all fMRI dicoms linked into "ALLDICOMS" directory
  • Arguement for "-targ" specifies output directory
  • subject_config.txt is a configuration text file you create (format below)
  • Use "-fsfast" to generate fsfast hierarchy

subject_config.txt format:

28 bold nii f.nii 29 bold nii f.nii

Col.1: scan acquisition number Col.2: output dir name will be created within "fcMRI_dir/subject" Col.3: output file format - this example is nifti format Col.4: output filename. In this example, 2 files will be created:

  • fcMRI_dir/subject/028/f.nii fcMRI_dir/subject/029/f.nii

*QA Check after unpacking:

  • A - Check unpacked data (time points, # of slices ..etc)
  • B - Check FSFAST hierarchy in session folder

*STEP 2: Reconstruction Anatomical data using recon-all

Sample cmd:

setenv SUBJECTS_DIR /path/to/recon_dir/ recon-all -s subject_dirname -all -i pathtoT1dicom_scan1.dcm -i pathtoT1dicom_scan2.dcm

In this sample command...

  • set your SUBJECTS_DIR variable to your FreeSurfer subject recon directory

  • set the subject's directory name with "-s" ... the arguement you provide will become the directory name within $SUBJECTS_DIR
  • use "-i" to supply the dicoms to reconstruct. Use one "-i" per T1 acquisition.

A. QA Check:

  • A - Check talairach transformation
  • B - Check skull strip, white matter & pial surface

  • C - Re-run "recon-all" if edits are made
  • D - Check hierarchy of reconstructed anatomical data

B. Use FSFAST basic hierarch:

fsfast-hierarchy.jpg

C. Link to FreeSurfer anatomical analysis: Create "subjectname" text file in the session directory. Write in it the subject's recon directory name (as labeld in $SUBJECTS_DIR).

D. Create a sessid file (text file with list of your sessions)in your Study DIR (optional)

*STEP 3: Pre-process your bold data using preproc-sess preproc-sess

Sample cmd:

preproc-sess -s <subjid> -fwhm <#>

A. By default this will do motion correction, smoothing & brain masking

B. Quality Check (plot-twf-sess)

C.Examine additions to FSFAST hierarchy (in each run of bold dir):

  • f.nii

    (Raw fMRI data)

  • fmc.nii

    (Motion corrected-MC)

    fmcsm5.nii

    (MC & smoothed)

    fmc.mcdat

    (Text file with the MC parameters (AFNI))

    brain.mgz

    (Binary mask of the brain)

NOTE: you may need to convert the file "fmcpr.mgz" to fmcpr.nii using mri_convert

Found in each bold scan dir. Sample cmd:

mri_convert session/bold/002/fmcpr.mgz session/bold/002/fmcpr.nii

mri_convert session/bold/003/fmcpr.mgz session/bold/003/fmcpr.nii

*STEP 4: Use fcseed-sess to generate time-course information for your chosen seed region (as well as nuisance variable signal).

This example will use the FreeSurfer cortical segmentation for the left posterior cingulate (segID: 1010). For seed regions, we recommend generating the mean signal timecourse by using "-mean"

Sample cmd (mean seed region timecourse):

fcseed-sess -segid 1010 -o mean.L_Posteriorcingulate.dat -s <session> -fsd bold -mean

Sample cmd (Principal component analysis for nuisance regressors):

for white matter:

  • fcseed-sess -wm -o wm.dat -s <session> -fsd bold -pca

for ventricles + CSF:

  • fcseed-sess -vcsf -o vcsf.dat -s <session> -fsd bold -pca

*STEP 5: Use mkanalysis-sess to setup an analysis for your FC data

Sample cmd:

mkanalysis-sess -a <analysisname>

  • -surface fsaverage <hemi> -notask -taskreg mean.L_Posteriorcingulate.dat 1 -nuisreg vcsfreg.dat 3 -nuisreg wmreg.dat 3 -nuisreg global.waveform.dat 1 -fwhm 5 -fsd bold -TR <TR> -mcextreg -polyfit 2 -nskip 4

*STEP 6: Use selxavg3-sess to run the subject-level analysis outlined by the above mkanalysis-sess cmd.

  • selxavg3-sess -s <session> -a <analysisname>

*STEP 7: Usemri_glmfit orselxavg3-sess to run a group-level analysis

FsFastFunctionalConnectivityWalkthrough (last edited 2024-01-16 14:11:01 by DougGreve)