niwrap.ants.simple_syn_registration

  1# This file was auto generated by Styx.
  2# Do not edit this file directly.
  3
  4import typing
  5import pathlib
  6from styxdefs import *
  7
  8SIMPLE_SYN_REGISTRATION_METADATA = Metadata(
  9    id="8bdec8bc3a221887858c098adc61e63838dc3139.boutiques",
 10    name="simpleSynRegistration",
 11    package="ants",
 12    container_image_tag="antsx/ants:v2.5.3",
 13)
 14
 15
 16SimpleSynRegistrationParameters = typing.TypedDict('SimpleSynRegistrationParameters', {
 17    "__STYX_TYPE__": typing.Literal["simpleSynRegistration"],
 18    "fixed_image": InputPathType,
 19    "moving_image": InputPathType,
 20    "initial_transform": str,
 21    "output_prefix": str,
 22})
 23
 24
 25def dyn_cargs(
 26    t: str,
 27) -> typing.Any:
 28    """
 29    Get build cargs function by command type.
 30    
 31    Args:
 32        t: Command type.
 33    Returns:
 34        Build cargs function.
 35    """
 36    return {
 37        "simpleSynRegistration": simple_syn_registration_cargs,
 38    }.get(t)
 39
 40
 41def dyn_outputs(
 42    t: str,
 43) -> typing.Any:
 44    """
 45    Get build outputs function by command type.
 46    
 47    Args:
 48        t: Command type.
 49    Returns:
 50        Build outputs function.
 51    """
 52    return {
 53        "simpleSynRegistration": simple_syn_registration_outputs,
 54    }.get(t)
 55
 56
 57class SimpleSynRegistrationOutputs(typing.NamedTuple):
 58    """
 59    Output object returned when calling `simple_syn_registration(...)`.
 60    """
 61    root: OutputPathType
 62    """Output root folder. This is the root folder for all outputs."""
 63    registered_image: OutputPathType
 64    """The output registered image."""
 65    transform_matrix: OutputPathType
 66    """The output transformation matrix."""
 67
 68
 69def simple_syn_registration_params(
 70    fixed_image: InputPathType,
 71    moving_image: InputPathType,
 72    initial_transform: str,
 73    output_prefix: str,
 74) -> SimpleSynRegistrationParameters:
 75    """
 76    Build parameters.
 77    
 78    Args:
 79        fixed_image: The fixed image for registration.
 80        moving_image: The moving image to be registered.
 81        initial_transform: The initial transform for registration.
 82        output_prefix: Prefix for the output file name without any extension.
 83    Returns:
 84        Parameter dictionary
 85    """
 86    params = {
 87        "__STYXTYPE__": "simpleSynRegistration",
 88        "fixed_image": fixed_image,
 89        "moving_image": moving_image,
 90        "initial_transform": initial_transform,
 91        "output_prefix": output_prefix,
 92    }
 93    return params
 94
 95
 96def simple_syn_registration_cargs(
 97    params: SimpleSynRegistrationParameters,
 98    execution: Execution,
 99) -> list[str]:
100    """
101    Build command-line arguments from parameters.
102    
103    Args:
104        params: The parameters.
105        execution: The execution object for resolving input paths.
106    Returns:
107        Command-line arguments.
108    """
109    cargs = []
110    cargs.append("simpleSynRegistration")
111    cargs.append(execution.input_file(params.get("fixed_image")) + ",")
112    cargs.append(execution.input_file(params.get("moving_image")) + ",")
113    cargs.append(params.get("initial_transform") + ",")
114    cargs.append(params.get("output_prefix"))
115    return cargs
116
117
118def simple_syn_registration_outputs(
119    params: SimpleSynRegistrationParameters,
120    execution: Execution,
121) -> SimpleSynRegistrationOutputs:
122    """
123    Build outputs object containing output file paths and possibly stdout/stderr.
124    
125    Args:
126        params: The parameters.
127        execution: The execution object for resolving input paths.
128    Returns:
129        Outputs object.
130    """
131    ret = SimpleSynRegistrationOutputs(
132        root=execution.output_file("."),
133        registered_image=execution.output_file(params.get("output_prefix") + "Registered.nii.gz"),
134        transform_matrix=execution.output_file(params.get("output_prefix") + "Transform.mat"),
135    )
136    return ret
137
138
139def simple_syn_registration_execute(
140    params: SimpleSynRegistrationParameters,
141    execution: Execution,
142) -> SimpleSynRegistrationOutputs:
143    """
144    A simple SyN registration tool.
145    
146    Author: ANTs Developers
147    
148    URL: https://github.com/ANTsX/ANTs
149    
150    Args:
151        params: The parameters.
152        execution: The execution object.
153    Returns:
154        NamedTuple of outputs (described in `SimpleSynRegistrationOutputs`).
155    """
156    params = execution.params(params)
157    cargs = simple_syn_registration_cargs(params, execution)
158    ret = simple_syn_registration_outputs(params, execution)
159    execution.run(cargs)
160    return ret
161
162
163def simple_syn_registration(
164    fixed_image: InputPathType,
165    moving_image: InputPathType,
166    initial_transform: str,
167    output_prefix: str,
168    runner: Runner | None = None,
169) -> SimpleSynRegistrationOutputs:
170    """
171    A simple SyN registration tool.
172    
173    Author: ANTs Developers
174    
175    URL: https://github.com/ANTsX/ANTs
176    
177    Args:
178        fixed_image: The fixed image for registration.
179        moving_image: The moving image to be registered.
180        initial_transform: The initial transform for registration.
181        output_prefix: Prefix for the output file name without any extension.
182        runner: Command runner.
183    Returns:
184        NamedTuple of outputs (described in `SimpleSynRegistrationOutputs`).
185    """
186    runner = runner or get_global_runner()
187    execution = runner.start_execution(SIMPLE_SYN_REGISTRATION_METADATA)
188    params = simple_syn_registration_params(
189        fixed_image=fixed_image,
190        moving_image=moving_image,
191        initial_transform=initial_transform,
192        output_prefix=output_prefix,
193    )
194    return simple_syn_registration_execute(params, execution)
195
196
197__all__ = [
198    "SIMPLE_SYN_REGISTRATION_METADATA",
199    "SimpleSynRegistrationOutputs",
200    "SimpleSynRegistrationParameters",
201    "simple_syn_registration",
202    "simple_syn_registration_params",
203]
SIMPLE_SYN_REGISTRATION_METADATA = Metadata(id='8bdec8bc3a221887858c098adc61e63838dc3139.boutiques', name='simpleSynRegistration', package='ants', citations=None, container_image_tag='antsx/ants:v2.5.3')
class SimpleSynRegistrationOutputs(typing.NamedTuple):
58class SimpleSynRegistrationOutputs(typing.NamedTuple):
59    """
60    Output object returned when calling `simple_syn_registration(...)`.
61    """
62    root: OutputPathType
63    """Output root folder. This is the root folder for all outputs."""
64    registered_image: OutputPathType
65    """The output registered image."""
66    transform_matrix: OutputPathType
67    """The output transformation matrix."""

