Skip to content

fMRI PET preprocessing

Noam Peled edited this page Dec 8, 2016 · 20 revisions

Loading fMRI FsFast results

If you wish to load FsFast results, the script will try to read the FsFast directories tree:

bold/{contrast_name}.sm05.{hemi}/{contrast}/sig.nii.gz

Also, the script assumes those directories are placed in the fMRI link directory, so the full directory tree should look as following:

links/fMRI/{task}/{subject-name}/bold/{contrast-name}.sm05.{hemi}/{contrast}/sig.nii.gz

You need to specify the task and the contrast name. You can also specify a contrast, or leave it empty to get all the contrasts:

python -m src.preproc.fMRI -s subject-name -a atlas-name --contrast_name contrast-name -t task-name -f fmri_pipeline

The atlas-name is needed for the clustering step. The algorithm will find cortical clusters and calculate their intersections with the labels, according to the selected atlas. In case the recon-all files are in a remote directory, like in the [anatomy preprocessing] (https://github.com/pelednoam/mmvt/wiki/Anatomy-preprocessing), you can set the remote_subject_dir:

python -m src.preproc.fMRI -s subject-name -a atlas-name --contrast_name contrast-name -t task-name -f fmri_pipeline --remote_subject_dir full-path-to-subject-recon-all-files

By default, the threshold for calculating the clusters is set to 2. If you wish to change it, you should use the threshold flag:

python -m src.preproc.fMRI -s subject-name -a atlas-name --contrast_name contrast-name -t task-name -f fmri_pipeline --threshold threshold-value

By default, the colors will be calculated symmetrically, from -abs(max(data)) to abs(max(data)). That makes sense if you loads fMRI contrast map. In case you want the color to be calculated from min(data) to max(data), you should use the symetric_colors flag:

python -m src.preproc.fMRI -s subject-name -a atlas-name --contrast_name contrast-name -t task-name -f fmri_pipeline --symetric_colors 0

If you wish to rerun the script for the same subject, and overwrite the previous results, you should use the overwrite_surf_data flag:

python -m src.preproc.fMRI -s subject-name -a atlas-name --contrast_name contrast-name -t task-name -f fmri_pipeline --overwrite_surf_data 1

If you wish to run the script on more than one subject, you should write the subjects names, separated with a comma, without spaces. If you also need to specify the remote directory, you should add {subject}:

python -m src.preproc.fMRI -s subject1-name,subject2-name,subject3-name -a atlas-name --contrast_name contrast-name -t task-name -f fmri_pipeline --remote_subject_dir full-path-to-subject-recon-all-files/{subject}"

Make sure you are using apostrophes in the remote folder name, the '{' character can be problematic.

Loading fMRI/PET raw data

In case you just want to load fMRI/PET volume file (nifty image), the preprocessing script will also project the volume data on the hemispheres:

python -m src.preproc.fMRI -s subject-name -a atlas-name

In this case, the volume file will be located in:

links/fMRI/subject-name/subject-name.{format}

Where format can be nii, nii.gz or mgz. In case you want to set the volume file name, you should use the volume_name flag:

python -m src.preproc.fMRI -s subject-name -a atlas-name --volume_name volume-name

Now the volume file will be located in

links/fMRI/subject-name/volume-name.{format}

In case the files are located under a task folder, like in the FsFast example, you should set the task flag:

python -m src.preproc.fMRI -s subject-name -a atlas-name --volume_name volume-name -t task-name

Now the volume file will be located in

links/fMRI/task-name/subject-name/volume-name.{format}

In case you wish to load PET data, you need to use the is_pet flag. Also, in PET raw data, you most probably don't want the colors to be calculated symmetrically, and the threshold should be set to a meaningful value, possibly zero:

python -m src.preproc.fMRI -s subject-name -a atlas-name --volume_name volume-name -t task-name --threshold 0 --symetric_colors 0 --is_pet 1

Loading SPM files

If you have the recon-all files of your subject, you just need to use the same approach like in fMRI/PET raw data. In case you don't have the subject's MRI, you'll need to morph the result in SPM to the SPM template brain. Then, use colin27 as your subject-name when calling to the fMRI preprocessing (you'll need to download colin27 first from here:

python -m src.preproc.fMRI -s colin27 -a atlas-name

This is also true if you wish to load group averaging/comparison results. SPM will use its template brain for that, which is colin27 (be sure you are using all the other flags which were described here).