Skip to content

Commit c3518d1

Browse files
committed
STY: Remove misleading 'sizeof_hdr' from Minc1/2
1 parent ecee561 commit c3518d1

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

nibabel/minc1.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,6 @@ class MincHeader(Header):
269269
"""
270270
# We don't use the data layout - this just in case we do later
271271
data_layout = 'C'
272-
sizeof_hdr = 4
273272

274273
def data_to_fileobj(self, data, fileobj, rescale=True):
275274
""" See Header class for an implementation we can't use """
@@ -283,11 +282,10 @@ def data_from_fileobj(self, fileobj):
283282
class Minc1Header(MincHeader):
284283
@classmethod
285284
def may_contain_header(klass, binaryblock):
286-
if len(binaryblock) < klass.sizeof_hdr:
287-
raise ValueError('Must pass a binary block >= %d bytes' %
288-
klass.sizeof_hdr)
285+
if len(binaryblock) < 4:
286+
raise ValueError('Must pass a binary block >= 4 bytes')
289287

290-
return binaryblock[:klass.sizeof_hdr] == b'CDF\x01'
288+
return binaryblock[:4] == b'CDF\x01'
291289

292290

293291
class Minc1Image(SpatialImage):

nibabel/minc2.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,10 @@ def get_scaled_data(self, sliceobj=()):
137137
class Minc2Header(MincHeader):
138138
@classmethod
139139
def may_contain_header(klass, binaryblock):
140-
if len(binaryblock) < klass.sizeof_hdr:
141-
raise ValueError('Must pass a binary block >= %d bytes' %
142-
klass.sizeof_hdr)
140+
if len(binaryblock) < 4:
141+
raise ValueError('Must pass a binary block >= 4 bytes')
143142

144-
return binaryblock[:klass.sizeof_hdr] == b'\211HDF'
143+
return binaryblock[:4] == b'\211HDF'
145144

146145

147146
class Minc2Image(Minc1Image):

0 commit comments

Comments
 (0)