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

import typing
import pathlib
from styxdefs import *
import dataclasses

V_3D_MEDIAN_FILTER_METADATA = Metadata(
    id="fd3886bd6ff2fda6a99026dc98c4ccdf74daec27.boutiques",
    name="3dMedianFilter",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


class V3dMedianFilterOutputs(typing.NamedTuple):
    """
    Output object returned when calling `v_3d_median_filter(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_brik: OutputPathType | None
    """Output dataset is stored in float format."""
    output_head: OutputPathType | None
    """Output dataset header file."""


def v_3d_median_filter(
    dataset: InputPathType,
    irad: float | None = None,
    iter_: float | None = None,
    verbose: bool = False,
    prefix: str | None = None,
    automask: bool = False,
    runner: Runner | None = None,
) -> V3dMedianFilterOutputs:
    """
    Computes the median in a spherical neighborhood around each point in the input
    to produce the output.
    
    Author: AFNI Team
    
    URL: https://afni.nimh.nih.gov/pub/dist/doc/program_help/3dMedianFilter.html
    
    Args:
        dataset: Input dataset.
        irad: Radius in voxels of spherical regions.
        iter_: Iterate 'n' times [default=1].
        verbose: Be verbose during run.
        prefix: Use 'pp' for prefix of output dataset.
        automask: Create a mask (a la 3dAutomask).
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `V3dMedianFilterOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(V_3D_MEDIAN_FILTER_METADATA)
    cargs = []
    cargs.append("3dMedianFilter")
    if irad is not None:
        cargs.extend([
            "-irad",
            str(irad)
        ])
    if iter_ is not None:
        cargs.extend([
            "-iter",
            str(iter_)
        ])
    if verbose:
        cargs.append("-verb")
    if prefix is not None:
        cargs.extend([
            "-prefix",
            prefix
        ])
    if automask:
        cargs.append("-automask")
    cargs.append(execution.input_file(dataset))
    ret = V3dMedianFilterOutputs(
        root=execution.output_file("."),
        output_brik=execution.output_file(prefix + "+tlrc.BRIK") if (prefix is not None) else None,
        output_head=execution.output_file(prefix + "+tlrc.HEAD") if (prefix is not None) else None,
    )
    execution.run(cargs)
    return ret


__all__ = [
    "V3dMedianFilterOutputs",
    "V_3D_MEDIAN_FILTER_METADATA",
    "v_3d_median_filter",
]