Output object returned when calling simple_syn_registration(...).

SimpleSynRegistrationOutputs( root: pathlib._local.Path, registered_image: pathlib._local.Path, transform_matrix: pathlib._local.Path)

Create new instance of SimpleSynRegistrationOutputs(root, registered_image, transform_matrix)

root: pathlib._local.Path

Output root folder. This is the root folder for all outputs.

registered_image: pathlib._local.Path

The output registered image.

transform_matrix: pathlib._local.Path

The output transformation matrix.

class SimpleSynRegistrationParameters(typing.TypedDict):
fixed_image: pathlib._local.Path | str
moving_image: pathlib._local.Path | str
initial_transform: str
output_prefix: str
def simple_syn_registration( fixed_image: pathlib._local.Path | str, moving_image: pathlib._local.Path | str, initial_transform: str, output_prefix: str, runner: styxdefs.types.Runner | None = None) -> SimpleSynRegistrationOutputs:
164def simple_syn_registration(
165    fixed_image: InputPathType,
166    moving_image: InputPathType,
167    initial_transform: str,
168    output_prefix: str,
169    runner: Runner | None = None,
170) -> SimpleSynRegistrationOutputs:
171    """
172    A simple SyN registration tool.
173    
174    Author: ANTs Developers
175    
176    URL: https://github.com/ANTsX/ANTs
177    
178    Args:
179        fixed_image: The fixed image for registration.
180        moving_image: The moving image to be registered.
181        initial_transform: The initial transform for registration.
182        output_prefix: Prefix for the output file name without any extension.
183        runner: Command runner.
184    Returns:
185        NamedTuple of outputs (described in `SimpleSynRegistrationOutputs`).
186    """
187    runner = runner or get_global_runner()
188    execution = runner.start_execution(SIMPLE_SYN_REGISTRATION_METADATA)
189    params = simple_syn_registration_params(
190        fixed_image=fixed_image,
191        moving_image=moving_image,
192        initial_transform=initial_transform,
193        output_prefix=output_prefix,
194    )
195    return simple_syn_registration_execute(params, execution)

A simple SyN registration tool.

Author: ANTs Developers

URL: https://github.com/ANTsX/ANTs

Arguments:
  • fixed_image: The fixed image for registration.
  • moving_image: The moving image to be registered.
  • initial_transform: The initial transform for registration.
  • output_prefix: Prefix for the output file name without any extension.
  • runner: Command runner.
Returns:

NamedTuple of outputs (described in SimpleSynRegistrationOutputs).

def simple_syn_registration_params( fixed_image: pathlib._local.Path | str, moving_image: pathlib._local.Path | str, initial_transform: str, output_prefix: str) -> SimpleSynRegistrationParameters:
70def simple_syn_registration_params(
71    fixed_image: InputPathType,
72    moving_image: InputPathType,
73    initial_transform: str,
74    output_prefix: str,
75) -> SimpleSynRegistrationParameters:
76    """
77    Build parameters.
78    
79    Args:
80        fixed_image: The fixed image for registration.
81        moving_image: The moving image to be registered.
82        initial_transform: The initial transform for registration.
83        output_prefix: Prefix for the output file name without any extension.
84    Returns:
85        Parameter dictionary
86    """
87    params = {
88        "__STYXTYPE__": "simpleSynRegistration",
89        "fixed_image": fixed_image,
90        "moving_image": moving_image,
91        "initial_transform": initial_transform,
92        "output_prefix": output_prefix,
93    }
94    return params

Build parameters.

Arguments:
  • fixed_image: The fixed image for registration.
  • moving_image: The moving image to be registered.
  • initial_transform: The initial transform for registration.
  • output_prefix: Prefix for the output file name without any extension.
Returns:

Parameter dictionary