niwrap.ants.paste_image_into_image

  1# This file was auto generated by Styx.
  2# Do not edit this file directly.
  3
  4import typing
  5import pathlib
  6from styxdefs import *
  7
  8PASTE_IMAGE_INTO_IMAGE_METADATA = Metadata(
  9    id="84fede77ce1571671d2df31a0ca7da2716107704.boutiques",
 10    name="PasteImageIntoImage",
 11    package="ants",
 12    container_image_tag="antsx/ants:v2.5.3",
 13)
 14
 15
 16PasteImageIntoImageParameters = typing.TypedDict('PasteImageIntoImageParameters', {
 17    "__STYX_TYPE__": typing.Literal["PasteImageIntoImage"],
 18    "image_dimension": int,
 19    "input_canvas_image": InputPathType,
 20    "input_image": InputPathType,
 21    "output_image": str,
 22    "start_index": str,
 23    "background_label": typing.NotRequired[int | None],
 24    "paint_over_non_background_voxels": typing.NotRequired[typing.Literal[0, 1, 2] | None],
 25    "conflict_label": typing.NotRequired[int | None],
 26})
 27
 28
 29def dyn_cargs(
 30    t: str,
 31) -> typing.Any:
 32    """
 33    Get build cargs function by command type.
 34    
 35    Args:
 36        t: Command type.
 37    Returns:
 38        Build cargs function.
 39    """
 40    return {
 41        "PasteImageIntoImage": paste_image_into_image_cargs,
 42    }.get(t)
 43
 44
 45def dyn_outputs(
 46    t: str,
 47) -> typing.Any:
 48    """
 49    Get build outputs function by command type.
 50    
 51    Args:
 52        t: Command type.
 53    Returns:
 54        Build outputs function.
 55    """
 56    return {
 57        "PasteImageIntoImage": paste_image_into_image_outputs,
 58    }.get(t)
 59
 60
 61class PasteImageIntoImageOutputs(typing.NamedTuple):
 62    """
 63    Output object returned when calling `paste_image_into_image(...)`.
 64    """
 65    root: OutputPathType
 66    """Output root folder. This is the root folder for all outputs."""
 67    output_image_file: OutputPathType
 68    """The final output image with the input image pasted onto the canvas."""
 69
 70
 71def paste_image_into_image_params(
 72    image_dimension: int,
 73    input_canvas_image: InputPathType,
 74    input_image: InputPathType,
 75    output_image: str,
 76    start_index: str,
 77    background_label: int | None = 0,
 78    paint_over_non_background_voxels: typing.Literal[0, 1, 2] | None = 0,
 79    conflict_label: int | None = -1,
 80) -> PasteImageIntoImageParameters:
 81    """
 82    Build parameters.
 83    
 84    Args:
 85        image_dimension: Specify the dimension of the images.
 86        input_canvas_image: The canvas image on which the input image will be\
 87            pasted.
 88        input_image: The image to be pasted onto the canvas.
 89        output_image: The resulting image after pasting.
 90        start_index: The starting index where the input image will be pasted on\
 91            the canvas.
 92        background_label: The label value considered as background.
 93        paint_over_non_background_voxels: Defines behavior when the input image\
 94            voxel is non-background and the corresponding canvas voxel is\
 95            background: 0 - leave as is, 1 - replace with input voxel value, 2 -\
 96            replace with conflict label.
 97        conflict_label: The label value used for conflicting non-background\
 98            voxels if 'paintOverNonBackgroundVoxels' is set to 2.
 99    Returns:
100        Parameter dictionary
101    """
102    params = {
103        "__STYXTYPE__": "PasteImageIntoImage",
104        "image_dimension": image_dimension,
105        "input_canvas_image": input_canvas_image,
106        "input_image": input_image,
107        "output_image": output_image,
108        "start_index": start_index,
109    }
110    if background_label is not None:
111        params["background_label"] = background_label
112    if paint_over_non_background_voxels is not None:
113        params["paint_over_non_background_voxels"] = paint_over_non_background_voxels
114    if conflict_label is not None:
115        params["conflict_label"] = conflict_label
116    return params
117
118
119def paste_image_into_image_cargs(
120    params: PasteImageIntoImageParameters,
121    execution: Execution,
122) -> list[str]:
123    """
124    Build command-line arguments from parameters.
125    
126    Args:
127        params: The parameters.
128        execution: The execution object for resolving input paths.
129    Returns:
130        Command-line arguments.
131    """
132    cargs = []
133    cargs.append("PasteImageIntoImage")
134    cargs.append(str(params.get("image_dimension")))
135    cargs.append(execution.input_file(params.get("input_canvas_image")))
136    cargs.append(execution.input_file(params.get("input_image")))
137    cargs.append(params.get("output_image"))
138    cargs.append(params.get("start_index"))
139    if params.get("background_label") is not None:
140        cargs.append(str(params.get("background_label")))
141    if params.get("paint_over_non_background_voxels") is not None:
142        cargs.append(str(params.get("paint_over_non_background_voxels")))
143    if params.get("conflict_label") is not None:
144        cargs.append(str(params.get("conflict_label")))
145    return cargs
146
147
148def paste_image_into_image_outputs(
149    params: PasteImageIntoImageParameters,
150    execution: Execution,
151) -> PasteImageIntoImageOutputs:
152    """
153    Build outputs object containing output file paths and possibly stdout/stderr.
154    
155    Args:
156        params: The parameters.
157        execution: The execution object for resolving input paths.
158    Returns:
159        Outputs object.
160    """
161    ret = PasteImageIntoImageOutputs(
162        root=execution.output_file("."),
163        output_image_file=execution.output_file(params.get("output_image")),
164    )
165    return ret
166
167
168def paste_image_into_image_execute(
169    params: PasteImageIntoImageParameters,
170    execution: Execution,
171) -> PasteImageIntoImageOutputs:
172    """
173    Paste the input image into the input canvas image. Depending on parameters, it
174    can replace or merge existing voxel values.
175    
176    Author: ANTs Developers
177    
178    URL: https://github.com/ANTsX/ANTs
179    
180    Args:
181        params: The parameters.
182        execution: The execution object.
183    Returns:
184        NamedTuple of outputs (described in `PasteImageIntoImageOutputs`).
185    """
186    params = execution.params(params)
187    cargs = paste_image_into_image_cargs(params, execution)
188    ret = paste_image_into_image_outputs(params, execution)
189    execution.run(cargs)
190    return ret
191
192
193def paste_image_into_image(
194    image_dimension: int,
195    input_canvas_image: InputPathType,
196    input_image: InputPathType,
197    output_image: str,
198    start_index: str,
199    background_label: int | None = 0,
200    paint_over_non_background_voxels: typing.Literal[0, 1, 2] | None = 0,
201    conflict_label: int | None = -1,
202    runner: Runner | None = None,
203) -> PasteImageIntoImageOutputs:
204    """
205    Paste the input image into the input canvas image. Depending on parameters, it
206    can replace or merge existing voxel values.
207    
208    Author: ANTs Developers
209    
210    URL: https://github.com/ANTsX/ANTs
211    
212    Args:
213        image_dimension: Specify the dimension of the images.
214        input_canvas_image: The canvas image on which the input image will be\
215            pasted.
216        input_image: The image to be pasted onto the canvas.
217        output_image: The resulting image after pasting.
218        start_index: The starting index where the input image will be pasted on\
219            the canvas.
220        background_label: The label value considered as background.
221        paint_over_non_background_voxels: Defines behavior when the input image\
222            voxel is non-background and the corresponding canvas voxel is\
223            background: 0 - leave as is, 1 - replace with input voxel value, 2 -\
224            replace with conflict label.
225        conflict_label: The label value used for conflicting non-background\
226            voxels if 'paintOverNonBackgroundVoxels' is set to 2.
227        runner: Command runner.
228    Returns:
229        NamedTuple of outputs (described in `PasteImageIntoImageOutputs`).
230    """
231    runner = runner or get_global_runner()
232    execution = runner.start_execution(PASTE_IMAGE_INTO_IMAGE_METADATA)
233    params = paste_image_into_image_params(
234        image_dimension=image_dimension,
235        input_canvas_image=input_canvas_image,
236        input_image=input_image,
237        output_image=output_image,
238        start_index=start_index,
239        background_label=background_label,
240        paint_over_non_background_voxels=paint_over_non_background_voxels,
241        conflict_label=conflict_label,
242    )
243    return paste_image_into_image_execute(params, execution)
244
245
246__all__ = [
247    "PASTE_IMAGE_INTO_IMAGE_METADATA",
248    "PasteImageIntoImageOutputs",
249    "PasteImageIntoImageParameters",
250    "paste_image_into_image",
251    "paste_image_into_image_params",
252]
PASTE_IMAGE_INTO_IMAGE_METADATA = Metadata(id='84fede77ce1571671d2df31a0ca7da2716107704.boutiques', name='PasteImageIntoImage', package='ants', citations=None, container_image_tag='antsx/ants:v2.5.3')
class PasteImageIntoImageOutputs(typing.NamedTuple):
62class PasteImageIntoImageOutputs(typing.NamedTuple):
63    """
64    Output object returned when calling `paste_image_into_image(...)`.
65    """
66    root: OutputPathType
67    """Output root folder. This is the root folder for all outputs."""
68    output_image_file: OutputPathType
69    """The final output image with the input image pasted onto the canvas."""

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

