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

import typing
import pathlib
from styxdefs import *
import dataclasses

ANTS_DENOISE_IMAGE_FS_METADATA = Metadata(
    id="11723bf924918f42194dab2a080f4af8786d3033.boutiques",
    name="AntsDenoiseImageFs",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class AntsDenoiseImageFsOutputs(typing.NamedTuple):
    """
    Output object returned when calling `ants_denoise_image_fs(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    denoised_output: OutputPathType
    """Resulting denoised volume file"""


def ants_denoise_image_fs(
    input_image: InputPathType,
    output_image: str = "output.nii",
    rician_flag: bool = False,
    runner: Runner | None = None,
) -> AntsDenoiseImageFsOutputs:
    """
    Denoises an image with a spatially adaptive filter. This program wraps the
    AntsDenoiseImage utility available in the ANTs package.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        input_image: Input volume file.
        output_image: Denoised volume file.
        rician_flag: Enable Rician noise model (otherwise Gaussian is used).
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `AntsDenoiseImageFsOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(ANTS_DENOISE_IMAGE_FS_METADATA)
    cargs = []
    cargs.append("AntsDenoiseImageFs")
    cargs.extend([
        "-i",
        execution.input_file(input_image)
    ])
    cargs.extend([
        "-o",
        output_image
    ])
    if rician_flag:
        cargs.append("--rician")
    ret = AntsDenoiseImageFsOutputs(
        root=execution.output_file("."),
        denoised_output=execution.output_file(output_image),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "ANTS_DENOISE_IMAGE_FS_METADATA",
    "AntsDenoiseImageFsOutputs",
    "ants_denoise_image_fs",
]
