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

import typing
import pathlib
from styxdefs import *
import dataclasses

XSANATREG_METADATA = Metadata(
    id="fa7d0e1f8dd94e54884aa8dac608dad32d5de507.boutiques",
    name="xsanatreg",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


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


def xsanatreg(
    src_cordir: str,
    targ_cordir: str,
    transform_file: str,
    temp_directory: str | None = None,
    source_minc: str | None = None,
    target_minc: str | None = None,
    no_cleanup: bool = False,
    version: bool = False,
    umask: str | None = None,
    runner: Runner | None = None,
) -> XsanatregOutputs:
    """
    A tool for registering source and target COR volumes.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        src_cordir: Directory of source COR volume.
        targ_cordir: Directory of target COR volume.
        transform_file: File in which to store the transformation.
        temp_directory: Directory for temporary storage, defaults to /tmp.
        source_minc: File name for source minc, set automatically if not\
            specified.
        target_minc: File name for target minc, set automatically if not\
            specified.
        no_cleanup: Do not delete temporary minc files.
        version: Print version and exit.
        umask: Set file mode creation mask.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `XsanatregOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(XSANATREG_METADATA)
    cargs = []
    cargs.append("xsanatreg")
    cargs.extend([
        "-src",
        src_cordir
    ])
    cargs.extend([
        "-targ",
        targ_cordir
    ])
    cargs.extend([
        "-xfm",
        transform_file
    ])
    if temp_directory is not None:
        cargs.extend([
            "-tmpdir",
            temp_directory
        ])
    if source_minc is not None:
        cargs.extend([
            "-srcminc",
            source_minc
        ])
    if target_minc is not None:
        cargs.extend([
            "-targminc",
            target_minc
        ])
    if no_cleanup:
        cargs.append("-nocleanup")
    if version:
        cargs.append("-version")
    if umask is not None:
        cargs.extend([
            "-umask",
            umask
        ])
    ret = XsanatregOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "XSANATREG_METADATA",
    "XsanatregOutputs",
    "xsanatreg",
]