PasteImageIntoImageOutputs(root: pathlib._local.Path, output_image_file: pathlib._local.Path)

Create new instance of PasteImageIntoImageOutputs(root, output_image_file)

root: pathlib._local.Path

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

output_image_file: pathlib._local.Path

The final output image with the input image pasted onto the canvas.

class PasteImageIntoImageParameters(typing.TypedDict):
image_dimension: int
input_canvas_image: pathlib._local.Path | str
input_image: pathlib._local.Path | str
output_image: str
start_index: str
background_label: NotRequired[int | None]
paint_over_non_background_voxels: NotRequired[Optional[Literal[0, 1, 2]]]
conflict_label: NotRequired[int | None]
def paste_image_into_image( image_dimension: int, input_canvas_image: pathlib._local.Path | str, input_image: pathlib._local.Path | str, output_image: str, start_index: str, background_label: int | None = 0, paint_over_non_background_voxels: Optional[Literal[0, 1, 2]] = 0, conflict_label: int | None = -1, runner: styxdefs.types.Runner | None = None) -> PasteImageIntoImageOutputs:
194def paste_image_into_image(
195    image_dimension: int,
196    input_canvas_image: InputPathType,
197    input_image: InputPathType,
198    output_image: str,
199    start_index: str,
200    background_label: int | None = 0,
201    paint_over_non_background_voxels: typing.Literal[0, 1, 2] | None = 0,
202    conflict_label: int | None = -1,
203    runner: Runner | None = None,
204) -> PasteImageIntoImageOutputs:
205    """
206    Paste the input image into the input canvas image. Depending on parameters, it
207    can replace or merge existing voxel values.
208    
209    Author: ANTs Developers
210    
211    URL: https://github.com/ANTsX/ANTs
212    
213    Args:
214        image_dimension: Specify the dimension of the images.
215        input_canvas_image: The canvas image on which the input image will be\
216            pasted.
217        input_image: The image to be pasted onto the canvas.
218        output_image: The resulting image after pasting.
219        start_index: The starting index where the input image will be pasted on\
220            the canvas.
221        background_label: The label value considered as background.
222        paint_over_non_background_voxels: Defines behavior when the input image\
223            voxel is non-background and the corresponding canvas voxel is\
224            background: 0 - leave as is, 1 - replace with input voxel value, 2 -\
225            replace with conflict label.
226        conflict_label: The label value used for conflicting non-background\
227            voxels if 'paintOverNonBackgroundVoxels' is set to 2.
228        runner: Command runner.
229    Returns:
230        NamedTuple of outputs (described in `PasteImageIntoImageOutputs`).
231    """
232    runner = runner or get_global_runner()
233    execution = runner.start_execution(PASTE_IMAGE_INTO_IMAGE_METADATA)
234    params = paste_image_into_image_params(
235        image_dimension=image_dimension,
236        input_canvas_image=input_canvas_image,
237        input_image=input_image,
238        output_image=output_image,
239        start_index=start_index,
240        background_label=background_label,
241        paint_over_non_background_voxels=paint_over_non_background_voxels,
242        conflict_label=conflict_label,
243    )
244    return paste_image_into_image_execute(params, execution)

