Install the Docker so that it can directly run on the Docker for python- and FSL-based dependencies https://www.docker.com/products/docker-desktop/
All the folders should follow BIDS format
PROJECT_DIR="/Users/jdmacstudio/Desktop/fmriprep_test"
RAWDATA="${PROJECT_DIR}/rawdata"
DERIVATIVES="${PROJECT_DIR}/derivatives"
WORK="${PROJECT_DIR}/work"
NONBIDS="${PROJECT_DIR}/non_bids_files"
SUBDIR="${RAWDATA}/sub-${SUB}/ses-${SES}"
echo "Preparing fMRIPrep folder structure..."
echo "Source session folder: ${SOURCE_SES}"
echo "Project folder: ${PROJECT_DIR}"
# -----------------------------
# 1. Create folder structure
# -----------------------------
mkdir -p "${SUBDIR}"
mkdir -p "${DERIVATIVES}"
mkdir -p "${WORK}"
mkdir -p "${NONBIDS}"
all subject folder should look like this
/Users/jdmacstudio/Desktop/fmriprep_test/rawdata
├── dataset_description.json
└── sub-003RTV85
└── ses-00A
├── anat
│ ├── sub-003RTV85_ses-00A_T1w.json
│ └── sub-003RTV85_ses-00A_T1w.nii.gz
├── fmap
│ ├── sub-003RTV85_ses-00A_acq-func_dir-AP_run-01_epi.json
│ ├── sub-003RTV85_ses-00A_acq-func_dir-AP_run-01_epi.nii.gz
│ ├── sub-003RTV85_ses-00A_acq-func_dir-AP_run-02_epi.json
│ ├── sub-003RTV85_ses-00A_acq-func_dir-AP_run-02_epi.nii.gz
│ ├── sub-003RTV85_ses-00A_acq-func_dir-AP_run-03_epi.json
│ ├── sub-003RTV85_ses-00A_acq-func_dir-AP_run-03_epi.nii.gz
│ ├── sub-003RTV85_ses-00A_acq-func_dir-AP_run-04_epi.json
│ ├── sub-003RTV85_ses-00A_acq-func_dir-AP_run-04_epi.nii.gz
│ ├── sub-003RTV85_ses-00A_acq-func_dir-AP_run-05_epi.json
│ ├── sub-003RTV85_ses-00A_acq-func_dir-AP_run-05_epi.nii.gz
│ ├── sub-003RTV85_ses-00A_acq-func_dir-PA_run-01_epi.json
│ ├── sub-003RTV85_ses-00A_acq-func_dir-PA_run-01_epi.nii.gz
│ ├── sub-003RTV85_ses-00A_acq-func_dir-PA_run-02_epi.json
│ ├── sub-003RTV85_ses-00A_acq-func_dir-PA_run-02_epi.nii.gz
│ ├── sub-003RTV85_ses-00A_acq-func_dir-PA_run-03_epi.json
│ ├── sub-003RTV85_ses-00A_acq-func_dir-PA_run-03_epi.nii.gz
│ ├── sub-003RTV85_ses-00A_acq-func_dir-PA_run-04_epi.json
│ ├── sub-003RTV85_ses-00A_acq-func_dir-PA_run-04_epi.nii.gz
│ ├── sub-003RTV85_ses-00A_acq-func_dir-PA_run-05_epi.json
│ └── sub-003RTV85_ses-00A_acq-func_dir-PA_run-05_epi.nii.gz
└── func
├── sub-003RTV85_ses-00A_task-rest_run-01_bold.json
├── sub-003RTV85_ses-00A_task-rest_run-01_bold.nii.gz
├── sub-003RTV85_ses-00A_task-rest_run-02_bold.json
├── sub-003RTV85_ses-00A_task-rest_run-02_bold.nii.gz
├── sub-003RTV85_ses-00A_task-rest_run-03_bold.json
├── sub-003RTV85_ses-00A_task-rest_run-03_bold.nii.gz
├── sub-003RTV85_ses-00A_task-rest_run-04_bold.json
├── sub-003RTV85_ses-00A_task-rest_run-04_bold.nii.gz
├── sub-003RTV85_ses-00A_task-nBack_run-01_bold.json
├── sub-003RTV85_ses-00A_task-nBack_run-01_bold.nii.gz
├── sub-003RTV85_ses-00A_task-nBack_run-01_events.tsv
├── sub-003RTV85_ses-00A_task-nBack_run-02_bold.json
├── sub-003RTV85_ses-00A_task-nBack_run-02_bold.nii.gz
├── sub-003RTV85_ses-00A_task-nBack_run-02_events.tsv
├── sub-003RTV85_ses-00A_task-MID_run-01_bold.json
├── sub-003RTV85_ses-00A_task-MID_run-01_bold.nii.gz
├── sub-003RTV85_ses-00A_task-MID_run-01_events.tsv
├── sub-003RTV85_ses-00A_task-MID_run-02_bold.json
├── sub-003RTV85_ses-00A_task-MID_run-02_bold.nii.gz
├── sub-003RTV85_ses-00A_task-MID_run-02_events.tsv
├── sub-003RTV85_ses-00A_task-SST_run-01_bold.json
├── sub-003RTV85_ses-00A_task-SST_run-01_bold.nii.gz
├── sub-003RTV85_ses-00A_task-SST_run-01_events.tsv
├── sub-003RTV85_ses-00A_task-SST_run-02_bold.json
├── sub-003RTV85_ses-00A_task-SST_run-02_bold.nii.gz
└── sub-003RTV85_ses-00A_task-SST_run-02_events.tsv
when download the data from server, the functional and anotomical data might look like above, then we need to run the rename code use the code to run it on your terminal -- use this Rename_BIDS
Then run fmriprep on terminal using fMRIprep (you can adjust the nthreads based on your computer)
docker run --rm -it \
-v /Users/jdmacstudio/Desktop/fmriprep_test/rawdata:/data:ro \
-v /Users/jdmacstudio/Desktop/fmriprep_test/derivatives:/out \
-v /Users/jdmacstudio/Desktop/fmriprep_test/work:/work \
-v /Users/jdmacstudio/Desktop/fmriprep_test/license.txt:/opt/freesurfer/license.txt:ro \
nipreps/fmriprep:latest \
/data /out/fmriprep participant \
--participant-label 003RTV85 \
--fs-license-file /opt/freesurfer/license.txt \
-w /work \
--output-spaces MNI152NLin2009cAsym:res-2 anat \
--nthreads 8 \
--omp-nthreads 4 \
--mem-mb 28000
here is an example of the task files after preprocess
task-nBack/
run-01/
sub-003RTV85_ses-00A_task-nBack_run-01_desc-brain_mask.json
sub-003RTV85_ses-00A_task-nBack_run-01_desc-brain_mask.nii.gz
sub-003RTV85_ses-00A_task-nBack_run-01_desc-confounds_timeseries.json
sub-003RTV85_ses-00A_task-nBack_run-01_desc-confounds_timeseries.tsv
sub-003RTV85_ses-00A_task-nBack_run-01_desc-coreg_boldref.json
sub-003RTV85_ses-00A_task-nBack_run-01_desc-coreg_boldref.nii.gz
sub-003RTV85_ses-00A_task-nBack_run-01_desc-hmc_boldref.json
sub-003RTV85_ses-00A_task-nBack_run-01_desc-hmc_boldref.nii.gz
sub-003RTV85_ses-00A_task-nBack_run-01_from-boldref_to-pepolarfunc4_mode-image_desc-fmap_xfm.json
sub-003RTV85_ses-00A_task-nBack_run-01_from-boldref_to-pepolarfunc4_mode-image_desc-fmap_xfm.txt
sub-003RTV85_ses-00A_task-nBack_run-01_from-boldref_to-T1w_mode-image_desc-coreg_xfm.json
sub-003RTV85_ses-00A_task-nBack_run-01_from-boldref_to-T1w_mode-image_desc-coreg_xfm.txt
sub-003RTV85_ses-00A_task-nBack_run-01_from-orig_to-boldref_mode-image_desc-hmc_xfm.json
sub-003RTV85_ses-00A_task-nBack_run-01_from-orig_to-boldref_mode-image_desc-hmc_xfm.txt
sub-003RTV85_ses-00A_task-nBack_run-01_space-MNI152NLin2009cAsym_res-2_boldref.json
sub-003RTV85_ses-00A_task-nBack_run-01_space-MNI152NLin2009cAsym_res-2_boldref.nii.gz
sub-003RTV85_ses-00A_task-nBack_run-01_space-MNI152NLin2009cAsym_res-2_desc-brain_mask.json
sub-003RTV85_ses-00A_task-nBack_run-01_space-MNI152NLin2009cAsym_res-2_desc-brain_mask.nii.gz
sub-003RTV85_ses-00A_task-nBack_run-01_space-MNI152NLin2009cAsym_res-2_desc-preproc_bold.json
sub-003RTV85_ses-00A_task-nBack_run-01_space-MNI152NLin2009cAsym_res-2_desc-preproc_bold.nii.gz
sub-003RTV85_ses-00A_task-nBack_run-01_space-T1w_boldref.json
sub-003RTV85_ses-00A_task-nBack_run-01_space-T1w_boldref.nii.gz
sub-003RTV85_ses-00A_task-nBack_run-01_space-T1w_desc-brain_mask.json
sub-003RTV85_ses-00A_task-nBack_run-01_space-T1w_desc-brain_mask.nii.gz
sub-003RTV85_ses-00A_task-nBack_run-01_space-T1w_desc-preproc_bold.json
sub-003RTV85_ses-00A_task-nBack_run-01_space-T1w_desc-preproc_bold.nii.gz
we will use sub-003RTV85_ses-00A_task-nBack_run-01_space-MNI152NLin2009cAsym_res-2_desc-preproc_bold.nii.gz (preprocessed file), sub-003RTV85_ses-00A_task-nBack_run-01_desc-brain_mask.nii.gz (mask files = analyze these voxel only to exclude skull, non-brain background, noise etc.,) and sub-003RTV85_ses-00A_task-nBack_run-01_desc-confounds_timeseries.tsv (motion-related confound) and the timeseries files saved in the raw data
You can use SPM or FSL for firstlevel and group-level GLM for whole brain + ROI activation + beta extraction, or use Nilearn to run them and save the beta maps for later Representational similarity Analysis