niwrap.ants.simulate_displacement_field
1# This file was auto generated by Styx. 2# Do not edit this file directly. 3 4import typing 5import pathlib 6from styxdefs import * 7 8SIMULATE_DISPLACEMENT_FIELD_METADATA = Metadata( 9 id="ca776aa44d13ed564a1e49ff2d3269669eb9067c.boutiques", 10 name="SimulateDisplacementField", 11 package="ants", 12 container_image_tag="antsx/ants:v2.5.3", 13) 14 15 16SimulateDisplacementFieldBsplineOptionsParameters = typing.TypedDict('SimulateDisplacementFieldBsplineOptionsParameters', { 17 "__STYX_TYPE__": typing.Literal["bspline_options"], 18 "number_of_fitting_levels": typing.NotRequired[int | None], 19 "number_of_control_points": typing.NotRequired[int | None], 20}) 21 22 23SimulateDisplacementFieldExponentialOptionsParameters = typing.TypedDict('SimulateDisplacementFieldExponentialOptionsParameters', { 24 "__STYX_TYPE__": typing.Literal["exponential_options"], 25 "smoothing_standard_deviation": typing.NotRequired[float | None], 26}) 27 28 29SimulateDisplacementFieldParameters = typing.TypedDict('SimulateDisplacementFieldParameters', { 30 "__STYX_TYPE__": typing.Literal["SimulateDisplacementField"], 31 "image_dimension": int, 32 "displacement_field_type": typing.Literal["BSpline", "Exponential"], 33 "domain_image": InputPathType, 34 "output_field": str, 35 "number_of_random_points": typing.NotRequired[int | None], 36 "standard_deviation_displacement_field": typing.NotRequired[float | None], 37 "enforce_stationary_boundary": typing.NotRequired[int | None], 38 "displacement_specific_options": typing.NotRequired[typing.Union[SimulateDisplacementFieldBsplineOptionsParameters, SimulateDisplacementFieldExponentialOptionsParameters] | None], 39}) 40 41 42def dyn_cargs( 43 t: str, 44) -> typing.Any: 45 """ 46 Get build cargs function by command type. 47 48 Args: 49 t: Command type. 50 Returns: 51 Build cargs function. 52 """ 53 return { 54 "SimulateDisplacementField": simulate_displacement_field_cargs, 55 "bspline_options": simulate_displacement_field_bspline_options_cargs, 56 "exponential_options": simulate_displacement_field_exponential_options_cargs, 57 }.get(t) 58 59 60def dyn_outputs( 61 t: str, 62) -> typing.Any: 63 """ 64 Get build outputs function by command type. 65 66 Args: 67 t: Command type. 68 Returns: 69 Build outputs function. 70 """ 71 return { 72 "SimulateDisplacementField": simulate_displacement_field_outputs, 73 }.get(t) 74 75 76def simulate_displacement_field_bspline_options_params( 77 number_of_fitting_levels: int | None = 4, 78 number_of_control_points: int | None = 4, 79) -> SimulateDisplacementFieldBsplineOptionsParameters: 80 """ 81 Build parameters. 82 83 Args: 84 number_of_fitting_levels: Number of fitting levels for BSpline. 85 number_of_control_points: Number of control points for BSpline. 86 Returns: 87 Parameter dictionary 88 """ 89 params = { 90 "__STYXTYPE__": "bspline_options", 91 } 92 if number_of_fitting_levels is not None: 93 params["number_of_fitting_levels"] = number_of_fitting_levels 94 if number_of_control_points is not None: 95 params["number_of_control_points"] = number_of_control_points 96 return params 97 98 99def simulate_displacement_field_bspline_options_cargs( 100 params: SimulateDisplacementFieldBsplineOptionsParameters, 101 execution: Execution, 102) -> list[str]: 103 """ 104 Build command-line arguments from parameters. 105 106 Args: 107 params: The parameters. 108 execution: The execution object for resolving input paths. 109 Returns: 110 Command-line arguments. 111 """ 112 cargs = [] 113 if params.get("number_of_fitting_levels") is not None: 114 cargs.append(str(params.get("number_of_fitting_levels"))) 115 if params.get("number_of_control_points") is not None: 116 cargs.append(str(params.get("number_of_control_points"))) 117 return cargs 118 119 120def simulate_displacement_field_exponential_options_params( 121 smoothing_standard_deviation: float | None = 4, 122) -> SimulateDisplacementFieldExponentialOptionsParameters: 123 """ 124 Build parameters. 125 126 Args: 127 smoothing_standard_deviation: Smoothing standard deviation for\ 128 Exponential. 129 Returns: 130 Parameter dictionary 131 """ 132 params = { 133 "__STYXTYPE__": "exponential_options", 134 } 135 if smoothing_standard_deviation is not None: 136 params["smoothing_standard_deviation"] = smoothing_standard_deviation 137 return params 138 139 140def simulate_displacement_field_exponential_options_cargs( 141 params: SimulateDisplacementFieldExponentialOptionsParameters, 142 execution: Execution, 143) -> list[str]: 144 """ 145 Build command-line arguments from parameters. 146 147 Args: 148 params: The parameters. 149 execution: The execution object for resolving input paths. 150 Returns: 151 Command-line arguments. 152 """ 153 cargs = [] 154 if params.get("smoothing_standard_deviation") is not None: 155 cargs.append(str(params.get("smoothing_standard_deviation"))) 156 return cargs 157 158 159class SimulateDisplacementFieldOutputs(typing.NamedTuple): 160 """ 161 Output object returned when calling `simulate_displacement_field(...)`. 162 """ 163 root: OutputPathType 164 """Output root folder. This is the root folder for all outputs.""" 165 output_displacement_field: OutputPathType 166 """The simulated displacement field.""" 167 168 169def simulate_displacement_field_params( 170 image_dimension: int, 171 displacement_field_type: typing.Literal["BSpline", "Exponential"], 172 domain_image: InputPathType, 173 output_field: str, 174 number_of_random_points: int | None = 1000, 175 standard_deviation_displacement_field: float | None = 10, 176 enforce_stationary_boundary: int | None = 1, 177 displacement_specific_options: typing.Union[SimulateDisplacementFieldBsplineOptionsParameters, SimulateDisplacementFieldExponentialOptionsParameters] | None = None, 178) -> SimulateDisplacementFieldParameters: 179 """ 180 Build parameters. 181 182 Args: 183 image_dimension: Dimensionality of the image. 184 displacement_field_type: Type of displacement field to simulate. 185 domain_image: Image defining the domain for the displacement field. 186 output_field: Path to save the output displacement field. 187 number_of_random_points: Number of random points to use in the\ 188 simulation. 189 standard_deviation_displacement_field: Standard deviation for the\ 190 displacement field. 191 enforce_stationary_boundary: Boolean flag indicating whether to enforce\ 192 stationary boundary. 193 displacement_specific_options: Options specific to the type of\ 194 displacement field simulation. 195 Returns: 196 Parameter dictionary 197 """ 198 params = { 199 "__STYXTYPE__": "SimulateDisplacementField", 200 "image_dimension": image_dimension, 201 "displacement_field_type": displacement_field_type, 202 "domain_image": domain_image, 203 "output_field": output_field, 204 } 205 if number_of_random_points is not None: 206 params["number_of_random_points"] = number_of_random_points 207 if standard_deviation_displacement_field is not None: 208 params["standard_deviation_displacement_field"] = standard_deviation_displacement_field 209 if enforce_stationary_boundary is not None: 210 params["enforce_stationary_boundary"] = enforce_stationary_boundary 211 if displacement_specific_options is not None: 212 params["displacement_specific_options"] = displacement_specific_options 213 return params 214 215 216def simulate_displacement_field_cargs( 217 params: SimulateDisplacementFieldParameters, 218 execution: Execution, 219) -> list[str]: 220 """ 221 Build command-line arguments from parameters. 222 223 Args: 224 params: The parameters. 225 execution: The execution object for resolving input paths. 226 Returns: 227 Command-line arguments. 228 """ 229 cargs = [] 230 cargs.append("SimulateDisplacementField") 231 cargs.append(str(params.get("image_dimension"))) 232 cargs.append(params.get("displacement_field_type")) 233 cargs.append(execution.input_file(params.get("domain_image"))) 234 cargs.append(params.get("output_field")) 235 if params.get("number_of_random_points") is not None: 236 cargs.append(str(params.get("number_of_random_points"))) 237 if params.get("standard_deviation_displacement_field") is not None: 238 cargs.append(str(params.get("standard_deviation_displacement_field"))) 239 if params.get("enforce_stationary_boundary") is not None: 240 cargs.append(str(params.get("enforce_stationary_boundary"))) 241 if params.get("displacement_specific_options") is not None: 242 cargs.extend(dyn_cargs(params.get("displacement_specific_options")["__STYXTYPE__"])(params.get("displacement_specific_options"), execution)) 243 return cargs 244 245 246def simulate_displacement_field_outputs( 247 params: SimulateDisplacementFieldParameters, 248 execution: Execution, 249) -> SimulateDisplacementFieldOutputs: 250 """ 251 Build outputs object containing output file paths and possibly stdout/stderr. 252 253 Args: 254 params: The parameters. 255 execution: The execution object for resolving input paths. 256 Returns: 257 Outputs object. 258 """ 259 ret = SimulateDisplacementFieldOutputs( 260 root=execution.output_file("."), 261 output_displacement_field=execution.output_file(params.get("output_field")), 262 ) 263 return ret 264 265 266def simulate_displacement_field_execute( 267 params: SimulateDisplacementFieldParameters, 268 execution: Execution, 269) -> SimulateDisplacementFieldOutputs: 270 """ 271 Simulate displacement fields using various methods such as BSpline or 272 Exponential. 273 274 Author: ANTs Developers 275 276 URL: https://github.com/ANTsX/ANTs 277 278 Args: 279 params: The parameters. 280 execution: The execution object. 281 Returns: 282 NamedTuple of outputs (described in `SimulateDisplacementFieldOutputs`). 283 """ 284 params = execution.params(params) 285 cargs = simulate_displacement_field_cargs(params, execution) 286 ret = simulate_displacement_field_outputs(params, execution) 287 execution.run(cargs) 288 return ret 289 290 291def simulate_displacement_field( 292 image_dimension: int, 293 displacement_field_type: typing.Literal["BSpline", "Exponential"], 294 domain_image: InputPathType, 295 output_field: str, 296 number_of_random_points: int | None = 1000, 297 standard_deviation_displacement_field: float | None = 10, 298 enforce_stationary_boundary: int | None = 1, 299 displacement_specific_options: typing.Union[SimulateDisplacementFieldBsplineOptionsParameters, SimulateDisplacementFieldExponentialOptionsParameters] | None = None, 300 runner: Runner | None = None, 301) -> SimulateDisplacementFieldOutputs: 302 """ 303 Simulate displacement fields using various methods such as BSpline or 304 Exponential. 305 306 Author: ANTs Developers 307 308 URL: https://github.com/ANTsX/ANTs 309 310 Args: 311 image_dimension: Dimensionality of the image. 312 displacement_field_type: Type of displacement field to simulate. 313 domain_image: Image defining the domain for the displacement field. 314 output_field: Path to save the output displacement field. 315 number_of_random_points: Number of random points to use in the\ 316 simulation. 317 standard_deviation_displacement_field: Standard deviation for the\ 318 displacement field. 319 enforce_stationary_boundary: Boolean flag indicating whether to enforce\ 320 stationary boundary. 321 displacement_specific_options: Options specific to the type of\ 322 displacement field simulation. 323 runner: Command runner. 324 Returns: 325 NamedTuple of outputs (described in `SimulateDisplacementFieldOutputs`). 326 """ 327 runner = runner or get_global_runner() 328 execution = runner.start_execution(SIMULATE_DISPLACEMENT_FIELD_METADATA) 329 params = simulate_displacement_field_params( 330 image_dimension=image_dimension, 331 displacement_field_type=displacement_field_type, 332 domain_image=domain_image, 333 output_field=output_field, 334 number_of_random_points=number_of_random_points, 335 standard_deviation_displacement_field=standard_deviation_displacement_field, 336 enforce_stationary_boundary=enforce_stationary_boundary, 337 displacement_specific_options=displacement_specific_options, 338 ) 339 return simulate_displacement_field_execute(params, execution) 340 341 342__all__ = [ 343 "SIMULATE_DISPLACEMENT_FIELD_METADATA", 344 "SimulateDisplacementFieldBsplineOptionsParameters", 345 "SimulateDisplacementFieldExponentialOptionsParameters", 346 "SimulateDisplacementFieldOutputs", 347 "SimulateDisplacementFieldParameters", 348 "simulate_displacement_field", 349 "simulate_displacement_field_bspline_options_params", 350 "simulate_displacement_field_exponential_options_params", 351 "simulate_displacement_field_params", 352]
SIMULATE_DISPLACEMENT_FIELD_METADATA =
Metadata(id='ca776aa44d13ed564a1e49ff2d3269669eb9067c.boutiques', name='SimulateDisplacementField', package='ants', citations=None, container_image_tag='antsx/ants:v2.5.3')
class
SimulateDisplacementFieldBsplineOptionsParameters(typing.TypedDict):
class
SimulateDisplacementFieldExponentialOptionsParameters(typing.TypedDict):
class
SimulateDisplacementFieldOutputs(typing.NamedTuple):
160class SimulateDisplacementFieldOutputs(typing.NamedTuple): 161 """ 162 Output object returned when calling `simulate_displacement_field(...)`. 163 """ 164 root: OutputPathType 165 """Output root folder. This is the root folder for all outputs.""" 166 output_displacement_field: OutputPathType 167 """The simulated displacement field."""
Output object returned when calling simulate_displacement_field(...)
.
class
SimulateDisplacementFieldParameters(typing.TypedDict):
displacement_specific_options: NotRequired[Union[SimulateDisplacementFieldBsplineOptionsParameters, SimulateDisplacementFieldExponentialOptionsParameters, NoneType]]
def
simulate_displacement_field( image_dimension: int, displacement_field_type: Literal['BSpline', 'Exponential'], domain_image: pathlib._local.Path | str, output_field: str, number_of_random_points: int | None = 1000, standard_deviation_displacement_field: float | None = 10, enforce_stationary_boundary: int | None = 1, displacement_specific_options: Union[SimulateDisplacementFieldBsplineOptionsParameters, SimulateDisplacementFieldExponentialOptionsParameters, NoneType] = None, runner: styxdefs.types.Runner | None = None) -> SimulateDisplacementFieldOutputs:
292def simulate_displacement_field( 293 image_dimension: int, 294 displacement_field_type: typing.Literal["BSpline", "Exponential"], 295 domain_image: InputPathType, 296 output_field: str, 297 number_of_random_points: int | None = 1000, 298 standard_deviation_displacement_field: float | None = 10, 299 enforce_stationary_boundary: int | None = 1, 300 displacement_specific_options: typing.Union[SimulateDisplacementFieldBsplineOptionsParameters, SimulateDisplacementFieldExponentialOptionsParameters] | None = None, 301 runner: Runner | None = None, 302) -> SimulateDisplacementFieldOutputs: 303 """ 304 Simulate displacement fields using various methods such as BSpline or 305 Exponential. 306 307 Author: ANTs Developers 308 309 URL: https://github.com/ANTsX/ANTs 310 311 Args: 312 image_dimension: Dimensionality of the image. 313 displacement_field_type: Type of displacement field to simulate. 314 domain_image: Image defining the domain for the displacement field. 315 output_field: Path to save the output displacement field. 316 number_of_random_points: Number of random points to use in the\ 317 simulation. 318 standard_deviation_displacement_field: Standard deviation for the\ 319 displacement field. 320 enforce_stationary_boundary: Boolean flag indicating whether to enforce\ 321 stationary boundary. 322 displacement_specific_options: Options specific to the type of\ 323 displacement field simulation. 324 runner: Command runner. 325 Returns: 326 NamedTuple of outputs (described in `SimulateDisplacementFieldOutputs`). 327 """ 328 runner = runner or get_global_runner() 329 execution = runner.start_execution(SIMULATE_DISPLACEMENT_FIELD_METADATA) 330 params = simulate_displacement_field_params( 331 image_dimension=image_dimension, 332 displacement_field_type=displacement_field_type, 333 domain_image=domain_image, 334 output_field=output_field, 335 number_of_random_points=number_of_random_points, 336 standard_deviation_displacement_field=standard_deviation_displacement_field, 337 enforce_stationary_boundary=enforce_stationary_boundary, 338 displacement_specific_options=displacement_specific_options, 339 ) 340 return simulate_displacement_field_execute(params, execution)
Simulate displacement fields using various methods such as BSpline or Exponential.
Author: ANTs Developers
URL: https://github.com/ANTsX/ANTs
Arguments:
- image_dimension: Dimensionality of the image.
- displacement_field_type: Type of displacement field to simulate.
- domain_image: Image defining the domain for the displacement field.
- output_field: Path to save the output displacement field.
- number_of_random_points: Number of random points to use in the simulation.
- standard_deviation_displacement_field: Standard deviation for the displacement field.
- enforce_stationary_boundary: Boolean flag indicating whether to enforce stationary boundary.
- displacement_specific_options: Options specific to the type of displacement field simulation.
- runner: Command runner.
Returns:
NamedTuple of outputs (described in
SimulateDisplacementFieldOutputs
).
def
simulate_displacement_field_bspline_options_params( number_of_fitting_levels: int | None = 4, number_of_control_points: int | None = 4) -> SimulateDisplacementFieldBsplineOptionsParameters:
77def simulate_displacement_field_bspline_options_params( 78 number_of_fitting_levels: int | None = 4, 79 number_of_control_points: int | None = 4, 80) -> SimulateDisplacementFieldBsplineOptionsParameters: 81 """ 82 Build parameters. 83 84 Args: 85 number_of_fitting_levels: Number of fitting levels for BSpline. 86 number_of_control_points: Number of control points for BSpline. 87 Returns: 88 Parameter dictionary 89 """ 90 params = { 91 "__STYXTYPE__": "bspline_options", 92 } 93 if number_of_fitting_levels is not None: 94 params["number_of_fitting_levels"] = number_of_fitting_levels 95 if number_of_control_points is not None: 96 params["number_of_control_points"] = number_of_control_points 97 return params
Build parameters.
Arguments:
- number_of_fitting_levels: Number of fitting levels for BSpline.
- number_of_control_points: Number of control points for BSpline.
Returns:
Parameter dictionary
def
simulate_displacement_field_exponential_options_params( smoothing_standard_deviation: float | None = 4) -> SimulateDisplacementFieldExponentialOptionsParameters:
121def simulate_displacement_field_exponential_options_params( 122 smoothing_standard_deviation: float | None = 4, 123) -> SimulateDisplacementFieldExponentialOptionsParameters: 124 """ 125 Build parameters. 126 127 Args: 128 smoothing_standard_deviation: Smoothing standard deviation for\ 129 Exponential. 130 Returns: 131 Parameter dictionary 132 """ 133 params = { 134 "__STYXTYPE__": "exponential_options", 135 } 136 if smoothing_standard_deviation is not None: 137 params["smoothing_standard_deviation"] = smoothing_standard_deviation 138 return params
Build parameters.
Arguments:
- smoothing_standard_deviation: Smoothing standard deviation for Exponential.
Returns:
Parameter dictionary
def
simulate_displacement_field_params( image_dimension: int, displacement_field_type: Literal['BSpline', 'Exponential'], domain_image: pathlib._local.Path | str, output_field: str, number_of_random_points: int | None = 1000, standard_deviation_displacement_field: float | None = 10, enforce_stationary_boundary: int | None = 1, displacement_specific_options: Union[SimulateDisplacementFieldBsplineOptionsParameters, SimulateDisplacementFieldExponentialOptionsParameters, NoneType] = None) -> SimulateDisplacementFieldParameters:
170def simulate_displacement_field_params( 171 image_dimension: int, 172 displacement_field_type: typing.Literal["BSpline", "Exponential"], 173 domain_image: InputPathType, 174 output_field: str, 175 number_of_random_points: int | None = 1000, 176 standard_deviation_displacement_field: float | None = 10, 177 enforce_stationary_boundary: int | None = 1, 178 displacement_specific_options: typing.Union[SimulateDisplacementFieldBsplineOptionsParameters, SimulateDisplacementFieldExponentialOptionsParameters] | None = None, 179) -> SimulateDisplacementFieldParameters: 180 """ 181 Build parameters. 182 183 Args: 184 image_dimension: Dimensionality of the image. 185 displacement_field_type: Type of displacement field to simulate. 186 domain_image: Image defining the domain for the displacement field. 187 output_field: Path to save the output displacement field. 188 number_of_random_points: Number of random points to use in the\ 189 simulation. 190 standard_deviation_displacement_field: Standard deviation for the\ 191 displacement field. 192 enforce_stationary_boundary: Boolean flag indicating whether to enforce\ 193 stationary boundary. 194 displacement_specific_options: Options specific to the type of\ 195 displacement field simulation. 196 Returns: 197 Parameter dictionary 198 """ 199 params = { 200 "__STYXTYPE__": "SimulateDisplacementField", 201 "image_dimension": image_dimension, 202 "displacement_field_type": displacement_field_type, 203 "domain_image": domain_image, 204 "output_field": output_field, 205 } 206 if number_of_random_points is not None: 207 params["number_of_random_points"] = number_of_random_points 208 if standard_deviation_displacement_field is not None: 209 params["standard_deviation_displacement_field"] = standard_deviation_displacement_field 210 if enforce_stationary_boundary is not None: 211 params["enforce_stationary_boundary"] = enforce_stationary_boundary 212 if displacement_specific_options is not None: 213 params["displacement_specific_options"] = displacement_specific_options 214 return params
Build parameters.
Arguments:
- image_dimension: Dimensionality of the image.
- displacement_field_type: Type of displacement field to simulate.
- domain_image: Image defining the domain for the displacement field.
- output_field: Path to save the output displacement field.
- number_of_random_points: Number of random points to use in the simulation.
- standard_deviation_displacement_field: Standard deviation for the displacement field.
- enforce_stationary_boundary: Boolean flag indicating whether to enforce stationary boundary.
- displacement_specific_options: Options specific to the type of displacement field simulation.
Returns:
Parameter dictionary