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

import typing
import pathlib
from styxdefs import *
import dataclasses

V__COMPUTE_OC_WEIGHTS_METADATA = Metadata(
    id="5e3f682a30f5996c6391430edd011c5417a938ae.boutiques",
    name="@compute_OC_weights",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


class VComputeOcWeightsOutputs(typing.NamedTuple):
    """
    Output object returned when calling `v__compute_oc_weights(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_oc_weights: OutputPathType | None
    """Resulting OC weights dataset"""


def v__compute_oc_weights(
    echo_dsets: list[str],
    echo_times: str | None = None,
    prefix: str | None = None,
    def_to_equal: str | None = None,
    oc_method: str | None = None,
    sum_weight_tolerance: float | None = None,
    t2_star_limit: float | None = None,
    work_dir: str | None = None,
    verbosity: bool = False,
    runner: Runner | None = None,
) -> VComputeOcWeightsOutputs:
    """
    Compute optimal combined weights dataset for multi-echo EPI data.
    
    Author: AFNI Team
    
    URL:
    https://afni.nimh.nih.gov/pub/dist/doc/program_help/@compute_OC_weights.html
    
    Args:
        echo_dsets: Specify one run of multi-echo EPI data.
        echo_times: Specify echo times as list (e.g., "15 30.5 41"). Use either\
            -echo_times or -echo_times_files.
        prefix: Specify prefix of resulting OC weights dataset (e.g.,\
            OC.weights.SUBJ).
        def_to_equal: Specify whether to default to equal weights (default =\
            no).
        oc_method: Specify which OC method to employ (default = OC_A).
        sum_weight_tolerance: Tolerance for summed weight difference from 1.0\
            (default = 0.001).
        t2_star_limit: Specify limit for T2* values (default = 300).
        work_dir: Specify directory to compute results in.
        verbosity: Increase verbosity of output.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `VComputeOcWeightsOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(V__COMPUTE_OC_WEIGHTS_METADATA)
    cargs = []
    cargs.append("@compute_OC_weights")
    if echo_times is not None:
        cargs.extend([
            "-echo_times",
            echo_times
        ])
    cargs.extend([
        "-echo_dsets",
        *echo_dsets
    ])
    if prefix is not None:
        cargs.extend([
            "-prefix",
            prefix
        ])
    if def_to_equal is not None:
        cargs.extend([
            "-def_to_equal",
            def_to_equal
        ])
    if oc_method is not None:
        cargs.extend([
            "-oc_method",
            oc_method
        ])
    if sum_weight_tolerance is not None:
        cargs.extend([
            "-sum_weight_tolerance",
            str(sum_weight_tolerance)
        ])
    if t2_star_limit is not None:
        cargs.extend([
            "-t2_star_limit",
            str(t2_star_limit)
        ])
    if work_dir is not None:
        cargs.extend([
            "-work_dir",
            work_dir
        ])
    if verbosity:
        cargs.append("-verb")
    ret = VComputeOcWeightsOutputs(
        root=execution.output_file("."),
        output_oc_weights=execution.output_file(prefix + "+tlrc.HEAD") if (prefix is not None) else None,
    )
    execution.run(cargs)
    return ret


__all__ = [
    "VComputeOcWeightsOutputs",
    "V__COMPUTE_OC_WEIGHTS_METADATA",
    "v__compute_oc_weights",
]
