Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusing representation of "space direction" #148

Closed
maunzzz opened this issue Jan 23, 2024 · 0 comments · Fixed by #157
Closed

Confusing representation of "space direction" #148

maunzzz opened this issue Jan 23, 2024 · 0 comments · Fixed by #157

Comments

@maunzzz
Copy link

maunzzz commented Jan 23, 2024

Hi,
I've recently been working with MONAI that optionally uses pynrrd to read .nrrd and has an error when handling the space direction.
The way the variable space direction is read by pynrrd (in the 3d case as a 3x3 matrix) makes it easy to misinterpret as the upper left 3x3 part of the affine matrix (this is what is done in MONAI).
However, the matrix loaded by pynrrd is the transpose of the upper left 3x3 part of the affine matrix.

Loading the space direction variable to a matrix might cause this confusion, an alternative would be to instead load it as a list of vectors.

addisonElliott added a commit that referenced this issue Nov 5, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
…ption (#157)

## Changes

* Add `int vector list` and `double vector list` datatypes that are lists of Numpy arrays or `None`.
    * These new types are similar to their `int matrix` and `double matrix` counterparts except they are **not** 2D Numpy matrices.
 * Add `nrrd.SPACE_DIRECTIONS_TYPE` to enable switching the datatype for the `space directions` field.
    * Valid options are `double matrix` or `double vector list`. The current default is `double matrix` for backwards compatibility but will be switched to `double vector list` in the next major release.
    * `double vector list` is superior over `double matrix` because it doesn't have the confusing row-of-NaN's representation and it doesn't imply an affine transform by being a matrix.
* Support row-of-None in addition to row-of-NaN for `parse_optional_matrix` & `format_optional_matrix` in addition to new vector list parsing/formatting functions

Fixes #148
Revises #149
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 a pull request may close this issue.

1 participant