We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f53c168 commit 68f489eCopy full SHA for 68f489e
nibabel/nifti1.py
@@ -676,8 +676,13 @@ def set_data_shape(self, shape):
676
hdr = self._structarr
677
if (len(shape) == 3 and shape[1:] == (1, 1) and
678
shape[0] > np.iinfo(hdr['dim'].dtype.base).max): # Freesurfer case
679
- hdr['glmin'] = shape[0]
680
- if hdr['glmin'] != shape[0]:
+ try:
+ hdr['glmin'] = shape[0]
681
+ except OverflowError:
682
+ overflow = True
683
+ else:
684
+ overflow = hdr['glmin'] != shape[0]
685
+ if overflow:
686
raise HeaderDataError('shape[0] %s does not fit in glmax datatype' %
687
shape[0])
688
warnings.warn('Using large vector Freesurfer hack; header will '
0 commit comments