Skip to content

Commit 582b5ec

Browse files
committed
BF: get the correct dtype
1 parent 54e0a03 commit 582b5ec

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

nibabel/freesurfer/mghformat.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,18 @@
4646
# caveat 2: Note that the bytespervox you get is in str ( not an int)
4747
_dtdefs = ( # code, conversion function, dtype, bytes per voxel
4848
(0, 'uint8', '>u1', '1', 'MRI_UCHAR', np.uint8, np.dtype(np.uint8),
49-
np.dtype(np.uint8).newbyteorder('B')),
49+
np.dtype(np.uint8).newbyteorder('>')),
5050
(4, 'int16', '>i2', '2', 'MRI_SHORT', np.int16, np.dtype(np.int16),
51-
np.dtype(np.int16).newbyteorder('B')),
51+
np.dtype(np.int16).newbyteorder('>')),
5252
(1, 'int32', '>i4', '4', 'MRI_INT', np.int32, np.dtype(np.int32),
53-
np.dtype(np.int32).newbyteorder('B')),
53+
np.dtype(np.int32).newbyteorder('>')),
5454
(3, 'float', '>f4', '4', 'MRI_FLOAT', np.float32, np.dtype(np.float32),
55-
np.dtype(np.float32).newbyteorder('B')))
55+
np.dtype(np.float32).newbyteorder('>')))
5656

5757
# make full code alias bank, including dtype column
5858
data_type_codes = Recoder(_dtdefs, fields=('code', 'label', 'dtype',
5959
'bytespervox', 'mritype',
60+
'np_dtype1', 'np_dtype2',
6061
'numpy_dtype'))
6162

6263

@@ -274,7 +275,7 @@ def set_zooms(self, zooms):
274275
'''
275276
hdr = self._header_data
276277
zooms = np.asarray(zooms)
277-
if len(zooms) != hdr['delta']:
278+
if len(zooms) != len(hdr['delta']):
278279
raise HeaderDataError('Expecting %d zoom values for ndim'
279280
% hdr['delta'])
280281
if np.any(zooms < 0):

0 commit comments

Comments
 (0)