Skip to content

Commit

Permalink
sty: run black
Browse files Browse the repository at this point in the history
  • Loading branch information
oesteban committed Nov 16, 2023
1 parent 40e3c13 commit a6fe3eb
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions nitransforms/linear.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,14 +217,13 @@ def from_filename(cls, filename, fmt=None, reference=None, moving=None):
is_array = cls != Affine
errors = []
for potential_fmt in fmtlist:
if (potential_fmt == "itk" and Path(filename).suffix == ".mat"):
if potential_fmt == "itk" and Path(filename).suffix == ".mat":
is_array = False
cls = Affine

try:
struct = get_linear_factory(
potential_fmt,
is_array=is_array
potential_fmt, is_array=is_array
).from_filename(filename)
except (TransformFileError, FileNotFoundError) as err:
errors.append((potential_fmt, err))
Expand Down Expand Up @@ -491,7 +490,8 @@ def apply(
# Interpolate
resampled[..., t] = ndi.map_coordinates(
(
dataobj if dataobj is not None
dataobj
if dataobj is not None
else np.asanyarray(spatialimage.dataobj[..., t], dtype=input_dtype)
),
yvoxels.T,
Expand All @@ -503,10 +503,8 @@ def apply(
)

if isinstance(_ref, ImageGrid): # If reference is grid, reshape
newdata = resampled.reshape(_ref.shape + (len(self), ))
moved = spatialimage.__class__(
newdata, _ref.affine, spatialimage.header
)
newdata = resampled.reshape(_ref.shape + (len(self),))
moved = spatialimage.__class__(newdata, _ref.affine, spatialimage.header)
moved.header.set_data_dtype(output_dtype)
return moved

Expand Down

0 comments on commit a6fe3eb

Please sign in to comment.