Our lab is curious about the definition of “space-T1” in qsiprep’s recon pipeline using amico noddi. We are using the pipeline successfully with some multi-shell dwi and the following code:
Our issue is that output (i.e. sub-02_acq-b0b1000b2000_dir-AP_space-T1w_desc-preproc_desc-OD_NODDI.nii.gz) doesn’t align with our T1s, and we’ve been using FSL’s epi_reg to align the output.
My first question: qsiprep assigns the T1 label for “space”, but does it mean it should be aligned to the T1, or am I interpreting that label incorrectly?
Second question: is there an easy transform using ANTs and qsiprep outputs that would allow us to bypass FSL? Which qsiprep outputs would I point to?
It is aligned to the qsiprep preprocessedT1 which is rotated to AC-PC orientation.
Yes! This should be in the qsiprep anatomical output folder in recent versions. E.g., anat/sub-01_from-T1wNative_to-T1wACPC_mode-image_xfm. ANTS is used in most qsiprep registration workflows.
Hi @Steven , by coincidence I was working on this exact same issue today, trying to use anat/sub-01_from-T1wNative_to-T1wACPC_mode-image_xfm.mat to transform my raw T1w image from native space to ACPC space with ANTs but with no success so far.
Am I doing something wrong or is there something missing (deobliquing, moving to LPS…)?
(I also tried the opposite transform sub-01_from-T1wACPC_to-T1wNative_mode-image_xfm.mat but it is not the solution either)
I did try this, and also the template image and the _space-T1w_dwiref.nii.gz image as reference for antsApplyTransforms but it doesn’t change the output image orientation: I think the reference image in this command tells just the resolution and the bounding box of the output image…
Hmm, that’s odd the xfm isn’t working as is, I’ll look into that. But otherwise you should be able to calculate a rigid transform between your two T1s and use that as the native-to-acpc xfm.
We only recently started storing this transform in the derivatives. The main reason for not storing it was that the transform alone isn’t always enough to get the native T1w aligned to the T1w-ACPC. Before alignment, the raw T1w is deobliqued using just the affine and then reoriented to LPS+. This ensures that the image doesn’t lose any precision and goes through the various ITK programs without causing any errors. If your raw T1w isn’t oblique the transforms should work to go from raw to T1w-ACPC.
The output is SO CLOSE - just slightly tilted (in the AC-PC plane?) as compared to the alignment we get using epi_reg. Just to clarify, we are trying to get the ODI back into the native T1 space for some surface mapping.
I’ve also tried using the full T1 (not skull stripped) as the reference image. It’s still slightly misaligned.
Please excuse my ignorance on this, but how can I tell if my raw T1 is oblique and causing issues?
Any ideas are appreciated!!
Just for fun: an overlay with the original ODI, the T1 and the transformed ODI (slightly misaligned - you can see it when you play with the transparency).
As my data is natively oblique, the transforms sub-SUB_from-T1wACPC_to-T1wNative_mode-image_xfm.mat and sub-SUB_from-T1wNative_to-T1wACPC_mode-image_xfm.mat are not useful in a straightforward manner.
As suggested, what works is to compute the rigid transformation from the native space to the ACPC space with antsRegistration (or easier with antsRegistrationSyNQuick.sh):
native_to_ACPC_0GenericAffine.mat: rigid transformation from native T1w to T1w in ACPC space
native_to_ACPC_Warped.nii.gz: native T1w image wrapped into ACPC space
native_to_ACPC_InverseWarped.nii.gz: ACPC T1w wraped into T1w native space
If you want to transform an image from the native space to the T1w ACPC space you would just need to use antsapplyTransforms: antsApplyTransforms -d 3 -i your_image_in_native_space.nii.gz -r sub-JEU02_desc-preproc_T1w.nii.gz -t native_to_ACPC_0GenericAffine.mat -o your_image_in_ACPC_space.nii.gz -n LanczosWindowedSinc
and if you want to do the inverse to project an image from ACPC space to the T1w native space, you could inverse the transform using [ name_of_transform , 1 ]: antsApplyTransforms -d 3 -i your_image_in_ACPC_space.nii.gz -r sub-SUB_ses-01_T1w_orig.nii.gz -t [native_to_ACPC_0GenericAffine.mat,1] -o your_image_in_native_space.nii.gz -n LanczosWindowedSinc
I have a related question: Do you think it makes a difference using ANTs or simply go with FSL’s FLIRT in here? I’m doing ACT with MRtrix (outside QSIprep) and plan to bring the 5ttgen hsvs outputs in the native to the dMRI (T1wACPC) space and in my experience, it is much simpler to transform with flirt matrices with mrtransform.
The HSVS workflows should be fixed in the recent release of qsiprep/recon, which will provide what you’re looking for. Otherwise, I tend to prefer ANTs.