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 2525
2626 mincstats my_funny.mnc
2727"""
28+ import warnings
2829import numpy as np
2930
3031from .minc1 import Minc1File , Minc1Image , MincError , MincHeader
@@ -58,8 +59,12 @@ def __init__(self, mincfile):
5859 # We don't currently support irregular spacing
5960 # https://en.wikibooks.org/wiki/MINC/Reference/MINC2.0_File_Format_Reference#Dimension_variable_attributes
6061 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+
6368 self ._spatial_dims = [name for name in self ._dim_names if name .endswith ('space' )]
6469 self ._image_max = image ['image-max' ]
6570 self ._image_min = image ['image-min' ]
You can’t perform that action at this time.
0 commit comments