niwrap.ants.set_spacing
1# This file was auto generated by Styx. 2# Do not edit this file directly. 3 4import typing 5import pathlib 6from styxdefs import * 7 8SET_SPACING_METADATA = Metadata( 9 id="5a66a083de7d100e80817b6862541b3b2eb2b1ed.boutiques", 10 name="SetSpacing", 11 package="ants", 12 container_image_tag="antsx/ants:v2.5.3", 13) 14 15 16SetSpacingParameters = typing.TypedDict('SetSpacingParameters', { 17 "__STYX_TYPE__": typing.Literal["SetSpacing"], 18 "dimension": int, 19 "input_file": InputPathType, 20 "output_file": str, 21 "spacing": list[float], 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 "SetSpacing": set_spacing_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 "SetSpacing": set_spacing_outputs, 54 }.get(t) 55 56 57class SetSpacingOutputs(typing.NamedTuple): 58 """ 59 Output object returned when calling `set_spacing(...)`. 60 """ 61 root: OutputPathType 62 """Output root folder. This is the root folder for all outputs.""" 63 output_image: OutputPathType 64 """The output image with the specified spacing.""" 65 66 67def set_spacing_params( 68 dimension: int, 69 input_file: InputPathType, 70 output_file: str, 71 spacing: list[float], 72) -> SetSpacingParameters: 73 """ 74 Build parameters. 75 76 Args: 77 dimension: The dimensionality of the image (e.g., 2 or 3). 78 input_file: The input image file in HDR format. 79 output_file: The output image file in NII format. 80 spacing: Spacing values for each dimension. Requires SpacingX,\ 81 SpacingY, and optionally SpacingZ. 82 Returns: 83 Parameter dictionary 84 """ 85 params = { 86 "__STYXTYPE__": "SetSpacing", 87 "dimension": dimension, 88 "input_file": input_file, 89 "output_file": output_file, 90 "spacing": spacing, 91 } 92 return params 93 94 95def set_spacing_cargs( 96 params: SetSpacingParameters, 97 execution: Execution, 98) -> list[str]: 99 """ 100 Build command-line arguments from parameters. 101 102 Args: 103 params: The parameters. 104 execution: The execution object for resolving input paths. 105 Returns: 106 Command-line arguments. 107 """ 108 cargs = [] 109 cargs.append("SetSpacing") 110 cargs.append(str(params.get("dimension"))) 111 cargs.append(execution.input_file(params.get("input_file"))) 112 cargs.append(params.get("output_file")) 113 cargs.extend(map(str, params.get("spacing"))) 114 return cargs 115 116 117def set_spacing_outputs( 118 params: SetSpacingParameters, 119 execution: Execution, 120) -> SetSpacingOutputs: 121 """ 122 Build outputs object containing output file paths and possibly stdout/stderr. 123 124 Args: 125 params: The parameters. 126 execution: The execution object for resolving input paths. 127 Returns: 128 Outputs object. 129 """ 130 ret = SetSpacingOutputs( 131 root=execution.output_file("."), 132 output_image=execution.output_file(params.get("output_file")), 133 ) 134 return ret 135 136 137def set_spacing_execute( 138 params: SetSpacingParameters, 139 execution: Execution, 140) -> SetSpacingOutputs: 141 """ 142 A tool to set the spacing of an image in each dimension. 143 144 Author: ANTs Developers 145 146 URL: https://github.com/ANTsX/ANTs 147 148 Args: 149 params: The parameters. 150 execution: The execution object. 151 Returns: 152 NamedTuple of outputs (described in `SetSpacingOutputs`). 153 """ 154 params = execution.params(params) 155 cargs = set_spacing_cargs(params, execution) 156 ret = set_spacing_outputs(params, execution) 157 execution.run(cargs) 158 return ret 159 160 161def set_spacing( 162 dimension: int, 163 input_file: InputPathType, 164 output_file: str, 165 spacing: list[float], 166 runner: Runner | None = None, 167) -> SetSpacingOutputs: 168 """ 169 A tool to set the spacing of an image in each dimension. 170 171 Author: ANTs Developers 172 173 URL: https://github.com/ANTsX/ANTs 174 175 Args: 176 dimension: The dimensionality of the image (e.g., 2 or 3). 177 input_file: The input image file in HDR format. 178 output_file: The output image file in NII format. 179 spacing: Spacing values for each dimension. Requires SpacingX,\ 180 SpacingY, and optionally SpacingZ. 181 runner: Command runner. 182 Returns: 183 NamedTuple of outputs (described in `SetSpacingOutputs`). 184 """ 185 runner = runner or get_global_runner() 186 execution = runner.start_execution(SET_SPACING_METADATA) 187 params = set_spacing_params( 188 dimension=dimension, 189 input_file=input_file, 190 output_file=output_file, 191 spacing=spacing, 192 ) 193 return set_spacing_execute(params, execution) 194 195 196__all__ = [ 197 "SET_SPACING_METADATA", 198 "SetSpacingOutputs", 199 "SetSpacingParameters", 200 "set_spacing", 201 "set_spacing_params", 202]
SET_SPACING_METADATA =
Metadata(id='5a66a083de7d100e80817b6862541b3b2eb2b1ed.boutiques', name='SetSpacing', package='ants', citations=None, container_image_tag='antsx/ants:v2.5.3')
class
SetSpacingOutputs(typing.NamedTuple):
58class SetSpacingOutputs(typing.NamedTuple): 59 """ 60 Output object returned when calling `set_spacing(...)`. 61 """ 62 root: OutputPathType 63 """Output root folder. This is the root folder for all outputs.""" 64 output_image: OutputPathType 65 """The output image with the specified spacing."""
Output object returned when calling set_spacing(...)
.
class
SetSpacingParameters(typing.TypedDict):
def
set_spacing( dimension: int, input_file: pathlib._local.Path | str, output_file: str, spacing: list[float], runner: styxdefs.types.Runner | None = None) -> SetSpacingOutputs:
162def set_spacing( 163 dimension: int, 164 input_file: InputPathType, 165 output_file: str, 166 spacing: list[float], 167 runner: Runner | None = None, 168) -> SetSpacingOutputs: 169 """ 170 A tool to set the spacing of an image in each dimension. 171 172 Author: ANTs Developers 173 174 URL: https://github.com/ANTsX/ANTs 175 176 Args: 177 dimension: The dimensionality of the image (e.g., 2 or 3). 178 input_file: The input image file in HDR format. 179 output_file: The output image file in NII format. 180 spacing: Spacing values for each dimension. Requires SpacingX,\ 181 SpacingY, and optionally SpacingZ. 182 runner: Command runner. 183 Returns: 184 NamedTuple of outputs (described in `SetSpacingOutputs`). 185 """ 186 runner = runner or get_global_runner() 187 execution = runner.start_execution(SET_SPACING_METADATA) 188 params = set_spacing_params( 189 dimension=dimension, 190 input_file=input_file, 191 output_file=output_file, 192 spacing=spacing, 193 ) 194 return set_spacing_execute(params, execution)
A tool to set the spacing of an image in each dimension.
Author: ANTs Developers
URL: https://github.com/ANTsX/ANTs
Arguments:
- dimension: The dimensionality of the image (e.g., 2 or 3).
- input_file: The input image file in HDR format.
- output_file: The output image file in NII format.
- spacing: Spacing values for each dimension. Requires SpacingX, SpacingY, and optionally SpacingZ.
- runner: Command runner.
Returns:
NamedTuple of outputs (described in
SetSpacingOutputs
).
def
set_spacing_params( dimension: int, input_file: pathlib._local.Path | str, output_file: str, spacing: list[float]) -> SetSpacingParameters:
68def set_spacing_params( 69 dimension: int, 70 input_file: InputPathType, 71 output_file: str, 72 spacing: list[float], 73) -> SetSpacingParameters: 74 """ 75 Build parameters. 76 77 Args: 78 dimension: The dimensionality of the image (e.g., 2 or 3). 79 input_file: The input image file in HDR format. 80 output_file: The output image file in NII format. 81 spacing: Spacing values for each dimension. Requires SpacingX,\ 82 SpacingY, and optionally SpacingZ. 83 Returns: 84 Parameter dictionary 85 """ 86 params = { 87 "__STYXTYPE__": "SetSpacing", 88 "dimension": dimension, 89 "input_file": input_file, 90 "output_file": output_file, 91 "spacing": spacing, 92 } 93 return params
Build parameters.
Arguments:
- dimension: The dimensionality of the image (e.g., 2 or 3).
- input_file: The input image file in HDR format.
- output_file: The output image file in NII format.
- spacing: Spacing values for each dimension. Requires SpacingX, SpacingY, and optionally SpacingZ.
Returns:
Parameter dictionary