qsiprep icon indicating copy to clipboard operation
qsiprep copied to clipboard

processed image is neither in T1 nor in MNI space

Open meet10may opened this issue 3 years ago • 9 comments

Hi Matt,

I have noticed the following few issues while preprocessing our multi-shell DWI data. Could you please help me in resolving these issues!

  1. The preprocessed data (sub-10003_ses-V1_space-T1w_desc-preproc_dwi.nii.gz) is neither in T1 space nor in MNI space. Please see the attached images (one is overlayed with T1 and the other is overlayed with standard image). I had specifically used the --ouput-space T1w to make sure that the outputs are saved in T1w space. Here is my command
singularity run -e --nv \
 -B /tnath/data:/tnath/data \
  docker://pennbbl/qsiprep:0.14.2 \
  /tnath/UI10003V1/ /tnath/UI10003V1-qsiprep \
  participant \
  --output-resolution 1.7 \
  --denoise-method patch2self \
  --unringing-method mrdegibbs \
  --hmc_model eddy --eddy_config eddy_params.json \
  --fs-license-file license.txt \
  -w /tnath/UI10003V1-qsiprep \
  --output-space T1w \
  --participant_label 10003 -vvv

  1. For some reason, the orientation of the pre-processed data is also changed to LPS. I want to preserve the same orientation as the original image. Please see the attachment
  2. The output images like carpet plot, brain segmentation, etc. are not embedded in the HTML report. For e.g. the reportlets directory contains a file sub-10003_summary.html which only has information about data but the results of the T1 processing is not embedded in the file.
  3. The outputs are weirdly organized. i.e. there are 2 anat directories; one inside the ses-v1 and one outside the ses-v1. The one outside ses-v1 contains the outputs but the other anat has only txt file
qsiprep
│   ├── dataset_description.json
│   ├── dwiqc.json
│   ├── logs
│   │   ├── CITATION.html
│   │   ├── CITATION.md
│   │   └── CITATION.tex
│   ├── sub-10003
│   │   ├── anat
│   │   │   ├── sub-10003_desc-brain_mask.nii.gz
│   │   │   ├── sub-10003_desc-preproc_T1w.nii.gz
│   │   │   ├── sub-10003_dseg.nii.gz
│   │   │   ├── sub-10003_from-MNI152NLin2009cAsym_to-T1w_mode-image_xfm.h5
│   │   │   ├── sub-10003_from-T1w_to-MNI152NLin2009cAsym_mode-image_xfm.h5
│   │   │   ├── sub-10003_label-CSF_probseg.nii.gz
│   │   │   ├── sub-10003_label-GM_probseg.nii.gz
│   │   │   ├── sub-10003_label-WM_probseg.nii.gz
│   │   │   ├── sub-10003_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz
│   │   │   ├── sub-10003_space-MNI152NLin2009cAsym_desc-preproc_T1w.nii.gz
│   │   │   ├── sub-10003_space-MNI152NLin2009cAsym_dseg.nii.gz
│   │   │   ├── sub-10003_space-MNI152NLin2009cAsym_label-CSF_probseg.nii.gz
│   │   │   ├── sub-10003_space-MNI152NLin2009cAsym_label-GM_probseg.nii.gz
│   │   │   └── sub-10003_space-MNI152NLin2009cAsym_label-WM_probseg.nii.gz
│   │   ├── figures
│   │   │   ├── sub-10003_seg_brainmask.svg
│   │   │   ├── sub-10003_ses-V1_carpetplot.svg
│   │   │   ├── sub-10003_ses-V1_coreg.svg
│   │   │   ├── sub-10003_ses-V1_desc-resampled_b0ref.svg
│   │   │   ├── sub-10003_ses-V1_desc-sdc_b0.svg
│   │   │   ├── sub-10003_ses-V1_dwi_denoise_ses_V1_dwi_wf_biascorr.svg
│   │   │   ├── sub-10003_ses-V1_dwi_denoise_ses_V1_dwi_wf_denoising.svg
│   │   │   ├── sub-10003_ses-V1_dwi_denoise_ses_V1_dwi_wf_unringing.svg
│   │   │   ├── sub-10003_ses-V1_sampling_scheme.gif
│   │   │   └── sub-10003_t1_2_mni.svg
│   │   └── ses-V1
│   │       ├── anat
│   │       │   └── sub-10003_ses-V1_from-orig_to-T1w_mode-image_xfm.txt
│   │       └── dwi
│   │           ├── sub-10003_ses-V1_confounds.tsv
│   │           ├── sub-10003_ses-V1_desc-ImageQC_dwi.csv
│   │           ├── sub-10003_ses-V1_desc-SliceQC_dwi.json
│   │           ├── sub-10003_ses-V1_dwiqc.json
│   │           ├── sub-10003_ses-V1_space-T1w_desc-brain_mask.nii.gz
│   │           ├── sub-10003_ses-V1_space-T1w_desc-eddy_cnr.nii.gz
│   │           ├── sub-10003_ses-V1_space-T1w_desc-preproc_dwi.b
│   │           ├── sub-10003_ses-V1_space-T1w_desc-preproc_dwi.bval
│   │           ├── sub-10003_ses-V1_space-T1w_desc-preproc_dwi.bvec
│   │           ├── sub-10003_ses-V1_space-T1w_desc-preproc_dwi.nii.gz
│   │           └── sub-10003_ses-V1_space-T1w_dwiref.nii.gz

  1. If we run the processing with --only-dwi option, QSIprep does not create any figures i.e. no carpet plots etc.

