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

import typing
import pathlib
from styxdefs import *
import dataclasses

DICOM_RENAME_METADATA = Metadata(
    id="2eb87845c3a6be71bcd6bb57089f0cd879da57d4.boutiques",
    name="dicom-rename",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class DicomRenameOutputs(typing.NamedTuple):
    """
    Output object returned when calling `dicom_rename(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    renamed_dicom: OutputPathType
    """Renamed output DICOM file with series and image numbers."""


def dicom_rename(
    input_files: list[InputPathType],
    output_base: str,
    runner: Runner | None = None,
) -> DicomRenameOutputs:
    """
    Copies dicom file(s) to new path with more meaningful names.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        input_files: Input DICOM files to be renamed.
        output_base: Base name for output files that includes series and image\
            numbers.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `DicomRenameOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(DICOM_RENAME_METADATA)
    cargs = []
    cargs.extend([
        "-rename",
        "dicom" + "".join([execution.input_file(f) for f in input_files])
    ])
    cargs.extend([
        "--o",
        output_base
    ])
    ret = DicomRenameOutputs(
        root=execution.output_file("."),
        renamed_dicom=execution.output_file(output_base + "-SSS-IIIII.dcm"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "DICOM_RENAME_METADATA",
    "DicomRenameOutputs",
    "dicom_rename",
]
