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

import typing
import pathlib
from styxdefs import *
import dataclasses

STD2IMGCOORD_METADATA = Metadata(
    id="05322cde0f0612798367ff4b15825c44466bc700.boutiques",
    name="std2imgcoord",
    package="fsl",
    container_image_tag="brainlife/fsl:6.0.4-patched2",
)


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


def std2imgcoord(
    filename_coordinates: InputPathType,
    input_image: InputPathType,
    standard_image: InputPathType | None = None,
    affine_transform: InputPathType | None = None,
    warp_field: InputPathType | None = None,
    prewarp_affine_transform: InputPathType | None = None,
    output_mm: bool = False,
    output_vox: bool = False,
    verbose: bool = False,
    more_verbose: bool = False,
    runner: Runner | None = None,
) -> Std2imgcoordOutputs:
    """
    Convert standard space coordinates to image space coordinates.
    
    Author: FMRIB Analysis Group, University of Oxford
    
    URL: https://fsl.fmrib.ox.ac.uk/fsl/fslwiki
    
    Args:
        filename_coordinates: Path to the filename containing coordinates or\
            '-' to read from standard input.
        input_image: Filename of input image.
        standard_image: Filename of standard image.
        affine_transform: Filename of affine transform (e.g.\
            example_func2standard.mat).
        warp_field: Filename of warpfield (e.g. highres2standard_warp.nii.gz).
        prewarp_affine_transform: Filename of pre-warp affine transform (e.g.\
            example_func2highres.mat). Defaults to identity matrix.
        output_mm: Outputs coordinates in mm (default).
        output_vox: Outputs coordinates in voxels.
        verbose: Verbose output.
        more_verbose: More verbose output.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `Std2imgcoordOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(STD2IMGCOORD_METADATA)
    cargs = []
    cargs.append("std2imgcoord")
    cargs.append(execution.input_file(filename_coordinates))
    if standard_image is not None:
        cargs.extend([
            "-std",
            execution.input_file(standard_image)
        ])
    cargs.extend([
        "-img",
        execution.input_file(input_image)
    ])
    if affine_transform is not None:
        cargs.extend([
            "-xfm",
            execution.input_file(affine_transform)
        ])
    if warp_field is not None:
        cargs.extend([
            "-warp",
            execution.input_file(warp_field)
        ])
    if prewarp_affine_transform is not None:
        cargs.extend([
            "-premat",
            execution.input_file(prewarp_affine_transform)
        ])
    if output_mm:
        cargs.append("-mm")
    if output_vox:
        cargs.append("-vox")
    if verbose:
        cargs.append("-v")
    if more_verbose:
        cargs.append("-verbose")
    ret = Std2imgcoordOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "STD2IMGCOORD_METADATA",
    "Std2imgcoordOutputs",
    "std2imgcoord",
]