Paste the input image into the input canvas image. Depending on parameters, it can replace or merge existing voxel values.

Author: ANTs Developers

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

Arguments:
  • image_dimension: Specify the dimension of the images.
  • input_canvas_image: The canvas image on which the input image will be pasted.
  • input_image: The image to be pasted onto the canvas.
  • output_image: The resulting image after pasting.
  • start_index: The starting index where the input image will be pasted on the canvas.
  • background_label: The label value considered as background.
  • paint_over_non_background_voxels: Defines behavior when the input image voxel is non-background and the corresponding canvas voxel is background: 0 - leave as is, 1 - replace with input voxel value, 2 - replace with conflict label.
  • conflict_label: The label value used for conflicting non-background voxels if 'paintOverNonBackgroundVoxels' is set to 2.
  • runner: Command runner.
Returns:

NamedTuple of outputs (described in PasteImageIntoImageOutputs).

def paste_image_into_image_params( image_dimension: int, input_canvas_image: pathlib._local.Path | str, input_image: pathlib._local.Path | str, output_image: str, start_index: str, background_label: int | None = 0, paint_over_non_background_voxels: Optional[Literal[0, 1, 2]] = 0, conflict_label: int | None = -1) -> PasteImageIntoImageParameters:
 72def paste_image_into_image_params(
 73    image_dimension: int,
 74    input_canvas_image: InputPathType,
 75    input_image: InputPathType,
 76    output_image: str,
 77    start_index: str,
 78    background_label: int | None = 0,
 79    paint_over_non_background_voxels: typing.Literal[0, 1, 2] | None = 0,
 80    conflict_label: int | None = -1,
 81) -> PasteImageIntoImageParameters:
 82    """
 83    Build parameters.
 84    
 85    Args:
 86        image_dimension: Specify the dimension of the images.
 87        input_canvas_image: The canvas image on which the input image will be\
 88            pasted.
 89        input_image: The image to be pasted onto the canvas.
 90        output_image: The resulting image after pasting.
 91        start_index: The starting index where the input image will be pasted on\
 92            the canvas.
 93        background_label: The label value considered as background.
 94        paint_over_non_background_voxels: Defines behavior when the input image\
 95            voxel is non-background and the corresponding canvas voxel is\
 96            background: 0 - leave as is, 1 - replace with input voxel value, 2 -\
 97            replace with conflict label.
 98        conflict_label: The label value used for conflicting non-background\
 99            voxels if 'paintOverNonBackgroundVoxels' is set to 2.
100    Returns:
101        Parameter dictionary
102    """
103    params = {
104        "__STYXTYPE__": "PasteImageIntoImage",
105        "image_dimension": image_dimension,
106        "input_canvas_image": input_canvas_image,
107        "input_image": input_image,
108        "output_image": output_image,
109        "start_index": start_index,
110    }
111    if background_label is not None:
112        params["background_label"] = background_label
113    if paint_over_non_background_voxels is not None:
114        params["paint_over_non_background_voxels"] = paint_over_non_background_voxels
115    if conflict_label is not None:
116        params["conflict_label"] = conflict_label
117    return params

Build parameters.

Arguments:
  • image_dimension: Specify the dimension of the images.
  • input_canvas_image: The canvas image on which the input image will be pasted.
  • input_image: The image to be pasted onto the canvas.
  • output_image: The resulting image after pasting.
  • start_index: The starting index where the input image will be pasted on the canvas.
  • background_label: The label value considered as background.
  • paint_over_non_background_voxels: Defines behavior when the input image voxel is non-background and the corresponding canvas voxel is background: 0 - leave as is, 1 - replace with input voxel value, 2 - replace with conflict label.
  • conflict_label: The label value used for conflicting non-background voxels if 'paintOverNonBackgroundVoxels' is set to 2.
Returns:

Parameter dictionary