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

import typing
import pathlib
from styxdefs import *
import dataclasses

V_3D_TTO1_D_METADATA = Metadata(
    id="c4536089d729353b2214d75b62553c23db962d0e.boutiques",
    name="3dTto1D",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


class V3dTto1DOutputs(typing.NamedTuple):
    """
    Output object returned when calling `v_3d_tto1_d(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_file: OutputPathType | None
    """Output 1D time series file"""


def v_3d_tto1_d(
    input_dataset: InputPathType,
    method: str,
    automask: bool = False,
    mask: InputPathType | None = None,
    prefix: str | None = None,
    verbose: float | None = None,
    runner: Runner | None = None,
) -> V3dTto1DOutputs:
    """
    Collapse a 4D time series to a 1D time series.
    
    Author: AFNI Developers
    
    URL: https://afni.nimh.nih.gov/
    
    Args:
        input_dataset: Specify input dataset. This should be a set of 3D time\
            series. If the input is in 1D format, a transpose operator will\
            typically be required.
        method: Specify 4D to 1D conversion method. Methods include: enorm,\
            dvars, srms, shift_srms, mdiff, smdiff, 4095_count, 4095_frac,\
            4095_warn.
        automask: Restrict computation to automask.
        mask: Restrict computation to given mask.
        prefix: Specify output file. Default is stdout.
        verbose: Specify verbose level. Default is 1.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `V3dTto1DOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(V_3D_TTO1_D_METADATA)
    cargs = []
    cargs.append("3dTto1D")
    cargs.extend([
        "-input",
        execution.input_file(input_dataset)
    ])
    cargs.extend([
        "-method",
        method
    ])
    if automask:
        cargs.append("-automask")
    if mask is not None:
        cargs.extend([
            "-mask",
            execution.input_file(mask)
        ])
    if prefix is not None:
        cargs.extend([
            "-prefix",
            prefix
        ])
    if verbose is not None:
        cargs.extend([
            "-verb",
            str(verbose)
        ])
    ret = V3dTto1DOutputs(
        root=execution.output_file("."),
        output_file=execution.output_file(prefix) if (prefix is not None) else None,
    )
    execution.run(cargs)
    return ret


__all__ = [
    "V3dTto1DOutputs",
    "V_3D_TTO1_D_METADATA",
    "v_3d_tto1_d",
]
