ANTsPy
ANTsPy copied to clipboard
[question/feature quest] how to translate ANTs CLI call to Python call?
I currently have a Python script which assembles an ANTs call that is then called by subprocess
:
# ants call parameters
dimensionality = "-d 3"
initial_moving_transform = "-r [" + fixed_image + ", " + moving_image + ", 0]"
# transformations
if transformationalgorithm == "rigid":
# rigid ants_transformation
transform_rigid = "-t rigid[0.1]"
metric_rigid = (
"-m Mattes[" + fixed_image + "," + moving_image + ", 1, 32, Regular, 0.5]"
)
convergence_rigid = "-c [1000x500x250, 1e-6, 10]"
smoothing_sigmas_rigid = "-s 3x2x1vox"
shrink_factors_rigid = "-f 8x4x2"
# other parameters
use_estimate_learning_rate_once = "-l 1"
collapse_output_transforms = "-z 1"
interpolation = "-n BSpline[3]"
precision = "--float 1"
output = "-o " + "[" + outputmat + "]"
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!