# This file was auto generated by Styx.
# Do not edit this file directly.

import typing
import pathlib
from styxdefs import *
import dataclasses

IMG2IMGCOORD_METADATA = Metadata(
    id="c0184a18acdc535cdea447e6dcf5b37d6e69053d.boutiques",
    name="img2imgcoord",
    package="fsl",
    container_image_tag="brainlife/fsl:6.0.4-patched2",
)


class Img2imgcoordOutputs(typing.NamedTuple):
    """
    Output object returned when calling `img2imgcoord(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""


def img2imgcoord(
    coordinates_file: str,
    source_image: InputPathType,
    dest_image: InputPathType,
    affine_transform: InputPathType,
    warp_field: InputPathType | None = None,
    pre_warp_affine: InputPathType | None = None,
    coords_in_voxels: bool = False,
    coords_in_mm: bool = False,
    verbose: bool = False,
    help_: bool = False,
    runner: Runner | None = None,
) -> Img2imgcoordOutputs:
    """
    Tool for transforming coordinates between images.
    
    Author: FMRIB Analysis Group, University of Oxford
    
    URL: https://fsl.fmrib.ox.ac.uk/fsl/fslwiki
    
    Args:
        coordinates_file: Filename containing coordinates.
        source_image: Filename of source image.
        dest_image: Filename of destination image.
        affine_transform: Filename of affine transform (e.g. source2dest.mat).
        warp_field: Filename of warpfield (e.g. intermediate2dest_warp.nii.gz).
        pre_warp_affine: Filename of pre-warp affine transform\
            (default=identity).
        coords_in_voxels: All coordinates in voxels (default).
        coords_in_mm: All coordinates in mm.
        verbose: Verbose mode.
        help_: Display help message.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `Img2imgcoordOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(IMG2IMGCOORD_METADATA)
    cargs = []
    cargs.append("img2imgcoord")
    cargs.append(coordinates_file)
    cargs.extend([
        "-src",
        execution.input_file(source_image)
    ])
    cargs.extend([
        "-dest",
        execution.input_file(dest_image)
    ])
    cargs.extend([
        "-xfm",
        execution.input_file(affine_transform)
    ])
    if warp_field is not None:
        cargs.extend([
            "-warp",
            execution.input_file(warp_field)
        ])
    if pre_warp_affine is not None:
        cargs.extend([
            "-premat",
            execution.input_file(pre_warp_affine)
        ])
    if coords_in_voxels:
        cargs.append("-vox")
    if coords_in_mm:
        cargs.append("-mm")
    if verbose:
        cargs.append("-v")
    if help_:
        cargs.append("-help")
    ret = Img2imgcoordOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "IMG2IMGCOORD_METADATA",
    "Img2imgcoordOutputs",
    "img2imgcoord",
]
