Closed neuronflow closed 1 month ago
There's no tool like that unfortunately, although it would be nice. Actually, I think ANTsPy registration is almost too true to ANTs at the cost of being a bit less pythonic in its arguments. For those other args to the aff_metric parameter, I guess you'd have to dig a bit in the code to see but I believe it exists. Here are how the args are built up:
args = [
"-d",
str(fixed.dimension),
"-r"
] + initx + [
"-m",
"%s[%s,%s,1,%s,regular,%s]"
% (aff_metric, f, m, aff_sampling, aff_random_sampling_rate),
"-t",
"%s[0.25]" % type_of_transform,
"-c",
myiterations,
"-s",
mys_aff,
"-f",
myf_aff,
"-u",
"1",
"-z",
"1",
"-o",
"[%s,%s,%s]" % (outprefix, wmo, wfo),
"-x",
maskopt
]
So long-story short, the "32" is the aff_sampling
arg to ants.registration
and the "0.5" is the aff_random_sampling_rate
arg. I personally think it's nice that those two arguments are split out to separate args because it helps document them. The alternative would be having just one "m" argument to the ants.registration
function in ANTsPy.
I currently have a Python script which assembles an ANTs call that is then called by
subprocess
:I now want to migrate this to ANTsPy. For some parameters, it is unclear to me how to supply them to the
ants.registration
method?For instance, the registration method has an
aff_metric
parameter. However, it only accepts strings as input. What about the, 1, 32, Regular, 0.5]
part of my original call?Similar issue for `convergence_rigid = "-c [1000x500x250, 1e-6, 10]"
Is there a tool to convert ANTs CLI calls to Python calls automatically? This would be a nice feature to help users migrate :)
Thanks for your help!