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

import typing
import pathlib
from styxdefs import *
import dataclasses

GDCMCONV_FS_METADATA = Metadata(
    id="c4cb69979a329deef98f15b2e797b9c57375a6ef.boutiques",
    name="gdcmconv.fs",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class GdcmconvFsOutputs(typing.NamedTuple):
    """
    Output object returned when calling `gdcmconv_fs(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""


def gdcmconv_fs(
    input_file: InputPathType,
    output_file: str,
    explicit_flag: bool = False,
    implicit_flag: bool = False,
    use_dict_flag: bool = False,
    with_private_dict_flag: bool = False,
    check_meta_flag: bool = False,
    root_uid: str | None = None,
    remove_gl_flag: bool = False,
    remove_private_tags_flag: bool = False,
    remove_retired_flag: bool = False,
    apply_lut_flag: bool = False,
    photometric_interpretation: str | None = None,
    raw_flag: bool = False,
    deflated_flag: bool = False,
    jpeg_flag: bool = False,
    j2k_flag: bool = False,
    jpegls_flag: bool = False,
    rle_flag: bool = False,
    force_flag: bool = False,
    generate_icon_flag: bool = False,
    icon_minmax: list[float] | None = None,
    icon_auto_minmax_flag: bool = False,
    compress_icon_flag: bool = False,
    planar_configuration: str | None = None,
    lossy_flag: bool = False,
    split: float | None = None,
    verbose_flag: bool = False,
    warning_flag: bool = False,
    debug_flag: bool = False,
    error_flag: bool = False,
    quiet_flag: bool = False,
    jpeg_quality: float | None = None,
    lossy_error: int | None = None,
    rate: float | None = None,
    j2k_quality: float | None = None,
    tile: list[float] | None = None,
    number_resolution: float | None = None,
    irreversible_flag: bool = False,
    ignore_errors_flag: bool = False,
    runner: Runner | None = None,
) -> GdcmconvFsOutputs:
    """
    Convert a DICOM file into another DICOM file.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        input_file: Input DICOM filename.
        output_file: Output DICOM filename.
        explicit_flag: Change Transfer Syntax to explicit.
        implicit_flag: Change Transfer Syntax to implicit.
        use_dict_flag: Use dict for VR (only public by default).
        with_private_dict_flag: Use private dict for VR (advanced user only).
        check_meta_flag: Check File Meta Information (advanced user only).
        root_uid: Root UID.
        remove_gl_flag: Remove group length (deprecated in DICOM 2008).
        remove_private_tags_flag: Remove private tags.
        remove_retired_flag: Remove retired tags.
        apply_lut_flag: Apply LUT (non-standard, advanced user only).
        photometric_interpretation: Change Photometric Interpretation (when\
            possible).
        raw_flag: Decompress image.
        deflated_flag: Compress using deflated (gzip).
        jpeg_flag: Compress image in jpeg.
        j2k_flag: Compress image in j2k.
        jpegls_flag: Compress image in jpeg-ls.
        rle_flag: Compress image in rle (lossless only).
        force_flag: Force decompression/merging before recompression/splitting.
        generate_icon_flag: Generate icon.
        icon_minmax: Min/Max value for icon.
        icon_auto_minmax_flag: Automatically compute best Min/Max values for\
            icon.
        compress_icon_flag: Decide whether icon follows main Transfer Syntax or\
            remains uncompressed.
        planar_configuration: Change planar configuration.
        lossy_flag: Use the lossy (if possible) compressor.
        split: Write 2D image with multiple fragments (using max size).
        verbose_flag: More verbose (warning+error).
        warning_flag: Print warning info.
        debug_flag: Print debug info.
        error_flag: Print error info.
        quiet_flag: Do not print to stdout.
        jpeg_quality: Set JPEG quality.
        lossy_error: Set JPEG-LS lossy error.
        rate: Set J2K rate.
        j2k_quality: Set J2K quality.
        tile: Set J2K tile size.
        number_resolution: Set number of resolution.
        irreversible_flag: Set irreversible.
        ignore_errors_flag: Convert even if file is corrupted (advanced users\
            only, see disclaimers).
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `GdcmconvFsOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(GDCMCONV_FS_METADATA)
    cargs = []
    cargs.append("gdcmconv")
    cargs.append(execution.input_file(input_file))
    cargs.append(output_file)
    if explicit_flag:
        cargs.append("-X")
    if implicit_flag:
        cargs.append("-M")
    if use_dict_flag:
        cargs.append("-U")
    if with_private_dict_flag:
        cargs.append("--with-private-dict")
    if check_meta_flag:
        cargs.append("-C")
    if root_uid is not None:
        cargs.extend([
            "--root-uid",
            root_uid
        ])
    if remove_gl_flag:
        cargs.append("--remove-gl")
    if remove_private_tags_flag:
        cargs.append("--remove-private-tags")
    if remove_retired_flag:
        cargs.append("--remove-retired")
    if apply_lut_flag:
        cargs.append("-l")
    if photometric_interpretation is not None:
        cargs.extend([
            "-P",
            photometric_interpretation
        ])
    if raw_flag:
        cargs.append("-w")
    if deflated_flag:
        cargs.append("-d")
    if jpeg_flag:
        cargs.append("-J")
    if j2k_flag:
        cargs.append("-K")
    if jpegls_flag:
        cargs.append("-L")
    if rle_flag:
        cargs.append("-R")
    if force_flag:
        cargs.append("-F")
    if generate_icon_flag:
        cargs.append("--generate-icon")
    if icon_minmax is not None:
        cargs.extend([
            "--icon-minmax",
            *map(str, icon_minmax)
        ])
    if icon_auto_minmax_flag:
        cargs.append("--icon-auto-minmax")
    if compress_icon_flag:
        cargs.append("--compress-icon")
    if planar_configuration is not None:
        cargs.extend([
            "--planar-configuration",
            planar_configuration
        ])
    if lossy_flag:
        cargs.append("-Y")
    if split is not None:
        cargs.extend([
            "-S",
            str(split)
        ])
    if verbose_flag:
        cargs.append("-V")
    if warning_flag:
        cargs.append("-W")
    if debug_flag:
        cargs.append("-D")
    if error_flag:
        cargs.append("-E")
    if quiet_flag:
        cargs.append("--quiet")
    if jpeg_quality is not None:
        cargs.extend([
            "-q",
            str(jpeg_quality)
        ])
    if lossy_error is not None:
        cargs.extend([
            "-e",
            str(lossy_error)
        ])
    if rate is not None:
        cargs.extend([
            "-r",
            str(rate)
        ])
    if j2k_quality is not None:
        cargs.extend([
            "-q",
            str(j2k_quality)
        ])
    if tile is not None:
        cargs.extend([
            "-t",
            *map(str, tile)
        ])
    if number_resolution is not None:
        cargs.extend([
            "-n",
            str(number_resolution)
        ])
    if irreversible_flag:
        cargs.append("--irreversible")
    if ignore_errors_flag:
        cargs.append("-I")
    ret = GdcmconvFsOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "GDCMCONV_FS_METADATA",
    "GdcmconvFsOutputs",
    "gdcmconv_fs",
]
