Tolerance for dw_scheme differences on header merge#3027
Merged
jdtournier merged 2 commits intomasterfrom Feb 12, 2025
Merged
Conversation
This prevents the diffusion gradient table from being discarded when merging the key-value contents of two image headers (eg. mrcalc, mrmath) due to inconsequential differences in their string representations from floating-point imprecision. Closes #3015.
jdtournier
approved these changes
Feb 12, 2025
Lestropie
added a commit
that referenced
this pull request
Jun 5, 2025
Following #3027 in version 3.0.5, commands could produce an erroneous warning whenever concatenating images along the volume axis where those images contained diffusion gradient tables that did not match. Where concatenation occurrs along the volume axis, the gradient table itself gets concatenated rows. This was operating correctly, but underlying function Header::merge_keyval() was issuing erroneous earnings regarding an inability to merge the gradient tables directly prior to the concatenation operation taking place. This could occur if using the multi-file numbered image capability acorss volumes, or if concatenating across image series that contain different gradient tables.
Lestropie
added a commit
that referenced
this pull request
Aug 26, 2025
Following #3027 in version 3.0.5, commands could produce an erroneous warning whenever concatenating images along the volume axis where those images contained diffusion gradient tables that did not match. Where concatenation occurrs along the volume axis, the gradient table itself gets concatenated rows. This was operating correctly, but underlying function Header::merge_keyval() was issuing erroneous earnings regarding an inability to merge the gradient tables directly prior to the concatenation operation taking place. This could occur if using the multi-file numbered image capability acorss volumes, or if concatenating across image series that contain different gradient tables.
Merged
Lestropie
added a commit
that referenced
this pull request
Sep 3, 2025
- dwifslpreproc: Fix F-string with no variable resolution. - mrtrix3.fsl: Update to reflect move from path.name_temporary() to utils.name_temporary(). - Move new test dwscheme_preservation_imprecision from #3027, duplicated for 3.1.0 in 568b28e, to binaries/mrcalc directory: the test is not specific to mrcalc, and so had been placed in the unit_tests/ directory, but it depends on data only available in the binary test data repository.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #3015.
As part of this change, I decided that the "b=0 threshold" is more appropriate in
dwi/gradient.hrather thandwi/shells.h, since it may be applied to individual volumes rather than shells. Here it's used to say "if two images both have a b=0 volume here, then their diffusion gradient tables are compatible; I don't care if their unit directions are different".Also fixed some transitive includes in the process.
The new tests should hopefully demonstrate the fix:
dw_scheme" entries only have to differ by one least significant digit to result in the whole diffusion gradient table being discarded.(They also neatly demonstrate why having just a list of tests per command is restrictive;
with
ctestI'll be able to name these tests according to what they are actually evaluating,which isn't specific to any one command)