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

import typing
import pathlib
from styxdefs import *
import dataclasses

VOLUME_LABEL_MODIFY_KEYS_METADATA = Metadata(
    id="3e9e975ebe915117d571b9514f44747025005713.boutiques",
    name="volume-label-modify-keys",
    package="workbench",
    container_image_tag="brainlife/connectome_workbench:1.5.0-freesurfer-update",
)


class VolumeLabelModifyKeysOutputs(typing.NamedTuple):
    """
    Output object returned when calling `volume_label_modify_keys(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    volume_out: OutputPathType
    """the output volume label file"""


def volume_label_modify_keys(
    volume_in: InputPathType,
    remap_file: str,
    volume_out: str,
    opt_subvolume_subvolume: str | None = None,
    runner: Runner | None = None,
) -> VolumeLabelModifyKeysOutputs:
    """
    Change key values in a volume label file.
    
    <remap-file> should have lines of the form 'oldkey newkey', like so:
    
    3 5
    5 8
    8 2
    
    This would change the current label with key '3' to use the key '5' instead,
    5 would use 8, and 8 would use 2. Any collision in key values results in the
    label that was not specified in the remap file getting remapped to an
    otherwise unused key. Remapping more than one key to the same new key, or
    the same key to more than one new key, results in an error. This will not
    change the appearance of the file when displayed, as it will change the key
    values in the data at the same time.
    
    Author: Washington University School of Medicin
    
    Args:
        volume_in: the input volume label file.
        remap_file: text file with old and new key values.
        volume_out: the output volume label file.
        opt_subvolume_subvolume: select a single subvolume: the subvolume\
            number or name.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `VolumeLabelModifyKeysOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(VOLUME_LABEL_MODIFY_KEYS_METADATA)
    cargs = []
    cargs.append("wb_command")
    cargs.append("-volume-label-modify-keys")
    cargs.append(execution.input_file(volume_in))
    cargs.append(remap_file)
    cargs.append(volume_out)
    if opt_subvolume_subvolume is not None:
        cargs.extend([
            "-subvolume",
            opt_subvolume_subvolume
        ])
    ret = VolumeLabelModifyKeysOutputs(
        root=execution.output_file("."),
        volume_out=execution.output_file(volume_out),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "VOLUME_LABEL_MODIFY_KEYS_METADATA",
    "VolumeLabelModifyKeysOutputs",
    "volume_label_modify_keys",
]
