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

import typing
import pathlib
from styxdefs import *
import dataclasses

DIMON_METADATA = Metadata(
    id="47141d28c3f7ccd9b2aa834d602f55feeab89023.boutiques",
    name="Dimon",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


class DimonOutputs(typing.NamedTuple):
    """
    Output object returned when calling `dimon(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    sorted_files: OutputPathType
    """Sorted input files with specified prefix"""
    sorted_files_details: OutputPathType | None
    """Details about sorted files"""


def dimon(
    infile_prefix: str,
    infile_pattern: str | None = None,
    infile_list: InputPathType | None = None,
    rt_cmd: str | None = None,
    host: str | None = None,
    drive_afni: str | None = None,
    drive_wait: str | None = None,
    te_list: str | None = None,
    sort_method: str | None = None,
    runner: Runner | None = None,
) -> DimonOutputs:
    """
    Monitor real-time acquisition of DICOM image files.
    
    Author: AFNI Developers
    
    URL: https://afni.nimh.nih.gov/
    
    Args:
        infile_prefix: Prefix matching input files.
        infile_pattern: Pattern for input files.
        infile_list: List of filenames.
        rt_cmd: Send COMMAND(s) to realtime plugin.
        host: Specify the host for afni communication.
        drive_afni: Send 'drive afni' command, CMND.
        drive_wait: Send delayed 'drive afni' command, CMND.
        te_list: Specify a list of echo times.
        sort_method: Apply sorting method to image structures.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `DimonOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(DIMON_METADATA)
    cargs = []
    cargs.append("Dimon")
    cargs.extend([
        "-infile_prefix",
        infile_prefix
    ])
    if infile_pattern is not None:
        cargs.extend([
            "-infile_pattern",
            infile_pattern
        ])
    if infile_list is not None:
        cargs.extend([
            "-infile_list",
            execution.input_file(infile_list)
        ])
    if rt_cmd is not None:
        cargs.extend([
            "-rt_cmd",
            rt_cmd
        ])
    if host is not None:
        cargs.extend([
            "-host",
            host
        ])
    if drive_afni is not None:
        cargs.extend([
            "-drive_afni",
            drive_afni
        ])
    if drive_wait is not None:
        cargs.extend([
            "-drive_wait",
            drive_wait
        ])
    if te_list is not None:
        cargs.extend([
            "-te_list",
            te_list
        ])
    if sort_method is not None:
        cargs.extend([
            "-sort_method",
            sort_method
        ])
    ret = DimonOutputs(
        root=execution.output_file("."),
        sorted_files=execution.output_file(infile_prefix + "*"),
        sorted_files_details=execution.output_file(pathlib.Path(infile_list).name + "_details") if (infile_list is not None) else None,
    )
    execution.run(cargs)
    return ret


__all__ = [
    "DIMON_METADATA",
    "DimonOutputs",
    "dimon",
]
