-export_grad_fsl fix for highly non-RAS acquisitions #2912
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Here we go again...
So I was left scratching my head at this one for quite some time. I am trying to get to #2477 among other things, but was seemingly having issues at the
bvec
write stage, which meant I couldn't yet trust anything I was observing at thebvec
read stage.Eigen function
.rotation()
was being used, which is not the same as.linear()
. For a DICOM DWI series acquired on a Siemens magnet with a sagittal plane, these two functions yield very different results. I'm sure we've had at least one issue in the past with conflating these two, though haven't had success in finding anything on GitHub (@MRtrix3/mrtrix3-devs anyone with better recollection?).Code was doing a post-multiply with the image2scanner transform in order to do a scanner2image transformation., rather than constructing the scanner2image transform and using that.
Code was doing a scanner2image transformation based on the transformation for the internal in-memory representation of the header, and then performing subsequent permutations & flips based on the secondary output of the
File::NIfTI::adjust_transform()
function and the internal strides, knowing that at NIfTI export time there would be similar modifications applied. However theFile::NIfTI::adjust_transform()
function returns what will become the header transformation of the output image. So it seems to me that if one wants to perform an image2scanner transformation of gradient directions that will correspond to the output image, and one has what will be the transformation of the output image, might as well do it in one step?I'm reasonably confident given the test data & tool I have:
dwi2tensor
outputs:DICOM
mrconvert
ed to NIfTI /bvec
/bval
, both with & without internal header transform realignmentIn the absence of this change, the specific combination of sagittally-acquired DICOM DWI data, running
mrconvert
to NIfTI /bvec
/bval
with internal header transform realignment disabled, produces an incorrect result.@jdtournier I'll fill in more details in a separate email chain; content to leave as a draft until I can explain the broader project there.