Skip to content

Reorientation to Canonical RAS with gradient support#1310

Open
frheault wants to merge 9 commits intoscilus:dev_3.0.xfrom
frheault:reorient_part_2_fix
Open

Reorientation to Canonical RAS with gradient support#1310
frheault wants to merge 9 commits intoscilus:dev_3.0.xfrom
frheault:reorient_part_2_fix

Conversation

@frheault
Copy link
Member

@frheault frheault commented Feb 24, 2026

Quick description

This PR is the second part of the StatefulImage transition to fully support default orientation to RAS to increase interoperalibity with mrtrix.

Here is testing data:
https://drive.google.com/file/d/1jsyiL1w9jkFvovOJ7f2AUWT1ifiNl81r/view?usp=sharing

Overall the idea is that either your bvecs and your DWI are already compatible now you can load them together and it internally flip/swap axes to canonical RAS orientation for fitting, modelling and tracking. So this is a minimal set of modifications to have a good idea if the sequence of steps is working.

If your bvecs are an orientation problem, I have now changed the scil_gradients_validate_correct script to reorient your bvecs to fit the DWI in any strides (or voxel order) and be ready for DTI or FODF fit. Extensions to future scripts, such as msmt, COMMIT, fixels or others, will be done later as it requires more thinking and this PR is big enough by itself.

This breaks previously processed DTI, evecs, FOD and peaks. But it does works much better with mrtrix and avoid manual change to 1,2,3 stride.

...

Type of change

Check the relevant options.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Provide data, screenshots, command line to test (if relevant)

...

Checklist

  • My code follows the style guidelines of this project (run autopep8)
  • I added relevant citations to scripts, modules and functions docstrings and descriptions
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I moved all functions from the script file (except the argparser and main) to scilpy modules
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@frheault frheault requested a review from arnaudbore February 26, 2026 09:49
@frheault
Copy link
Member Author

@arnaudbore Are the tests running normally? Or should I do something to trigger them?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant