@@ -217,14 +217,13 @@ def from_filename(cls, filename, fmt=None, reference=None, moving=None):
217217 is_array = cls != Affine
218218 errors = []
219219 for potential_fmt in fmtlist :
220- if ( potential_fmt == "itk" and Path (filename ).suffix == ".mat" ) :
220+ if potential_fmt == "itk" and Path (filename ).suffix == ".mat" :
221221 is_array = False
222222 cls = Affine
223223
224224 try :
225225 struct = get_linear_factory (
226- potential_fmt ,
227- is_array = is_array
226+ potential_fmt , is_array = is_array
228227 ).from_filename (filename )
229228 except (TransformFileError , FileNotFoundError ) as err :
230229 errors .append ((potential_fmt , err ))
@@ -491,7 +490,8 @@ def apply(
491490 # Interpolate
492491 resampled [..., t ] = ndi .map_coordinates (
493492 (
494- dataobj if dataobj is not None
493+ dataobj
494+ if dataobj is not None
495495 else np .asanyarray (spatialimage .dataobj [..., t ], dtype = input_dtype )
496496 ),
497497 yvoxels .T ,
@@ -503,10 +503,8 @@ def apply(
503503 )
504504
505505 if isinstance (_ref , ImageGrid ): # If reference is grid, reshape
506- newdata = resampled .reshape (_ref .shape + (len (self ), ))
507- moved = spatialimage .__class__ (
508- newdata , _ref .affine , spatialimage .header
509- )
506+ newdata = resampled .reshape (_ref .shape + (len (self ),))
507+ moved = spatialimage .__class__ (newdata , _ref .affine , spatialimage .header )
510508 moved .header .set_data_dtype (output_dtype )
511509 return moved
512510
0 commit comments