File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 25
25
26
26
mincstats my_funny.mnc
27
27
"""
28
+ import warnings
28
29
import numpy as np
29
30
30
31
from .minc1 import Minc1File , Minc1Image , MincError , MincHeader
@@ -58,8 +59,12 @@ def __init__(self, mincfile):
58
59
# We don't currently support irregular spacing
59
60
# https://en.wikibooks.org/wiki/MINC/Reference/MINC2.0_File_Format_Reference#Dimension_variable_attributes
60
61
for dim in self ._dims :
61
- if dim .spacing != b'regular__' :
62
- raise ValueError ('Irregular spacing not supported' )
62
+ if hasattr (dim , 'spacing' ):
63
+ if dim .spacing == b'irregular' :
64
+ raise ValueError ('Irregular spacing not supported' )
65
+ elif dim .spacing != b'regular__' :
66
+ warnings .warn (f'Invalid spacing declaration: { dim .spacing } ; assuming regular' )
67
+
63
68
self ._spatial_dims = [name for name in self ._dim_names if name .endswith ('space' )]
64
69
self ._image_max = image ['image-max' ]
65
70
self ._image_min = image ['image-min' ]
You can’t perform that action at this time.
0 commit comments