@@ -1233,7 +1233,7 @@ def get_data_shape(self):
1233
1233
from . import cifti2_axes
1234
1234
if len (self .mapped_indices ) == 0 :
1235
1235
return ()
1236
- base_shape = [- 1 for _ in range (max (self .mapped_indices ) + 1 )]
1236
+ base_shape = [- 1 ] * (max (self .mapped_indices ) + 1 )
1237
1237
for mim in self :
1238
1238
size = len (cifti2_axes .from_index_mapping (mim ))
1239
1239
for idx in mim .applies_to_matrix_dimension :
@@ -1382,7 +1382,7 @@ def __init__(self,
1382
1382
self ._nifti_header .set_data_dtype (dataobj .dtype )
1383
1383
self .update_headers ()
1384
1384
1385
- if self ._nifti_header . get_data_shape () != self .header .matrix .get_data_shape ():
1385
+ if self ._dataobj . shape != self .header .matrix .get_data_shape ():
1386
1386
warn ("Dataobj shape {} does not match shape expected from CIFTI-2 header {}" .format (
1387
1387
self ._dataobj .shape , self .header .matrix .get_data_shape ()
1388
1388
))
@@ -1462,7 +1462,7 @@ def to_file_map(self, file_map=None):
1462
1462
header = self ._nifti_header
1463
1463
extension = Cifti2Extension (content = self .header .to_xml ())
1464
1464
header .extensions .append (extension )
1465
- if header . get_data_shape () != self .header .matrix .get_data_shape ():
1465
+ if self . _dataobj . shape != self .header .matrix .get_data_shape ():
1466
1466
raise ValueError (
1467
1467
"Dataobj shape {} does not match shape expected from CIFTI-2 header {}" .format (
1468
1468
self ._dataobj .shape , self .header .matrix .get_data_shape ()
0 commit comments