Mrconvert shifts orientation of an mrtransform ed image

Hi Experts,

I have been trying to convert an aparc+aseg parcellation image that has been brought to the Diffusion space, from a .mif to a .nii.gz image, for the purpose of extracting specific ROIs from this image to be used in tractography. I did perform the following steps:

  1. Register b0 to T1 using FSL’s flirt and save the inverse transform
  2. Convert the inverse transform to mrtrix format using transformconvert
  3. Apply this transform to the aparc+aseg image converted to .mif format using mrtransform to form nodes.mif - aparc+aseg image in .mif format and in diffusion space.

Everything worked fine and the registration gave really good results. However, when I convert the resulting nodes.mif image into a nifti file using mrconvert, the output (nodes.nii.gz) seems to be misaligned with the .mif image(Screenshots attached). Kindly suggest what could have gone wrong.

Regards,
Archith

Everything worked fine and the registration gave really good results. However, when I convert the resulting nodes.mif image into a nifti file using mrconvert, the output (nodes.nii.gz) seems to be misaligned with the .mif image.

From your description here, it sounds as though the issue that you’re reporting is in fact independent of the registration and transformation steps that you described prior to this point: the issue is that upon simply converting a .mif image to a .nii, those two images do not align with one another in space.

Given the frequency with which this operation has been performed over the years it would seem unusual that it would suddenly lead to such an egregious error. Can you please double-check that the data you are visualising were in fact generated based on precisely the description you’ve given here?

Dr. Smith,
I have double checked and the data visualized are generated precisely on the description above.
I’m not sure if it is entirely independent of the registration and transformation steps, as this error occurs only on an image that had undergone mrtransform.
Also, I think the error is specific to this dataset, as the same commands on a different dataset did not give any errors.
Regards,
Archith

Reading my crystal ball, I suspect you did not regrid the image using mrtransform's -template option and used an affine transformation?

In that case mrtransform applies the transformation to the header, resulting in a non-orthogonal coordinate system (you should have seen a warning about that). This is not necessarily a problem but converting this file to nifti results in the misalignment you observed. You should get more warnings about a mismatch in sform and qform when you inspect that nifti with mrinfo. To fix this, use the target image as the argument to the -template option.

If the above is not the case, what is the output of mrinfo of the transformed .mif and the corresponding .nii files?

Dr Pietsch,

It was indeed the case.Thank you very much for the diagnosis. But however, if I were to not regrid the T1 parcellation from the original resolution and use mrcalc/mrmath to threshold and extract a few labels from the parcellated .mif image, what would be a workaround?

Regards,
Archith

Do you have any reason not to apply mrcalc/mrmath/mrthreshold/… to the label image in T1-space before transforming the output of that operation to diffusion space?

No solid reason, apart from that there would be multiple calls made to mrtransform since I have a number of Rois to be extracted