Skip to content

Example of sparse fMRI data analysis using BIPS

zhenghanQ edited this page Apr 24, 2014 · 14 revisions

BIPS online resources


Sparse experiment design

  • TR=ISI=6 sec
  • TA=2 sec

Get Dicoms

  • cd /mindhive/xnat/dicom_storage/project
  • get_dicoms subjectID
  • But if you ever mess up the subjectID like I have in the scanner, please do the following to manually transfer the data:
  • mkdir ./subjectID/dicom
  • rsync -auv yourID@sigma:/dicom/incoming/TrioTim-35115-20130702-142133-xxxx/ ./subjectID/dicom/

Bips workflows

Convert Dicoms to nifti (uuid: df490522b5ad11e19a4d001e4fb1404c)

 o	In /gablab/p/BILD/configs: bips -r dicom_conversion.json 
 o	The nifti files are then transferred to /xnat/data/BILD/Kids

Freesurfer Reconstruction

 o	In /gablab/p/BILD/scripts: bash recon.sh <subjID> <#> (first # is the number of the last T1 scan according to the scaninfo.txt)
 o	For scans with T2, use bash reconT2.sh <subjID> <#> <#> (first # is the number of the last T1 scan and the second # is the number of the last T2 scan)
 o	The freesurfer files are saved in /xnat/surfaces/BILD/Kids

Creating a customized template

 o	In /gablab/p/BILD/brain_template: template_creation_workflow.py
 o	The output file will be located in ./template. The final template is ANTS_template_template.nii.gz
 o	To normalize the group template to MNI space: Run this command in the directory of /gablab/p/BILD/brain_template:

bash /software/ANTS/versions/120222/bin//antsIntroduction.sh -d 3 -r MNI152_T1_2mm_brain.nii -i ./template/ANTS_template_template.nii.gz -o groupMNI

Structural normalization to a template using bips (uuid: 21abfee68e2211e181190019b9f22493)

 o	4-11 yrs old: ANTS_pediatric_mask.nii;
 o	Or the group template in MNI space
 o	In /gablab/p/BILD/configs: bips –r normalizestruc.json
 o	The output generate a folder for each subject in /gablab/p/BILD/data_kids/MRI/ants

Preprocessing (uuid: 7757e3168af611e1b9d5001e4fb1404c)

 o	In /gablab/p/BILD/configs: bips -r preprocessingphono.json
 o	Coregistration: function -> structure; using the first volume of the first run as the reference volume.
 o	Motion correction mode: FSL
 o	Motion / Intensity correction (realignment) -> motion outlier is defined by comparing to the previous trial; intensity outlier is defined by comparing to the overall intensity average -> norm_thresh: 2mm; Z_threshold: 3
 o	Despiking: false
 o	Slice-timing correction: false
 o	Hp/Lp filter: -1 (i.e. none)
 o	Fwhm (Spatial filter): 6mm
 o	Use field map:
    True: if stimulus-correlated motion exists and interested in the likely-distorted orbito-frontal/inferior temporal regions
    False: If no stimulus-correlated motion

First level (uuid: 8efdb2a08f1711e1b160001e4fb1404c)

 o	In /gablab/p/BILD/configs: bips -r firstlevelphono.json
 o	The output folder is subject/BILDC3089/modelfit
 o	Bases: “none”:null -> force SPM/FSL not to do convolution (if not sparse, should use the default: "dgamma": {"derivs": false})
 o	Interscan interval: equals to TR
 o	Is_sparse: True
 o	Model_hrf: True -> model canonical HRF within sparse node
 o	TA: 2s
 o	TR: 6s
 o	stimuli_as_impulses = False
 o	Use_temporal_deriv: false (makes more sense to set as true, if collecting continuous data)
 o	Set contrasts
 o	Set regressors