Overlayed over MNI overlay_with_mni

Overlayed over T1

overlay_with_t1

Here is the processed image flipped-orientation

This is the original image (just increased the brightness)

original-image

Thanks

meet10may avatar Sep 24 '21 14:09 meet10may

Are you overlaying the preprocessed DWI on the original T1? QSIPrep will make a T1 reference aligned to ACPC using all T1s available for that subject. The DWI is also aligned to ACPC. The individual session anatomical text files show the transform each T1 takes to get to ACPC.

smeisler avatar Sep 24 '21 15:09 smeisler

Yes, I am using the original T1 image mainly because the T1 reference aligned to ACPC is not present if I use the --dwi-only option. Also, can you please also comment on the other issues? Thanks!

meet10may avatar Sep 24 '21 19:09 meet10may

It makes sense then that the preprocessed DWI will not be aligned to your original T1. The output-space flag is deprecated. All outputs are in ACPC space. If you want to get DWI back to original T1, you can try doing a rigid transform between the T1 and the FA image, which you can create after fitting the DTI tensor on the preprocessed image. Or use the "from_orig_to_t1" transform files created when you did not use dwi_only

In regards to the multiple anat folders per session, those are the transforms between those individual T1s and the ACPC aligned T1 reference. If you would prefer to have individual T1 files (that is, treat keep session separate), you can use the --longitudinal flag.

I'm not a dev, but I can say that I have also replicated the no carpet plot when running dwi_only, but there was another error the happened during the creation of the reports, so I don't know what it would be like in a error-less run. Can you check the subject-specific HTML and see if any errors were reported?

smeisler avatar Sep 24 '21 19:09 smeisler

Thanks, good to know that the output-space is deprecated. Also, is that the reason that the orientation of all the pre-processed DWI images is flipped to LPS?

meet10may avatar Sep 24 '21 20:09 meet10may

I could be wrong, but I think that is because LPS is the standard FSL orientation, and FSL is used for the later stages of processing (EDDY, TOPUP, etc).

smeisler avatar Sep 24 '21 20:09 smeisler

Thanks for your help/suggestions :)

meet10may avatar Sep 24 '21 20:09 meet10may

Hey Tanmay, I wrote a script for doing the transformation that @smeisler suggested. Let me know if you want it.

bwinsto2 avatar Sep 28 '21 04:09 bwinsto2

@bwinsto2 Sure, that would be helpful. Thanks :)

meet10may avatar Sep 28 '21 20:09 meet10may

LPS+ is used because it is the coordinate system used by ITK/ANTs. FSL actually uses LAS+ (RPI) orientation internally.

There is also a recent reconstruction workflow that will convert your outputs to FSL-standard orientation. You can try --recon-spec reorient_fslstd and you'll get bvecs/images in the FSL standard orientation

mattcieslak avatar Oct 15 '21 02:10 mattcieslak