Run mriqc as soon as You convert Your data. You will get to know if the dataset is more or less BIDS compliant (mriqc does not check for fieldmaps), run quality control protocol (below) and get averaged FD values for a 2nd level.
root_dir=/home/grieg/neurogrieg
subj=${1##*-}
nthreads=10
mem=20 #gb
docker run --rm --network none -v $root_dir:/mnt nipreps/mriqc \
/mnt/$bids_root_dir /mnt/$bids_root_dir/derivatives/mriqc \
participant \
--participant-label ${subj} \
--fd_thres 0.5 \
--n_proc $nthreads \
--mem_gb $mem \
--float32 \
--ants-nthreads $nthreads \
--verbose-reports \
--no-sub \
--modalities bold
, then change participant to group to aggregate all results into group_bold.tsv and group_bold.html.
Troubleshooting:
File "/opt/conda/lib/python3.11/multiprocessing/connection.py", line 646, in SocketClient
s.connect(address)
FileNotFoundError: [Errno 2] No such file or directory
above means that You have to update Your Docker.
Once Your data is BIDS-compliant You may process them through fmriprep. See our wrap-up scripts on the GitHub. Don't forget to check fieldmaps' IntendedFor (correct if You use xnat-dcm2bids).
Example execution in Docker container:
docker run -it nipreps/fmriprep --nthreads 4 --omp-nthreads 4 --mem_mb 12000 --fs-license-file ~/license.txt --fs-no-reconall ~/bids-dir/ ~/tmp participant
Output's outline:
.
├── anat
│ ├── ...
│ ├── sub-0712f_space-MNI152NLin2009cAsym_desc-preproc_T1w.nii.gz - normalized T1w if You need one
│ ├── ...
├── figures
│ ├── sub-0712f_desc-summary_T1w.html - graphical reports here
│ ├── ...
│ ├── sub-0712f_task-cet_desc-summary_bold.html
│ ├── ...
├── fmap - You won't get any error if missing, but You'd rather use them!
│ ├── sub-0712f_fmapid-auto00000_desc-coeff_fieldmap.nii.gz
│ ├── sub-0712f_fmapid-auto00000_desc-epi_fieldmap.nii.gz
│ ├── sub-0712f_fmapid-auto00000_desc-preproc_fieldmap.json
│ └── sub-0712f_fmapid-auto00000_desc-preproc_fieldmap.nii.gz
├── func
│ ├── sub-0712f_task-cet_desc-confounds_timeseries.tsv - confounds to be used in a 1st level model
│ ├── ...
│ ├── sub-0712f_task-cet_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz - unsmoothed, preprocessed BOLD series
│ ├── ...
You will need to apply smoothing to Your data - SPM-Smooth or fslmaths <input image> -s <smoothing sigma> <output image>. Bare in mind - FWHM=6mm -> sigma=2.55mm.
Fmriprep automatically performs motion censoring (FD>0.5mm) and provides additional columns to be used in the model (motion_outlier_xxx). Use 6 motion regressors, 6 a_comp_corr (anatomically derived confounds), FD (additionally FD_mean at the group level) according to Chris Gorgolewski. The bids-matlab toolbox will help You read and convert the fmriprep's "confounds" into MAT files. There is an example of how to use it on our GitHub.
FD mean You can easily get it from the mriqc table.
Create datain.txt file with a respective readout time (from json):
0 -1 0 .04536
0 1 0 .04536
fslmerge -t se_epi_merged sub-*AP_epi.nii sub-*PA_epi.nii
topup --imain=se_epi_merged.nii --datain=datain.txt --config=b02b0.cnf --out=topup_results --fout=my_fieldmap --iout=se_epi_unwarped
fslchfiletype NIFTI_PAIR my_fieldmap.nii fpm_my_fieldmap
OR
try our script, which contains above commands eg. ./fmap_script.sh sub-XXX/fmap datain.txt
In Calculate VDM choose Precalculated FieldMap and select fpm_my_fieldmap file from the above procedure. Instead of the standard Realign&Reslice use Realign&Unwarp, which will apply the correction to Your fMRI volumes.
Remember to modify those 2 lines im pm_defaults.m:
pm_def.K_SPACE_TRAVERSAL_BLIP_DIR = -1; % minus for fMRI sequence in AP direction
pm_def.TOTAL_EPI_READOUT_TIME = 45.36;