Skip to content

Commit

Permalink
ENH: Add more SyN options.
Browse files Browse the repository at this point in the history
  • Loading branch information
ntustison committed Oct 26, 2022
1 parent 82ad175 commit 4dd269e
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions ants/registration/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -1210,8 +1210,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 @@ -1221,13 +1230,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 @@ -1253,16 +1263,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

0 comments on commit 4dd269e

Please sign in to comment.