Check stimulus-correlated motion

 o	In /gablab/p/BILD/scripts: python extract_scm_phono.py
 o	The output file is a txt file with all the correlational covariance values between conditions and motion parameters.
 o	OR In /gablab/p/BILD/configs: bips -r stim_motion_phono.json
 o	The output files are the total number of outliers in each condition and the correlation coefficient between the conditions and the motion parameters, saved in Stimulation_Motion folder in each subject's folder

Optional: First level with ev files (uuid: 02e050aa486911e2b88d00259080ab1a) – to customize the included trials for each subject.

 o	In /gablab/p/BILD/configs: bips –r firstlevelphonoev.json
 o	Make sure each subject folder has two subfolder: contrasts and ev
 o	“Contrasts” folder contains the same contrast file for each subject: contrast.txt
 o	“ev” folder contains the same number of files as the product of run number and contrast number.
   •	Each ev file is named after the contrast name.run001
   •	Each ev file has three columns (tab delimited): onset time (in sec); event duration; and amplitude (set at 1, if not sure)

Fixed effect (uuid: 7263507a8fe211e1b274001e4fb1404c)

 o	In /gablab/p/BILD/configs: bips -r firstlevelFXphono.json
 o	The output folder is subject/BILDC3089/fixedfx
 o	Put multiple runs together

Warp the functional image using normalized structural image and coregistration (uuid: 3a2e211eab1f11e19fab0019b9f22493) - can be skipped and do 1-step interpolation as below

 o	In /gablab/p/BILD/configs: bips -r normalizefuncpho.json
 o	The output folder is subject/BILDC3089/smri

Combining bbregister, fsl and ants to warp functional images

 o	In /gablab/p/BILD/scripts: <python BILDwarp.py>
 o	The output folder is subject/BILDC3089/warped

Select subjects for group analysis

  • Count outlier numbers: o In /gablab/p/BILD/data_kids/phono/MRI_data/subjects, perl outlier_count_pho.pl > out.txt o The output text file is in the same folder
  • Analyze whether the outlier number is correlated with conditions o In /gablab/p/BILD/scripts: python /gablab/p/scripts/combine_outlier_phono.py o The output file will be in /gablab/p/BILD/data_kids/phono/MRI_data/subjects
  • 20% artifact o are outlier numbers different across conditions? o are motion parameters different across conditions?

  • Check scanning logs
  • Check whether his/her in-scan task performance was an outlier

Second-level

 o	Within each group: one-sample ttest (uuid: f08f0a22ac0511e195e90019b9f22493)
 o	In /gablab/p/BILD/configs: bips -r groupttestphono.json
 o	Set do_randomise: true for stat correction using permutation.
 o	After do_randomise, the output files are threshold-free (tfce, 1-pvalue). If cluster size and location need to be reported, run these two commands:
 o	fslmaths OneSampleT_tfce_corrp_tstat1.nii.gz  -thr 0.95 -bin -mul OneSampleT_tstat1.nii.gz OneSampleT_threshold0.05_tstat1.nii.gz
 o	cluster --in=OneSampleT_threshold0.05_tstat1.nii.gz --thresh=0.01 --oindex=OneSampleT_cluster_index --olmax=OneSampleT_lmax.txt --osize=OneSampleT_cluster_size
 o	Or set do_randomise: false and do_correction: true for FSL FDR correction, z-value is the voxel-wise threshold: 2.3 (<0.01); p-value is the cluster-wise threshold: usually 0.05
 o	Multiple regression (uuid: 51ef1decba6711e18fda001e4fb1404c): 
 o	In /gablab/p/BILD/configs: bips –r groupmulti_phonoTD_beh.json
 o	add independent variables (age, behavior etc), nuisance regressors (scm, outlier number, etc.), load as a csv file (first column header must be id, must be comma delimited.)
 o	design matrix and contrast setting reference: http://mumford.fmripower.org/mean_centering/

Group comparison

 o	If outlier numbers significantly differ between groups, add outlier number as nuisance regressor into the multiple regression analysis

Please contact me, if you run into any problems or need more clarification of this list. I am still learning as well. :) - Zhenghan

Clone this wiki locally