Differences between revisions 11 and 28 (spanning 17 versions)
Revision 11 as of 2011-01-20 17:28:12
Size: 4536
Editor: TylerTriggs
Comment:
Revision 28 as of 2011-10-11 15:21:50
Size: 6618
Editor: TylerTriggs
Comment:
Deletions are marked like this. Additions are marked like this.
Line 11: Line 11:
Ex:
unpacksdcmdir -src dicomdir/subject/ALLDICOMS -targ fcMRI_dir/subject -cfg subject_config.txt -fsfast -unpackerr
Sample cmd:
Line 14: Line 13:
In this example command...
                   *Have all fMRI dicoms lin
ked 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 
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
Line 25: Line 27:
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
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:
Line 32: Line 29:
1.QA Check after unpacking:  . fcMRI_dir/subject/028/f.nii fcMRI_dir/subject/029/f.nii

*QA Check after unpacking:
Line 36: Line 36:
*STEP 2: Reconstruction Anatomical data using [[https://surfer.nmr.mgh.harvard.edu/fswiki/recon-all| recon-all]] *STEP 2: Reconstruction Anatomical data using [[https://surfer.nmr.mgh.harvard.edu/fswiki/recon-all|recon-all]]
Line 38: Line 38:
Ex: Sample cmd:
Line 40: Line 40:
setenv SUBJECTS_DIR /path/to/recon_dir/
recon-all -s subject_dirname -all -i pathtoT1dicom_scan1.dcm -i pathtoT1dicom_scan2.dcm
 setenv SUBJECTS_DIR /path/to/recon_dir/ ;
Line 43: Line 42:
In this example 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.                    2.QA Check:
 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 52: Line 55:
 * D - Check hierarchy of reconstructed anatomical data    * D - Check hierarchy of reconstructed anatomical data
Line 54: Line 57:

1
.Double-check for FSFAST basic hierarchy 
B. Use FSFAST directory hierarchy:
Line 59: Line 61:
2.Link to FreeSurfer anatomical analysis: 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 61: Line 63:
A - Create "subjectname" text file in the session directory. Write in it the subject's recon directory name (found within $SUBJECTS_DIR).

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 68: Line 67:
Sample cmd:
Line 70: Line 71:
1.By default this will do motion correction, smoothing & brain masking A. By default this will do motion correction, smoothing & brain masking
Line 72: Line 73:
2.Quality Check (plot-twf-sess) 3.Examine additions to FSFAST hierarchy (in each run of bold dir): B. Quality Check (plot-twf-sess)
Line 74: Line 75:
  ||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)||
C.Examine additions to FSFAST hierarchy (in each run of bold dir):
Line 80: Line 77:
# Function-Structure Registration View unregistered:  ||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 82: Line 83:
 . [[http://surfer.nmr.mgh.harvard.edu/fswiki/tkregister-sess|tkregister-sess]] -s <subjid> -regheader)
Line 84: Line 84:
Run automatic registration:
Line 86: Line 85:
 . [[http://surfer.nmr.mgh.harvard.edu/fswiki/spmregister-sess|spmregister-sess]] -s <subjid> 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]]
Line 88: Line 87:
Check automatic registration: Found in each bold scan dir. Sample cmd:
Line 90: Line 89:
 . [[http://surfer.nmr.mgh.harvard.edu/fswiki/tkregister-sess|tkregister-sess]] -s <subjid> mri_convert session/bold/002/fmcpr.mgz session/bold/002/fmcpr.nii
Line 92: Line 91:
A - Make edits if needed using scale as the last resort Check talairach registration: mri_convert session/bold/003/fmcpr.mgz session/bold/003/fmcpr.nii
Line 94: Line 93:
 . [[http://surfer.nmr.mgh.harvard.edu/fswiki/tkregister2|tkregister2]] --s <subjid> --fstal --surf
Line 96: Line 94:
*STEP 4: Use fcseed-sess to generate time-course information for your chosen seed region (as well as nuisance variable signal). If using a full Freesurfer parcellations from aparc+aseg.mgz, continue with step 4 as described below.

If you would like to split the Freesurfer parcellation, follow the additional steps here

*STEP 4: Use fcseed-config to record the parameters you wish to pass to your connectivity analysis.

Sample command:
fcseed-config -segid 1010 -fcname mean.L_Posteriorcingulate.dat -fsd bold -mean -cfg mean.L_Posteriorcingulate.config

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"

*STEP 5: Pass the config text file to fcseed-sess to generate time-course information for your chosen seed region (or for nuisance variable signal).

Sample cmd (mean seed region timecourse):

fcseed-sess -s <session> -cfg mean.L_Posteriorcingulate.config

Sample cmd (Principal component analysis for nuisance regressors):

for white matter:
 . fcseed-config -wm -fcname wm.dat -fsd bold -pca -cfg wm.config
 . fcseed-sess -s <session> -cfg wm.config

for ventricles + CSF:
 . fcseed-config -vcsf -fcname vcsf.dat -fsd bold -mean -cfg vcsf.config
 . fcseed-sess -s <session> -cfg vcsf.config

 *NOTE: Once a config file is created it may be used for multiple sessions
Line 100: Line 125:
*STEP 6: Use [[http://surfer.nmr.mgh.harvard.edu/fswiki/selxavg3-sess|selxavg3-sess]] to run the subject-level analysis Sample cmd:
Line 102: Line 127:
*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 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: Choose the contrast file (generated in each session's contrast directory) that you wish to analyze on a group level:

  # ces.mgz - contrast effect size (contrast matrix * regression coef)
  # cesvar.mgz - variance of contrast effect size
  # sig.mgz - significance map (-log10(p))
  # pcc.mgz - partial correlation coefficient map

*STEP 8: To continue with a group-level analysis, try one of the methods below:
  Method 1:
            *create fsgd file containing all sessions of interest
            *Concatenate contrast files using [[http://www.freesurfer.net/fswiki/mri_concat|mri_concat]]
            *Run group analysis using [[http://www.freesurfer.net/fswiki/mri_concat|mri_glmfit]]

  Should also be possible with:
  Method 2:
            *[[http://www.freesurfer.net/fswiki/Qdec|Qdec]]

  Should also be possible with:
  Method 3:
            *Concatenate with [[http://www.freesurfer.net/fswiki/isxconcat-sess|isxconcat-sess]]
            *Run group analysis using [[http://www.freesurfer.net/fswiki/mri_concat|mri_glmfit]]

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 directory hierarchy:

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

If using a full Freesurfer parcellations from aparc+aseg.mgz, continue with step 4 as described below.

If you would like to split the Freesurfer parcellation, follow the additional steps here

*STEP 4: Use fcseed-config to record the parameters you wish to pass to your connectivity analysis.

Sample command: fcseed-config -segid 1010 -fcname mean.L_Posteriorcingulate.dat -fsd bold -mean -cfg mean.L_Posteriorcingulate.config

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"

*STEP 5: Pass the config text file to fcseed-sess to generate time-course information for your chosen seed region (or for nuisance variable signal).

Sample cmd (mean seed region timecourse):

fcseed-sess -s <session> -cfg mean.L_Posteriorcingulate.config

Sample cmd (Principal component analysis for nuisance regressors):

for white matter:

  • fcseed-config -wm -fcname wm.dat -fsd bold -pca -cfg wm.config
  • fcseed-sess -s <session> -cfg wm.config

for ventricles + CSF:

  • fcseed-config -vcsf -fcname vcsf.dat -fsd bold -mean -cfg vcsf.config
  • fcseed-sess -s <session> -cfg vcsf.config

  • NOTE: Once a config file is created it may be used for multiple sessions

*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: Choose the contrast file (generated in each session's contrast directory) that you wish to analyze on a group level:

  • # ces.mgz - contrast effect size (contrast matrix * regression coef) # cesvar.mgz - variance of contrast effect size # sig.mgz - significance map (-log10(p)) # pcc.mgz - partial correlation coefficient map

*STEP 8: To continue with a group-level analysis, try one of the methods below:

  • Method 1:
    • create fsgd file containing all sessions of interest
    • Concatenate contrast files using mri_concat

    • Run group analysis using mri_glmfit

    Should also be possible with: Method 2: Should also be possible with: Method 3:

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