-
Notifications
You must be signed in to change notification settings - Fork 26
fMRI PET preprocessing
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.
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
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
If you wish to load group averaging/comparison results, you first need to convert the SPM results to FreeSurfer format. In the SPM directory, you'll find spmT_0001.img and spmT_0001.hdr. In the command prompt, you'll need to run the following command (after sourcing FreeSurfer):
mri_convert spmT_0001.img results-name.nii
Where results-name can be the subject's name in case of subject vs group comparison, or any other name you find suitable. After that, copy the nii file to colin27's fMRI results folder, which can be (as described above) in links/fMRI/colin27 or in links/fMRI/task-name/colin27 if you specify the task (using the -t flag). The file should be copied to the colin27 folder because, for group averaging/comparison, SPM uses its template brain, which is colin27. After that, you can load this file as described in the loading fMRI/PET raw data section.
This section will be described more thoroughly in the MMVT addon documentation. For now, if you wish to render your data from the command prompt, you can run the following script:
python -m src.mmvt_addon.scripts.render_fmri_clusters -s subject_name -a atlas_name
The end result of this script is a split brain figure, with lateral and medial views: This script will render the clusters for all the subject's contrast you've calculated. If you are using colin27, that will render all the clusters for all the results loaded to colin27. For example, if you used SPM to calculate the difference between several subjects and a control group, the contrasts will be the subjects names, and the script will render the results of all the comparisons. Also, by default, it'll render both the pial and half inflated brain and both in white and black backgrounds. For more details, take a look at the script's documentation.