Qsiprep output in MNI space

Hello!

Im running qsiprep 0.15.04 with the following code. I am trying to use the --template MNI152NLin2009cAsym and --output-space template flags as I would like to have the output files in MNI space. However, once the preprocessing is complete, while there are anat derivatives in MNI space as well as .h5 files for T1w-to-MNI and vice versa, there are no dwi derivatives in MNI space. How can I get the dwi derivatives in T1w space?

Code:

singularity run --cleanenv --contain \
-B ${BIDS_DIR_TMP}/:/data_in \
-B ${BIDS_DIR}/:${BIDS_DIR} \
-B ${SCRIPTS_DIR}/:${SCRIPTS_DIR} \
-B ${BIDS_DIR}/derivatives:/data_out \
-B ${WORK_DIR}:/work \
/data/container/qsiprep/qsiprep-0.15.4.sif \
/data_in \
/data_out \
participant \
-w /work \
   --participant_label ${sub}${ses/-/} \
   --skip_bids_validation \
   --unringing-method mrdegibbs \
   --output-space template \
   --template MNI152NLin2009cAsym \
   --output-resolution 1.25 \
   --hmc-model eddy \
   --fs-license-file ${SCRIPTS_DIR}/license.txt \
   --eddy_config ${SCRIPTS_DIR}/tmp/eddy_params.json \
   --output-space template \
   --template MNI152NLin2009cAsym \
   --nthreads ${SLURM_CPUS_PER_TASK:-1} \
   -vv

Output in derivatives folder for one subject:

├── anat
│   ├── sub-905sesA_desc-brain_mask.nii.gz
│   ├── sub-905sesA_desc-preproc_T1w.nii.gz
│   ├── sub-905sesA_dseg.nii.gz
│   ├── sub-905sesA_from-MNI152NLin2009cAsym_to-T1w_mode-image_xfm.h5
│   ├── sub-905sesA_from-orig_to-T1w_mode-image_xfm.txt
│   ├── sub-905sesA_from-T1w_to-MNI152NLin2009cAsym_mode-image_xfm.h5
│   ├── sub-905sesA_label-CSF_probseg.nii.gz
│   ├── sub-905sesA_label-GM_probseg.nii.gz
│   ├── sub-905sesA_label-WM_probseg.nii.gz
│   ├── sub-905sesA_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz
│   ├── sub-905sesA_space-MNI152NLin2009cAsym_desc-preproc_T1w.nii.gz
│   ├── sub-905sesA_space-MNI152NLin2009cAsym_dseg.nii.gz
│   ├── sub-905sesA_space-MNI152NLin2009cAsym_label-CSF_probseg.nii.gz
│   ├── sub-905sesA_space-MNI152NLin2009cAsym_label-GM_probseg.nii.gz
│   └── sub-905sesA_space-MNI152NLin2009cAsym_label-WM_probseg.nii.gz
├── dwi
│   ├── sub-905sesA_confounds.tsv
│   ├── sub-905sesA_desc-ImageQC_dwi.csv
│   ├── sub-905sesA_desc-SliceQC_dwi.json
│   ├── sub-905sesA_dwiqc.json
│   ├── sub-905sesA_space-T1w_desc-brain_mask.nii.gz
│   ├── sub-905sesA_space-T1w_desc-eddy_cnr.nii.gz
│   ├── sub-905sesA_space-T1w_desc-preproc_dwi.b
│   ├── sub-905sesA_space-T1w_desc-preproc_dwi.bval
│   ├── sub-905sesA_space-T1w_desc-preproc_dwi.bvec
│   ├── sub-905sesA_space-T1w_desc-preproc_dwi.nii.gz
│   └── sub-905sesA_space-T1w_dwiref.nii.gz
└── figures
    ├── sub-905sesA_carpetplot.svg
    ├── sub-905sesA_coreg.svg
    ├── sub-905sesA_desc-resampled_b0ref.svg
    ├── sub-905sesA_desc-sdc_b0.svg
    ├── sub-905sesA_dwi_denoise_dwi_wf_biascorr.svg
    ├── sub-905sesA_dwi_denoise_dwi_wf_denoising.svg
    ├── sub-905sesA_dwi_denoise_dwi_wf_unringing.svg
    ├── sub-905sesA_sampling_scheme.gif
    ├── sub-905sesA_seg_brainmask.svg
    └── sub-905sesA_t1_2_mni.svg

Hi,

Those flags that you mentioned that specify MNI space are deprecated and no longer used. QSIPrep only outputs in T1w space.

Moving DWI images to MNI is nontrivial, since you have to account for rotation of the B-matrix. What’s common to do is to wait to move to MNI until you have your final DWI derivative, whether that is some DTI scalar (e.g, FA) or a set of streamlines.

Also, you might want to rename your subjects. It is unconditional in BIDS to have session be part of the subject label.

Best,
Steven

Hi Steven, thanks for the quick response!

Ah, I see. How would the spatial normalization to MNI be carried out at that stage then?

Re. the subject naming - we have the the data in standard BIDS format, but we have multiple sessions with multipe types of data for each subject, so the BIDS data is more or less in the format of the following below (a concatenated example).

However I was having trouble getting the script to recognize the BIDS folder with this format of sub-xxx/ses-A and so on, and so am testing on a broken BIDS version at the moment. Would you be able to suggest how I could adapt the code to identify seperate sessions (saved within seperate sub folders within a participants folder)?

sub-002221
├── ses-A
│   ├── anat
│   ├── dwi
│   ├── fmap
│   ├── func
│   ├── sub-002221_ses-A_scans.json
│   └── sub-002221_ses-A_scans.tsv
├── ses-D
     ├── anat
     ├── dwi
     ├── fmap
     ├── func
     ├── sub-002221_ses-D_scans.json
     └── sub-002221_ses-D_scans.tsv

For spatial normalization, it depends on what your are transforming. If it is a scalar map, it is as simple as using ANTs to apply the T1-to-MNI transform in the H5 file to the scalar map. For streamlines, DIPY should have some good tutorials for transforming streamlines between space.

I’ll need more info on the error you were getting to fix the BIDS problems.

Best,
Steven