You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improve Orientation transform to use the "space" (LPS vs RAS) of a metatensor by default (#8473)
Fix for #8467 ### Description As detailed in #8467, the `Orientation` transform currently always assumes a tensor's affine matrix is in RAS, regardless of the `meta["space"]` attribute, leading to incorrect performance for LPS metatensors unless the `labels` are explicitly defined by the user (and it is not at all clear that this needs to be done or how it should be done). The code in this PR checks whether the input tensor is a metatensor with its affine defined in LPS space. If so, it adjusts the `labels` passed to `nibabel.orientations.axcodes2ornt` to give the expected behaviour for LPS tensors. The default value of the `labels` parameter of the `Orientation` transform (and `OrientationD`) has changed from `(('L', 'R'), ('P', 'A'), ('I', 'S'))` to `None`. However, since the behaviour of `nibabel.orientations.axcodes2ornt` when passed `labels=None` is equivalent to when passing `labels=(('L', 'R'), ('P', 'A'), ('I', 'S'))`, I would not consider this a breaking change. ### Types of changes <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [x] Non-breaking change (fix or new feature that would not break existing functionality). - [ ] Breaking change (fix or new feature that would cause existing functionality to change). - [x] New tests added to cover the changes. - [x] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [x] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [x] In-line docstrings updated. - [x] Documentation updated, tested `make html` command in the `docs/` folder. --------- Signed-off-by: Chris Bridge <chrisbridge44@googlemail.com> Signed-off-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com> Co-authored-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com> Co-authored-by: YunLiu <55491388+KumoLiu@users.noreply.github.com>
0 commit comments