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

import typing
import pathlib
from styxdefs import *
import dataclasses

PAIRREG_METADATA = Metadata(
    id="8107f07a5a681ee7ce20b9004ac2037129388509.boutiques",
    name="pairreg",
    package="fsl",
    container_image_tag="mcin/fsl:6.0.5",
)


class PairregOutputs(typing.NamedTuple):
    """
    Output object returned when calling `pairreg(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_matrix: OutputPathType
    """Pairwise registration output transformation matrix file"""


def pairreg(
    brain1: InputPathType,
    brain2: InputPathType,
    skull1: InputPathType,
    skull2: InputPathType,
    outputmatrix: InputPathType,
    extra_flirt_args: str | None = None,
    runner: Runner | None = None,
) -> PairregOutputs:
    """
    Pairwise registration tool.
    
    Author: Oxford Centre for Functional MRI of the Brain (FMRIB)
    
    URL: https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FLIRT
    
    Args:
        brain1: Brain image 1 (used as -ref internally).
        brain2: Brain image 2.
        skull1: Skull image 1 (used as -ref internally).
        skull2: Skull image 2.
        outputmatrix: Output transformation matrix file.
        extra_flirt_args: Extra arguments to pass to flirt.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `PairregOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(PAIRREG_METADATA)
    cargs = []
    cargs.append("/usr/local/fsl/bin/pairreg")
    cargs.append(execution.input_file(brain1))
    cargs.append(execution.input_file(brain2))
    cargs.append(execution.input_file(skull1))
    cargs.append(execution.input_file(skull2))
    cargs.append(execution.input_file(outputmatrix))
    if extra_flirt_args is not None:
        cargs.append(extra_flirt_args)
    ret = PairregOutputs(
        root=execution.output_file("."),
        output_matrix=execution.output_file(pathlib.Path(outputmatrix).name),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "PAIRREG_METADATA",
    "PairregOutputs",
    "pairreg",
]
