niwrap.ants.surface_based_smoothing

  1# This file was auto generated by Styx.
  2# Do not edit this file directly.
  3
  4import typing
  5import pathlib
  6from styxdefs import *
  7
  8SURFACE_BASED_SMOOTHING_METADATA = Metadata(
  9    id="0f212837e6cfdb7d79585c7f58fe041aca5a9ef1.boutiques",
 10    name="SurfaceBasedSmoothing",
 11    package="ants",
 12    container_image_tag="antsx/ants:v2.5.3",
 13)
 14
 15
 16SurfaceBasedSmoothingParameters = typing.TypedDict('SurfaceBasedSmoothingParameters', {
 17    "__STYX_TYPE__": typing.Literal["SurfaceBasedSmoothing"],
 18    "image_to_smooth": InputPathType,
 19    "sigma": float,
 20    "surface_image": InputPathType,
 21    "outname": str,
 22    "num_repeats": typing.NotRequired[int | None],
 23})
 24
 25
 26def dyn_cargs(
 27    t: str,
 28) -> typing.Any:
 29    """
 30    Get build cargs function by command type.
 31    
 32    Args:
 33        t: Command type.
 34    Returns:
 35        Build cargs function.
 36    """
 37    return {
 38        "SurfaceBasedSmoothing": surface_based_smoothing_cargs,
 39    }.get(t)
 40
 41
 42def dyn_outputs(
 43    t: str,
 44) -> typing.Any:
 45    """
 46    Get build outputs function by command type.
 47    
 48    Args:
 49        t: Command type.
 50    Returns:
 51        Build outputs function.
 52    """
 53    return {
 54        "SurfaceBasedSmoothing": surface_based_smoothing_outputs,
 55    }.get(t)
 56
 57
 58class SurfaceBasedSmoothingOutputs(typing.NamedTuple):
 59    """
 60    Output object returned when calling `surface_based_smoothing(...)`.
 61    """
 62    root: OutputPathType
 63    """Output root folder. This is the root folder for all outputs."""
 64    smoothed_output: OutputPathType
 65    """The output smoothed image."""
 66
 67
 68def surface_based_smoothing_params(
 69    image_to_smooth: InputPathType,
 70    sigma: float,
 71    surface_image: InputPathType,
 72    outname: str,
 73    num_repeats: int | None = None,
 74) -> SurfaceBasedSmoothingParameters:
 75    """
 76    Build parameters.
 77    
 78    Args:
 79        image_to_smooth: The image that needs to be smoothed.
 80        sigma: Geodesic neighborhood radius.
 81        surface_image: Assumes a label == 1 that defines the surface.
 82        outname: The name of the output file.
 83        num_repeats: Number of times the geodesic neighborhood is applied\
 84            repeatedly.
 85    Returns:
 86        Parameter dictionary
 87    """
 88    params = {
 89        "__STYXTYPE__": "SurfaceBasedSmoothing",
 90        "image_to_smooth": image_to_smooth,
 91        "sigma": sigma,
 92        "surface_image": surface_image,
 93        "outname": outname,
 94    }
 95    if num_repeats is not None:
 96        params["num_repeats"] = num_repeats
 97    return params
 98
 99
