Skip to content

Commit a594e40

Browse files
committed
FIX: Label x/y/z_ras correctly
1 parent c5eb1bd commit a594e40

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

nibabel/freesurfer/mghformat.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -315,9 +315,9 @@ def default_structarr(klass, endianness=None):
315315
hdr_data['type'] = 3
316316
hdr_data['goodRASFlag'] = 1
317317
hdr_data['delta'][:] = np.array([1, 1, 1])
318-
hdr_data['Mdc'][0][:] = np.array([-1, 0, 0]) # x_ras
319-
hdr_data['Mdc'][1][:] = np.array([0, 0, -1]) # y_ras
320-
hdr_data['Mdc'][2][:] = np.array([0, 1, 0]) # z_ras
318+
hdr_data['Mdc'][:, 0] = np.array([-1, 0, 0]) # x_ras
319+
hdr_data['Mdc'][:, 1] = np.array([0, 0, 1]) # y_ras
320+
hdr_data['Mdc'][:, 2] = np.array([0, -1, 0]) # z_ras
321321
hdr_data['Pxyz_c'] = np.array([0, 0, 0]) # c_ras
322322
hdr_data['mrparms'] = np.array([0, 0, 0, 0])
323323
return hdr_data
@@ -327,9 +327,9 @@ def _set_affine_default(self):
327327
'''
328328
self._structarr['goodRASFlag'] = 1
329329
self._structarr['delta'][:] = np.array([1, 1, 1])
330-
self._structarr['Mdc'][0][:] = np.array([-1, 0, 0]) # x_ras
331-
self._structarr['Mdc'][1][:] = np.array([0, 0, -1]) # y_ras
332-
self._structarr['Mdc'][2][:] = np.array([0, 1, 0]) # z_ras
330+
hdr_data['Mdc'][:, 0] = np.array([-1, 0, 0]) # x_ras
331+
hdr_data['Mdc'][:, 1] = np.array([0, 0, 1]) # y_ras
332+
hdr_data['Mdc'][:, 2] = np.array([0, -1, 0]) # z_ras
333333
self._structarr['Pxyz_c'][:] = np.array([0, 0, 0]) # c_ras
334334

335335
def writehdr_to(self, fileobj):

0 commit comments

Comments
 (0)