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

import typing
import pathlib
from styxdefs import *
import dataclasses

FSDCMDECOMPRESS_METADATA = Metadata(
    id="1c245eb1f1f4a476626056075ca7b223ab9946b1.boutiques",
    name="fsdcmdecompress",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class FsdcmdecompressOutputs(typing.NamedTuple):
    """
    Output object returned when calling `fsdcmdecompress(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    out_file: OutputPathType
    """The decompressed DICOM file"""


def fsdcmdecompress(
    indcmfile: InputPathType,
    outdcmfile: str,
    dcmtk: bool = False,
    jpeg: bool = False,
    rle: bool = False,
    gdcm: bool = False,
    runner: Runner | None = None,
) -> FsdcmdecompressOutputs:
    """
    A tool for decompressing DICOM files using GDCM or DCMTK.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        indcmfile: Input DICOM file to decompress.
        outdcmfile: Output decompressed DICOM file.
        dcmtk: Use DCMTK for decompression (either dcmdrle.fs or dcmdjpeg.fs).
        jpeg: DICOM is JPEG compressed (ignored without --dcmtk).
        rle: DICOM is RLE compressed (ignored without --dcmtk).
        gdcm: Use GDCM for decompression (default).
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `FsdcmdecompressOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(FSDCMDECOMPRESS_METADATA)
    cargs = []
    cargs.append("fsdcmdecompress")
    cargs.extend([
        "--i",
        execution.input_file(indcmfile)
    ])
    cargs.extend([
        "--o",
        outdcmfile
    ])
    if dcmtk:
        cargs.append("--dcmtk")
    if jpeg:
        cargs.append("--jpeg")
    if rle:
        cargs.append("--rle")
    if gdcm:
        cargs.append("--gdcm")
    ret = FsdcmdecompressOutputs(
        root=execution.output_file("."),
        out_file=execution.output_file(outdcmfile),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "FSDCMDECOMPRESS_METADATA",
    "FsdcmdecompressOutputs",
    "fsdcmdecompress",
]
