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

import typing
import pathlib
from styxdefs import *
import dataclasses

MRI_MAP_CPDAT_METADATA = Metadata(
    id="0c1d6881dadae3c5b917be778e2808a99602f9d0.boutiques",
    name="mri_map_cpdat",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class MriMapCpdatOutputs(typing.NamedTuple):
    """
    Output object returned when calling `mri_map_cpdat(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_ctrl_file: OutputPathType
    """Output control point text file"""


def mri_map_cpdat(
    input_file: InputPathType,
    output_file: str,
    lta_file: InputPathType | None = None,
    to_mni305: str | None = None,
    from_mni305: str | None = None,
    subject_list_file: InputPathType | None = None,
    runner: Runner | None = None,
) -> MriMapCpdatOutputs:
    """
    Maps a control.dat file to a different space using an LTA.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        input_file: Input control point text file.
        output_file: Output control point text file.
        lta_file: LTA transform file to be applied.
        to_mni305: Get LTA from talairach.xfm for a specific subject.
        from_mni305: Get LTA from talairach.xfm from a specific subject.
        subject_list_file: Maps all control points from all subjects listed in\
            the text/ascii subjectlistfile to MNI305 (talairach) space.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `MriMapCpdatOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(MRI_MAP_CPDAT_METADATA)
    cargs = []
    cargs.append("mri_map_cpdat")
    cargs.extend([
        "-in",
        execution.input_file(input_file)
    ])
    cargs.extend([
        "-out",
        output_file
    ])
    if lta_file is not None:
        cargs.extend([
            "-lta",
            execution.input_file(lta_file)
        ])
    if to_mni305 is not None:
        cargs.extend([
            "-tomni305",
            to_mni305
        ])
    if from_mni305 is not None:
        cargs.extend([
            "-frommni305",
            from_mni305
        ])
    if subject_list_file is not None:
        cargs.extend([
            "-slf",
            execution.input_file(subject_list_file)
        ])
    ret = MriMapCpdatOutputs(
        root=execution.output_file("."),
        output_ctrl_file=execution.output_file(output_file),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "MRI_MAP_CPDAT_METADATA",
    "MriMapCpdatOutputs",
    "mri_map_cpdat",
]
