Skip to content

Commit 875f93c

Browse files
Apply suggestions from code review
Co-Authored-By: Chris Markiewicz <[email protected]>
1 parent 9072313 commit 875f93c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

nibabel/cifti2/cifti2.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,7 +1233,7 @@ def get_data_shape(self):
12331233
from . import cifti2_axes
12341234
if len(self.mapped_indices) == 0:
12351235
return ()
1236-
base_shape = [-1 for _ in range(max(self.mapped_indices) + 1)]
1236+
base_shape = [-1] * (max(self.mapped_indices) + 1)
12371237
for mim in self:
12381238
size = len(cifti2_axes.from_index_mapping(mim))
12391239
for idx in mim.applies_to_matrix_dimension:
@@ -1382,7 +1382,7 @@ def __init__(self,
13821382
self._nifti_header.set_data_dtype(dataobj.dtype)
13831383
self.update_headers()
13841384

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():
13861386
warn("Dataobj shape {} does not match shape expected from CIFTI-2 header {}".format(
13871387
self._dataobj.shape, self.header.matrix.get_data_shape()
13881388
))
@@ -1462,7 +1462,7 @@ def to_file_map(self, file_map=None):
14621462
header = self._nifti_header
14631463
extension = Cifti2Extension(content=self.header.to_xml())
14641464
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():
14661466
raise ValueError(
14671467
"Dataobj shape {} does not match shape expected from CIFTI-2 header {}".format(
14681468
self._dataobj.shape, self.header.matrix.get_data_shape()

0 commit comments

Comments
 (0)