Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #19

Merged
merged 2 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 22.12.0
rev: 24.4.2
hooks:
- id: black
34 changes: 21 additions & 13 deletions pydra/tasks/ants/v2_5/apply_transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ def _format_output(
return "-o {}".format(
f"Linear[{output_transform},{invert_transform:%d}]"
if save_transform
else f"[{output_warp_field},{save_warp_field:%d}]"
if save_warp_field
else f"{output_image}"
else (
f"[{output_warp_field},{save_warp_field:%d}]"
if save_warp_field
else f"{output_image}"
)
)


Expand All @@ -30,11 +32,15 @@ def _format_interpolation(
) -> str:
return "-n {}{}".format(
interpolator,
f"[{order}]"
if interpolator == "BSpline"
else f"[{sigma},{alpha}]"
if interpolator in ("MultiLabel", "Gaussian")
else "",
(
f"[{order}]"
if interpolator == "BSpline"
else (
f"[{sigma},{alpha}]"
if interpolator in ("MultiLabel", "Gaussian")
else ""
)
),
)


Expand Down Expand Up @@ -202,11 +208,13 @@ class InputSpec(ShellSpec):
"formatter": lambda input_transforms, invert_transforms: (
""
if not input_transforms
else " ".join(f"-t {f}" for f in input_transforms)
if not invert_transforms
else " ".join(
f"-t [{f},{int(i)}]"
for f, i in zip(input_transforms, invert_transforms)
else (
" ".join(f"-t {f}" for f in input_transforms)
if not invert_transforms
else " ".join(
f"-t [{f},{int(i)}]"
for f, i in zip(input_transforms, invert_transforms)
)
)
),
}
Expand Down
46 changes: 26 additions & 20 deletions pydra/tasks/ants/v2_5/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,11 @@ def _format_syn_transform_type(
return (
"-t {}[{}]".format(
syn_transform_type,
f"{syn_gradient_step},{syn_spline_distance},0,{syn_spline_order}"
if syn_transform_type == "BSplineSyn"
else f"{syn_gradient_step},{syn_flow_sigma},{syn_total_sigma}",
(
f"{syn_gradient_step},{syn_spline_distance},0,{syn_spline_order}"
if syn_transform_type == "BSplineSyn"
else f"{syn_gradient_step},{syn_flow_sigma},{syn_total_sigma}"
),
)
if enable_syn_stage
else ""
Expand Down Expand Up @@ -172,11 +174,11 @@ class InputSpec(ShellSpec):
"formatter": lambda interpolator, sigma, alpha, order: (
"-n {}{}".format(
interpolator,
f"[{sigma},{alpha}]"
if interpolator == "Gaussian"
else f"[{order}]"
if interpolator == "BSpline"
else "",
(
f"[{sigma},{alpha}]"
if interpolator == "Gaussian"
else f"[{order}]" if interpolator == "BSpline" else ""
),
)
),
}
Expand Down Expand Up @@ -265,12 +267,14 @@ class InputSpec(ShellSpec):
"formatter": lambda initial_fixed_transforms, invert_fixed_transforms: (
""
if not initial_fixed_transforms
else " ".join(f"-q {x}" for x in initial_fixed_transforms)
if not invert_fixed_transforms
else " ".join(
f"-q [{x},{y:d}]"
for x, y in zip(
initial_fixed_transforms, invert_fixed_transforms
else (
" ".join(f"-q {x}" for x in initial_fixed_transforms)
if not invert_fixed_transforms
else " ".join(
f"-q [{x},{y:d}]"
for x, y in zip(
initial_fixed_transforms, invert_fixed_transforms
)
)
)
),
Expand All @@ -290,12 +294,14 @@ class InputSpec(ShellSpec):
"formatter": lambda initial_moving_transforms, invert_moving_transforms, fixed_image, moving_image: (
f"-r [{fixed_image},{moving_image},1]"
if not initial_moving_transforms
else " ".join(f"-r {x}" for x in initial_moving_transforms)
if not invert_moving_transforms
else " ".join(
f"-r [{x},{y:d}]"
for x, y in zip(
initial_moving_transforms, invert_moving_transforms
else (
" ".join(f"-r {x}" for x in initial_moving_transforms)
if not invert_moving_transforms
else " ".join(
f"-r [{x},{y:d}]"
for x, y in zip(
initial_moving_transforms, invert_moving_transforms
)
)
)
),
Expand Down
Loading