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

import typing
import pathlib
from styxdefs import *
import dataclasses

V_3D_SHARPEN_METADATA = Metadata(
    id="44eead3d035544b0d1ef18d1ea40f5df1b442bcb.boutiques",
    name="3dSharpen",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


class V3dSharpenOutputs(typing.NamedTuple):
    """
    Output object returned when calling `v_3d_sharpen(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_dataset: OutputPathType
    """Sharpened output dataset."""


def v_3d_sharpen(
    input_dataset: InputPathType,
    output_prefix: str,
    sharpening_factor: float | None = None,
    runner: Runner | None = None,
) -> V3dSharpenOutputs:
    """
    Applies a simple 3D sharpening filter to the positive values in the #0 volume of
    the input dataset, and writes out a new dataset.
    
    Author: AFNI Developers
    
    URL: https://afni.nimh.nih.gov/
    
    Args:
        input_dataset: Input dataset (e.g., input.nii.gz).
        output_prefix: Name of the output dataset (e.g., output.nii.gz) which\
            will be in floating point format.
        sharpening_factor: Sharpening factor, between 0.1 and 0.9 (inclusive).\
            Larger values mean more sharpening.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `V3dSharpenOutputs`).
    """
    if sharpening_factor is not None and not (0.1 <= sharpening_factor <= 0.9): 
        raise ValueError(f"'sharpening_factor' must be between 0.1 <= x <= 0.9 but was {sharpening_factor}")
    runner = runner or get_global_runner()
    execution = runner.start_execution(V_3D_SHARPEN_METADATA)
    cargs = []
    cargs.append("3dSharpen")
    if sharpening_factor is not None:
        cargs.extend([
            "-phi",
            str(sharpening_factor)
        ])
    cargs.append(execution.input_file(input_dataset))
    cargs.extend([
        "-prefix",
        output_prefix
    ])
    ret = V3dSharpenOutputs(
        root=execution.output_file("."),
        output_dataset=execution.output_file(output_prefix + ".nii.gz"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "V3dSharpenOutputs",
    "V_3D_SHARPEN_METADATA",
    "v_3d_sharpen",
]
