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

'measurement frame' field must be a double matrix, fixes #76 #77

Merged
merged 2 commits into from
Jan 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion nrrd/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def _get_field_type(field, custom_field_map):
elif field in ['space origin']:
return 'double vector'
elif field in ['measurement frame']:
return 'int matrix'
return 'double matrix'
elif field in ['space directions']:
return 'double matrix'
else:
Expand Down
4 changes: 2 additions & 2 deletions nrrd/tests/data/test_simple4d_raw.nrrd
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ sizes: 1 1 1 1
space directions: (1.5,0,0) (0,1.5,0) (0,0,1) none
endian: little
encoding: raw
measurement frame: (1,0,0) (0,1,0) (0,0,1)
measurement frame: (1.0001,0,0) (0,1.0000000006,0) (0,0,1.000000000000009)

������?
������?
9 changes: 5 additions & 4 deletions nrrd/tests/test_reading.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from nrrd.tests.util import *
import nrrd


class TestReadingFunctions(unittest.TestCase):
def setUp(self):
self.expected_header = {u'dimension': 3,
Expand Down Expand Up @@ -231,14 +230,16 @@ def test_read_simple_4d_nrrd(self):
[np.NaN, np.NaN, np.NaN]]),
'endian': 'little',
'encoding': 'raw',
'measurement frame': np.array([[1., 0., 0.],
[0., 1., 0.],
[0., 0., 1.]])}
'measurement frame': np.array([[1.0001, 0., 0.],
[0., 1.0000000006, 0.],
[0., 0., 1.000000000000009]])}


data, header = nrrd.read(RAW_4D_NRRD_FILE_PATH)

np.testing.assert_equal(header, expected_header)
np.testing.assert_equal(data.dtype, np.float64)
np.testing.assert_equal(header['measurement frame'].dtype, np.float64)
np.testing.assert_equal(data, np.array([[[[0.76903426]]]]))

# Test that the data read is able to be edited
Expand Down