mhe / pynrrd

Simple pure-python module for reading and writing nrrd files.
https://pynrrd.readthedocs.io/
MIT License
116 stars 51 forks source link

Confusing representation of "space direction" #148

Closed maunzzz closed 2 weeks ago

maunzzz commented 10 months ago

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.