@@ -217,14 +217,13 @@ def from_filename(cls, filename, fmt=None, reference=None, moving=None):
217
217
is_array = cls != Affine
218
218
errors = []
219
219
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" :
221
221
is_array = False
222
222
cls = Affine
223
223
224
224
try :
225
225
struct = get_linear_factory (
226
- potential_fmt ,
227
- is_array = is_array
226
+ potential_fmt , is_array = is_array
228
227
).from_filename (filename )
229
228
except (TransformFileError , FileNotFoundError ) as err :
230
229
errors .append ((potential_fmt , err ))
@@ -491,7 +490,8 @@ def apply(
491
490
# Interpolate
492
491
resampled [..., t ] = ndi .map_coordinates (
493
492
(
494
- dataobj if dataobj is not None
493
+ dataobj
494
+ if dataobj is not None
495
495
else np .asanyarray (spatialimage .dataobj [..., t ], dtype = input_dtype )
496
496
),
497
497
yvoxels .T ,
@@ -503,10 +503,8 @@ def apply(
503
503
)
504
504
505
505
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 )
510
508
moved .header .set_data_dtype (output_dtype )
511
509
return moved
512
510
0 commit comments