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

WIP: Add xfrm option for BRATs pipeline. #407

Merged
merged 3 commits into from
Nov 17, 2022
Merged
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
30 changes: 20 additions & 10 deletions ants/registration/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -1161,8 +1161,17 @@ def registration(
args.append("[NA,NA]")
# ------------------------------------------------------------
elif "antsRegistrationSyN" in type_of_transform:

do_quick = False
if "Quick" in type_of_transform:
do_quick = True

subtype_of_transform = "s"
spline_distance = 26
metric_parameter = 4
if do_quick:
metric_parameter = 32

if "[" in type_of_transform and "]" in type_of_transform:
subtype_of_transform = type_of_transform.split("[")[1].split(
"]"
Expand All @@ -1172,13 +1181,14 @@ def registration(
subtype_of_transform = subtype_of_transform_args[0]
if not ( subtype_of_transform == "b"
or subtype_of_transform == "br"
or subtype_of_transform == "bo" ):
raise ValueError("Extra parameters are only valid for B-spline SyN transform.")
spline_distance = subtype_of_transform_args[1]

do_quick = False
if "Quick" in type_of_transform:
do_quick = True
or subtype_of_transform == "bo"
or subtype_of_transform == "s"
or subtype_of_transform == "sr"
or subtype_of_transform == "so" ):
raise ValueError("Extra parameters are only valid for 's' or 'b' SyN transforms.")
metric_parameter = subtype_of_transform_args[1]
if len(subtype_of_transform_args) > 2:
spline_distance = subtype_of_transform_args[2]

do_repro = False
if "Repro" in type_of_transform:
Expand All @@ -1204,16 +1214,16 @@ def registration(

if do_quick == True:
syn_convergence = "[100x70x50x0,1e-6,10]"
syn_metric = "MI[%s,%s,1,32]" % (f, m)
syn_metric = "MI[%s,%s,1,%s]" % (f, m, metric_parameter)
else:
syn_convergence = "[100x70x50x20,1e-6,10]"
syn_metric = "CC[%s,%s,1,4]" % (f, m)
syn_metric = "CC[%s,%s,1,%s]" % (f, m, metric_parameter)
syn_shrink_factors = "8x4x2x1"
syn_smoothing_sigmas = "3x2x1x0vox"

if do_quick == True and do_repro == True:
syn_convergence = "[100x70x50x0,1e-6,10]"
syn_metric = "CC[%s,%s,1,2]" % (f, m)
syn_metric = "CC[%s,%s,1,%s]" % (f, m, metric_parameter)

if random_seed is None and do_repro == True:
random_seed = str( 1 )
Expand Down