DWIToDTIEstimation: Error reading Mask file, wrong coordinate space

Operating system:
VERSION=“16.04.3 LTS (Xenial Xerus)”
PRETTY_NAME=“Ubuntu 16.04.3 LTS”

Slicer version:
slicer/4.4.0 and slicer/4.8.1 (I got an error using both versions)

Generally, when running the WMA pipeline, I run DTIPrep > DWIToDTIEstimation > DiffusionWeightedVolumeMasking > TractographyLabelMapSeeding. I wanted to create the mask before the tensor estimation step and use the mask to limit the area where the tensor is being calculated. I switched the two steps around and added the mask as an argument in the DWIToDTIEstimation code and got the following error: DWIToDTIEstimation: Error reading Mask file, wrong coordinate space

I looked for a solution online and found this: http://massmail.spl.harvard.edu/public-archives/slicer-users/2013/006314.html

As suggested in this link, I ran the estimation once without a mask and then used the baseline volume to regenerate the mask and tried re-running DWIToDTIEstimation with this mask but got the same error.

Please let me know if you need any more information to debug this issue.

Saba Shahab

Could you please try if latest Slicer nightly version works well?

I used the latest Slicer nightly version (updated as of 2018-08-20) and got this error message:

DWIToDTIEstimation: Error reading Mask file, wrong coordinate space
vtkDebugLeaks has found no leaks.

Here is the code I am running: https://github.com/sabashahab/STOPPD_DTI/blob/master/SlicerTractography_edit.sh

I believe the following is happening:

  • The output DWI from DTIPrep is probably in ITK’s native LPS.

  • Slicer’s NRRD reader (used by DWVolumeMasking) “reorients” the volume while loading, such that the transformation matrix is relative to Slicer’s native RAS. This is technically an identity operation, but when the mask volume is saved, the resulting transform is different than the input DWI.

  • Then DWToDTIEstimation checks that the mask and DWI transforms are equal, but only looks at the transformation matrices, and does not account for the fact that the image is (technically) the same (relative to the embedding NRRD space-directions).

So, in light of that, in the short term I think the quickest solution is to use the OrientScalarVolume module to change the mask image back to the same “space directions” as found in the DTIPrep output.

Assuming the DTIPrep output is indeed LPS (check the NRRD header “space directions” field), then you could try adding a step to your script – something like this:

OrientImage -o LPS  ${outputfolder}/${stem}_MASK.nrrd ${outputfolder}/${stem}_MASK_lps.nrrd

(and the input mask file for DWIToDTIEstim step would correspondingly change to

Hi Isaiah,

Thanks for your response. I tried OrientScalarVolume (OrientImage didn’t show up as a module) and it didn’t fix the problem.

But the following worked:

ResampleScalarVectorDWIVolume -R ${outputfolder}/${stem}_QCed.nrrd ${outputfolder}/${stem}_MASK.nrrd ${outputfolder}/${stem}_MASK_oriented.nrrd

1 Like