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

import typing
import pathlib
from styxdefs import *
import dataclasses

V_3D_ANHIST_METADATA = Metadata(
    id="c5a8bc2df4e27276351e63f83dd18e2136b73956.boutiques",
    name="3dAnhist",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


class V3dAnhistOutputs(typing.NamedTuple):
    """
    Output object returned when calling `v_3d_anhist(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_1_d: OutputPathType
    """Dumped histogram data"""
    output_ps: OutputPathType
    """Plot of histogram data"""


def v_3d_anhist(
    dataset: InputPathType,
    quiet: bool = False,
    dump_histogram: bool = False,
    no_scurve: bool = False,
    winsorize: str | None = None,
    top_2peaks: bool = False,
    label: str | None = None,
    filename: str | None = None,
    runner: Runner | None = None,
) -> V3dAnhistOutputs:
    """
    Tool to analyze histogram peaks in a T1-weighted high-res brain image dataset.
    
    Author: AFNI Team
    
    URL: https://afni.nimh.nih.gov/pub/dist/doc/program_help/3dAnhist.html
    
    Args:
        dataset: Input dataset, should be T1-weighted high-res brain image\
            (shorts only).
        quiet: Suppress progress reports.
        dump_histogram: Dump histogram data to Anhist.1D and plot to Anhist.ps.
        no_scurve: Do not fit histogram with curves.
        winsorize: Apply Winsorizing filter prior to histogram scan. Can\
            specify number of times (e.g., -w7).
        top_2peaks: Analyze top 2 peaks only, for overlap, etc.
        label: Use specified label for Anhist.ps plot file instead of the input\
            dataset filename.
        filename: Use specified filename instead of 'Anhist'.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `V3dAnhistOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(V_3D_ANHIST_METADATA)
    cargs = []
    cargs.append("3dAnhist")
    cargs.append(execution.input_file(dataset))
    if quiet:
        cargs.append("-q")
    if dump_histogram:
        cargs.append("-h")
    if no_scurve:
        cargs.append("-F")
    if winsorize is not None:
        cargs.extend([
            "-w",
            winsorize
        ])
    if top_2peaks:
        cargs.append("-2")
    if label is not None:
        cargs.extend([
            "-label",
            label
        ])
    if filename is not None:
        cargs.extend([
            "-fname",
            filename
        ])
    ret = V3dAnhistOutputs(
        root=execution.output_file("."),
        output_1_d=execution.output_file("Anhist.1D"),
        output_ps=execution.output_file("Anhist.ps"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "V3dAnhistOutputs",
    "V_3D_ANHIST_METADATA",
    "v_3d_anhist",
]
