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

import typing
import pathlib
from styxdefs import *
import dataclasses

INVFEATREG_METADATA = Metadata(
    id="ec6c695b85ee8f30eca8a86da04b682aec916c23.boutiques",
    name="invfeatreg",
    package="fsl",
    container_image_tag="mcin/fsl:6.0.5",
)


class InvfeatregOutputs(typing.NamedTuple):
    """
    Output object returned when calling `invfeatreg(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    inverted_warp_file: OutputPathType
    """Inverted warp file"""


def invfeatreg(
    warp_file: InputPathType,
    reference: InputPathType,
    output_file: str,
    verbose_flag: bool = False,
    runner: Runner | None = None,
) -> InvfeatregOutputs:
    """
    Inverse warp image using FNIRT.
    
    Author: Oxford Centre for Functional MRI of the Brain (FMRIB)
    
    URL: https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FNIRT
    
    Args:
        warp_file: Input warp file (e.g., highres2standard_warp).
        reference: Reference image (e.g., highres.nii.gz).
        output_file: Output filename for the inverted warp file (e.g.,\
            standard2highres_warp).
        verbose_flag: Verbose (switch on diagnostic messages).
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `InvfeatregOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(INVFEATREG_METADATA)
    cargs = []
    cargs.append("invwarp")
    cargs.append("-w")
    cargs.append(execution.input_file(warp_file))
    cargs.append("-r")
    cargs.append(execution.input_file(reference))
    cargs.append("-o")
    cargs.append(output_file)
    if verbose_flag:
        cargs.append("-v")
    ret = InvfeatregOutputs(
        root=execution.output_file("."),
        inverted_warp_file=execution.output_file(output_file),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "INVFEATREG_METADATA",
    "InvfeatregOutputs",
    "invfeatreg",
]