100def surface_based_smoothing_cargs(
101    params: SurfaceBasedSmoothingParameters,
102    execution: Execution,
103) -> list[str]:
104    """
105    Build command-line arguments from parameters.
106    
107    Args:
108        params: The parameters.
109        execution: The execution object for resolving input paths.
110    Returns:
111        Command-line arguments.
112    """
113    cargs = []
114    cargs.append("SurfaceBasedSmoothing")
115    cargs.append(execution.input_file(params.get("image_to_smooth")))
116    cargs.append(str(params.get("sigma")))
117    cargs.append(execution.input_file(params.get("surface_image")))
118    cargs.append(params.get("outname"))
119    if params.get("num_repeats") is not None:
120        cargs.append(str(params.get("num_repeats")))
121    return cargs
122
123
124def surface_based_smoothing_outputs(
125    params: SurfaceBasedSmoothingParameters,
126    execution: Execution,
127) -> SurfaceBasedSmoothingOutputs:
128    """
129    Build outputs object containing output file paths and possibly stdout/stderr.
130    
131    Args:
132        params: The parameters.
133        execution: The execution object for resolving input paths.
134    Returns:
135        Outputs object.
136    """
137    ret = SurfaceBasedSmoothingOutputs(
138        root=execution.output_file("."),
139        smoothed_output=execution.output_file(params.get("outname")),
140    )
141    return ret
142
143
144def surface_based_smoothing_execute(
145    params: SurfaceBasedSmoothingParameters,
146    execution: Execution,
147) -> SurfaceBasedSmoothingOutputs:
148    """
149    Surface-based smoothing applied to ImageToSmooth using a geodesic neighbourhood
150    defined by sigma and the surface image.
151    
152    Author: ANTs Developers
153    
154    URL: https://github.com/ANTsX/ANTs
155    
156    Args:
157        params: The parameters.
158        execution: The execution object.
159    Returns:
160        NamedTuple of outputs (described in `SurfaceBasedSmoothingOutputs`).
161    """
162    params = execution.params(params)
163    cargs = surface_based_smoothing_cargs(params, execution)
164    ret = surface_based_smoothing_outputs(params, execution)
165    execution.run(cargs)
166    return ret
167
168
169def surface_based_smoothing(
170    image_to_smooth: InputPathType,
171    sigma: float,
172    surface_image: InputPathType,
173    outname: str,
174    num_repeats: int | None = None,
175    runner: Runner | None = None,
176) -> SurfaceBasedSmoothingOutputs:
177    """
178    Surface-based smoothing applied to ImageToSmooth using a geodesic neighbourhood
179    defined by sigma and the surface image.
180    
181    Author: ANTs Developers
182    
183    URL: https://github.com/ANTsX/ANTs
184    
185    Args:
186        image_to_smooth: The image that needs to be smoothed.
187        sigma: Geodesic neighborhood radius.
188        surface_image: Assumes a label == 1 that defines the surface.
189        outname: The name of the output file.
190        num_repeats: Number of times the geodesic neighborhood is applied\
191            repeatedly.
192        runner: Command runner.
193    Returns:
194        NamedTuple of outputs (described in `SurfaceBasedSmoothingOutputs`).
195    """
196    runner = runner or get_global_runner()
197    execution = runner.start_execution(SURFACE_BASED_SMOOTHING_METADATA)
198    params = surface_based_smoothing_params(
199        image_to_smooth=image_to_smooth,
200        sigma=sigma,
201        surface_image=surface_image,
202        outname=outname,
203        num_repeats=num_repeats,
204    )
205    return surface_based_smoothing_execute(params, execution)
206
207
208__all__ = [
209    "SURFACE_BASED_SMOOTHING_METADATA",
210    "SurfaceBasedSmoothingOutputs",
211    "SurfaceBasedSmoothingParameters",
212    "surface_based_smoothing",
213    "surface_based_smoothing_params",
214]
SURFACE_BASED_SMOOTHING_METADATA = Metadata(id='0f212837e6cfdb7d79585c7f58fe041aca5a9ef1.boutiques', name='SurfaceBasedSmoothing', package='ants', citations=None, container_image_tag='antsx/ants:v2.5.3')
class SurfaceBasedSmoothingOutputs(typing.NamedTuple):
59class SurfaceBasedSmoothingOutputs(typing.NamedTuple):
60    """
61    Output object returned when calling `surface_based_smoothing(...)`.
62    """
63    root: OutputPathType
64    """Output root folder. This is the root folder for all outputs."""
65    smoothed_output: OutputPathType
66    """The output smoothed image."""

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

SurfaceBasedSmoothingOutputs(root: pathlib._local.Path, smoothed_output: pathlib._local.Path)

Create new instance of SurfaceBasedSmoothingOutputs(root, smoothed_output)

root: pathlib._local.Path

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

smoothed_output: pathlib._local.Path

The output smoothed image.

