Skip to content

Commit

Permalink
Update 'measurement frame' field to be a double matrix (#77)
Browse files Browse the repository at this point in the history
Fixes #76
  • Loading branch information
ihnorton authored and addisonElliott committed Jan 18, 2019
1 parent 3b084ed commit c1c42d9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
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

0 comments on commit c1c42d9

Please sign in to comment.