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

import typing
import pathlib
from styxdefs import *
import dataclasses

MAP_TRACK_ID_METADATA = Metadata(
    id="8a4654eaf53cc77b2cf484e321c0f2ad7ebde3ea.boutiques",
    name="map_TrackID",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


class MapTrackIdOutputs(typing.NamedTuple):
    """
    Output object returned when calling `map_track_id(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_trk_file: OutputPathType
    """Mapped track file to new space"""


def map_track_id(
    prefix: str,
    in_trk: InputPathType,
    in_map: InputPathType,
    reference: InputPathType,
    verbose: bool = False,
    orig_zero: bool = False,
    line_only_num: bool = False,
    already_inv: bool = False,
    runner: Runner | None = None,
) -> MapTrackIdOutputs:
    """
    Maps the track file (*.trk) output of 3dTrackID to another space using the
    1Dmatrix_save info of 3dAllineate.
    
    Author: AFNI Developers
    
    URL: https://afni.nimh.nih.gov/
    
    Args:
        prefix: Prefix for the output track file.
        in_trk: The name of the *.trk file to be mapped.
        in_map: Single line of matrix values for the transformation.
        reference: 3D data set in the space to which the TRK file is being\
            mapped.
        verbose: Verbose output.
        orig_zero: Put (0,0,0) as the origin in the output *.trk file.
        line_only_num: If your 1D_MATR file is just 12 numbers in a row.
        already_inv: If you have inverted the mapping or use another program\
            than 3dAllineate.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `MapTrackIdOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(MAP_TRACK_ID_METADATA)
    cargs = []
    cargs.append("map_TrackID")
    cargs.extend([
        "-prefix",
        prefix
    ])
    cargs.extend([
        "-in_trk",
        execution.input_file(in_trk)
    ])
    cargs.extend([
        "-in_map",
        execution.input_file(in_map)
    ])
    cargs.extend([
        "-ref",
        execution.input_file(reference)
    ])
    if verbose:
        cargs.append("-verb")
    if orig_zero:
        cargs.append("-orig_zero")
    if line_only_num:
        cargs.append("-line_only_num")
    if already_inv:
        cargs.append("-already_inv")
    ret = MapTrackIdOutputs(
        root=execution.output_file("."),
        output_trk_file=execution.output_file(prefix + ".trk"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "MAP_TRACK_ID_METADATA",
    "MapTrackIdOutputs",
    "map_track_id",
]