class SurfaceBasedSmoothingParameters(typing.TypedDict):
image_to_smooth: pathlib._local.Path | str
sigma: float
surface_image: pathlib._local.Path | str
outname: str
num_repeats: NotRequired[int | None]
def surface_based_smoothing( image_to_smooth: pathlib._local.Path | str, sigma: float, surface_image: pathlib._local.Path | str, outname: str, num_repeats: int | None = None, runner: styxdefs.types.Runner | None = None) -> SurfaceBasedSmoothingOutputs:
170def surface_based_smoothing(
171    image_to_smooth: InputPathType,
172    sigma: float,
173    surface_image: InputPathType,
174    outname: str,
175    num_repeats: int | None = None,
176    runner: Runner | None = None,
177) -> SurfaceBasedSmoothingOutputs:
178    """
179    Surface-based smoothing applied to ImageToSmooth using a geodesic neighbourhood
180    defined by sigma and the surface image.
181    
182    Author: ANTs Developers
183    
184    URL: https://github.com/ANTsX/ANTs
185    
186    Args:
187        image_to_smooth: The image that needs to be smoothed.
188        sigma: Geodesic neighborhood radius.
189        surface_image: Assumes a label == 1 that defines the surface.
190        outname: The name of the output file.
191        num_repeats: Number of times the geodesic neighborhood is applied\
192            repeatedly.
193        runner: Command runner.
194    Returns:
195        NamedTuple of outputs (described in `SurfaceBasedSmoothingOutputs`).
196    """
197    runner = runner or get_global_runner()
198    execution = runner.start_execution(SURFACE_BASED_SMOOTHING_METADATA)
199    params = surface_based_smoothing_params(
200        image_to_smooth=image_to_smooth,
201        sigma=sigma,
202        surface_image=surface_image,
203        outname=outname,
204        num_repeats=num_repeats,
205    )
206    return surface_based_smoothing_execute(params, execution)

Surface-based smoothing applied to ImageToSmooth using a geodesic neighbourhood defined by sigma and the surface image.

Author: ANTs Developers

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

Arguments:
  • image_to_smooth: The image that needs to be smoothed.
  • sigma: Geodesic neighborhood radius.
  • surface_image: Assumes a label == 1 that defines the surface.
  • outname: The name of the output file.
  • num_repeats: Number of times the geodesic neighborhood is applied repeatedly.
  • runner: Command runner.
Returns:

NamedTuple of outputs (described in SurfaceBasedSmoothingOutputs).

def surface_based_smoothing_params( image_to_smooth: pathlib._local.Path | str, sigma: float, surface_image: pathlib._local.Path | str, outname: str, num_repeats: int | None = None) -> SurfaceBasedSmoothingParameters:
69def surface_based_smoothing_params(
70    image_to_smooth: InputPathType,
71    sigma: float,
72    surface_image: InputPathType,
73    outname: str,
74    num_repeats: int | None = None,
75) -> SurfaceBasedSmoothingParameters:
76    """
77    Build parameters.
78    
79    Args:
80        image_to_smooth: The image that needs to be smoothed.
81        sigma: Geodesic neighborhood radius.
82        surface_image: Assumes a label == 1 that defines the surface.
83        outname: The name of the output file.
84        num_repeats: Number of times the geodesic neighborhood is applied\
85            repeatedly.
86    Returns:
87        Parameter dictionary
88    """
89    params = {
90        "__STYXTYPE__": "SurfaceBasedSmoothing",
91        "image_to_smooth": image_to_smooth,
92        "sigma": sigma,
93        "surface_image": surface_image,
94        "outname": outname,
95    }
96    if num_repeats is not None:
97        params["num_repeats"] = num_repeats
98    return params

Build parameters.

Arguments:
  • image_to_smooth: The image that needs to be smoothed.
  • sigma: Geodesic neighborhood radius.
  • surface_image: Assumes a label == 1 that defines the surface.
  • outname: The name of the output file.
  • num_repeats: Number of times the geodesic neighborhood is applied repeatedly.
Returns:

Parameter dictionary