Several anatomical images (T1s) in QSIPrep

Hi All,

I’m trying to process the following patient/session data with qsiprep:

derivatives/nii/sub-01/ses-02
├── anat
│   ├── sub-01_ses-02_acq-gadolinium_T1w.json
│   ├── sub-01_ses-02_acq-gadolinium_T1w.nii.gz
│   ├── sub-01_ses-02_acq-precontrast_T1w.json
│   ├── sub-01_ses-02_acq-precontrast_T1w.nii.gz
│   ├── sub-01_ses-02_acq-WMNull_T1w.json
│   ├── sub-01_ses-02_acq-WMNull_T1w.nii.gz
│   ├── sub-01_ses-02_T2w.json
│   └── sub-01_ses-02_T2w.nii.gz
└── dwi
    ├── sub-01_ses-02_acq-HARDI_dwi.bval
    ├── sub-01_ses-02_acq-HARDI_dwi.bvec
    ├── sub-01_ses-02_acq-HARDI_dwi.json
    └── sub-01_ses-02_acq-HARDI_dwi.nii.gz

I’m using the following command with the flag --bids-filter-file ${BIDS_FILTER_FILE}:

Full command
VERSION=0.22.0
apptainer run --cleanenv --containall --writable-tmpfs \
    -B ${DERIVATIVES_DIR_TMP}:/derivatives:ro \
    -B ${DERIVATIVES_DIR_TMP}:/out \
    -B ${WORK_DIR}:${WORK_DIR} \
    -B ${FS_LICENSE}:/opt/freesurfer/license.txt \
    -B $BIDS_FILTER_FILE:$BIDS_FILTER_FILE \
    /wynton/group/rsl/utils/software/qsiprep_${VERSION}.sif \
    /derivatives/nii /out participant \
    --fs-license-file /opt/freesurfer/license.txt \
    --output-resolution 1.3 \
    --work-dir ${WORK_DIR} \
    --unringing-method mrdegibbs --denoise-method dwidenoise \
    --participant_label ${subjectID} \
    --separate_all_dwis \
    --skip-anat-based-spatial-normalization \
    --nthreads ${ncpus} \
    --omp-nthreads $((ncpus - 2)) \
    --bids-filter-file ${BIDS_FILTER_FILE} \
    --stop-on-first-crash \
    -v -v

with BIDS_FILTER_FILE pointing to a file with the following content:

{
    "t1w": {
        "acquisition": "precontrast"
    }
}

If I don’t set the BIDS_FILTER_FILE, qsiprep uses the post-contrast T1w as default T1w. With the filter, it uses the correct one, but it doesn’t align all the other T1s to it, which would be nice. Is it possible to do that? Or is it something I should do manually afterwards?

Full current output structure
derivatives/qsiprep
├── dataset_description.json
├── dwiqc.json
├── logs
│   ├── CITATION.bib
│   ├── CITATION.html
│   ├── CITATION.md
│   └── CITATION.tex
├── sub-01
│   ├── anat
│   │   ├── sub-01_desc-aseg_dseg.nii.gz
│   │   ├── sub-01_desc-brain_mask.nii.gz
│   │   ├── sub-01_desc-preproc_T1w.nii.gz
│   │   ├── sub-01_dseg.nii.gz
│   │   ├── sub-01_from-T1wACPC_to-T1wNative_mode-image_xfm.mat
│   │   └── sub-01_from-T1wNative_to-T1wACPC_mode-image_xfm.mat
│   ├── figures
│   │   ├── sub-01_seg_brainmask.svg
│   │   ├── sub-01_ses-02_acq-HARDI_carpetplot.svg
│   │   ├── sub-01_ses-02_acq-HARDI_coreg.svg
│   │   ├── sub-01_ses-02_acq-HARDI_desc-resampled_b0ref.svg
│   │   ├── sub-01_ses-02_acq-HARDI_dwi_denoise_ses_02_acq_HARDI_dwi_wf_denoising.svg
│   │   ├── sub-01_ses-02_acq-HARDI_dwi_denoise_ses_02_acq_HARDI_dwi_wf_unringing.svg
│   │   ├── sub-01_ses-02_acq-HARDI_final_denoise_wf_biascorr.svg
│   │   └── sub-01_ses-02_acq-HARDI_sampling_scheme.gif
│   ├── log
│   │   └── ...
│   │       └── qsiprep.toml
│   └── ses-02
│       ├── anat
│       │   └── sub-01_ses-02_acq-precontrast_from-orig_to-T1w_mode-image_xfm.txt
│       └── dwi
│           ├── sub-01_ses-02_acq-HARDI_confounds.tsv
│           ├── sub-01_ses-02_acq-HARDI_desc-ImageQC_dwi.csv
│           ├── sub-01_ses-02_acq-HARDI_desc-SliceQC_dwi.json
│           ├── sub-01_ses-02_acq-HARDI_dwiqc.json
│           ├── sub-01_ses-02_acq-HARDI_space-T1w_desc-brain_mask.nii.gz
│           ├── sub-01_ses-02_acq-HARDI_space-T1w_desc-eddy_cnr.nii.gz
│           ├── sub-01_ses-02_acq-HARDI_space-T1w_desc-preproc_dwi.b
│           ├── sub-01_ses-02_acq-HARDI_space-T1w_desc-preproc_dwi.bval
│           ├── sub-01_ses-02_acq-HARDI_space-T1w_desc-preproc_dwi.bvec
│           ├── sub-01_ses-02_acq-HARDI_space-T1w_desc-preproc_dwi.nii.gz
│           ├── sub-01_ses-02_acq-HARDI_space-T1w_desc-preproc_dwi.txt
│           └── sub-01_ses-02_acq-HARDI_space-T1w_dwiref.nii.gz
└── sub-01.html

If you have any thoughts on the BIDS naming of the various T1s, I’d be happy to hear them as well.

Thanks :slight_smile:

I don’t know much about your T1ws, but it seems like the ce entity (i.e., Contrast Enhancing Agent) might be more appropriate for the gadolinium run.

I don’t think QSIPrep will process all three T1ws. I would recommend running those T1ws through sMRIPrep first. That should produce the transforms between images you want.

ah, thanks for the ce link, I forgot about this entity! will update to use it.

1 Like

The main question remains though: can QSIPrep handle multiple T1s like that? Ideally, it would use the T1pre contrast to do all the work, and align the others to it.

If it can’t do that, what is the best way to go:

  • register other T1 to native T1pre, then use QSIPrep transform to put in QSIPrep space
  • or register directly with QSIPrep T1?

Thanks!

Hi @pierre-nedelec! I’d suggest using the filter to pick the best T1w for coregistering the dwi to and for normalizing to MNI. Then after qsiprep runs, register the other T1ws to the preprocessed T1w.

The anatomical workflow always tries to find a single image to define the brain for that subject/session and if it finds more than 1 they will all be registered and averaged together. I don’t recall off the top of my head if all the individual transforms are saved in the outputs. Also, you probably don’t want to have an average of contrast and no contrast being used for registration to MNI.

1 Like

Ok thank you! I’ll try that