@@ -319,49 +319,6 @@ def from_file_map(klass, file_map):
319319 data = klass .ImageArrayProxy (minc_file )
320320 return klass (data , affine , header , extra = None , file_map = file_map )
321321
322- @property
323- def _spatial_dims (self ):
324- if len (self .shape ) > 3 :
325- return slice (1 , 4 )
326- return slice (0 , 3 )
327-
328- def _check_slicing (self , slicer , return_spatial = False ):
329- ''' Canonicalize slicers and check for scalar indices in spatial dims
330-
331- Parameters
332- ----------
333- slicer : object
334- something that can be used to slice an array as in
335- ``arr[sliceobj]``
336- return_spatial : bool
337- return only slices along spatial dimensions (x, y, z)
338-
339- Returns
340- -------
341- slicer : object
342- Validated slicer object that will slice image's `dataobj`
343- without collapsing spatial dimensions
344- '''
345- slicer = canonical_slicers (slicer , self .shape )
346- try :
347- all_slices = super (Minc1Image , self )._check_slicing (slicer , False )
348- sp_dims = self ._spatial_dims
349- except IndexError :
350- # Prepending a new axis for 3D images is valid in Minc
351- if slicer [0 ] is None and self ._spatial_dims == slice (0 , 3 ):
352- all_slices = (None ,) + super (Minc1Image , self )._check_slicing (slicer [1 :], False )
353- sp_dims = slice (1 , 4 )
354- else :
355- raise
356- # Added complications of first axis being time
357- if self ._spatial_dims == slice (1 , 4 ) and all_slices [0 ] is None :
358- raise IndexError ("New temporal axis is not permitted in 4D Minc images" )
359- elif (self ._spatial_dims == slice (0 , 3 ) and len (all_slices ) > 3 and
360- all_slices [0 ] is not None ):
361- raise IndexError ("New axes cannot be added to 3D Minc image "
362- "without new temporal axis (first dimension)" )
363- return all_slices [sp_dims ] if return_spatial else all_slices
364-
365322
366323load = Minc1Image .load
367324
0 commit comments