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

import typing
import pathlib
from styxdefs import *
import dataclasses

MRI_PRETESS_METADATA = Metadata(
    id="4499558e540b531e057123dc0bdd2efbb168c515.boutiques",
    name="mri_pretess",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class MriPretessOutputs(typing.NamedTuple):
    """
    Output object returned when calling `mri_pretess(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    out_newfilledvol: OutputPathType
    """Output new filled volume"""


def mri_pretess(
    filledvol: InputPathType,
    labelstring: str,
    normvol: InputPathType,
    newfilledvol: str,
    debug_voxel: list[float] | None = None,
    nocorners: bool = False,
    write: bool = False,
    keep: bool = False,
    test: bool = False,
    runner: Runner | None = None,
) -> MriPretessOutputs:
    """
    Tool to modify WM segmentation so that all neighbors of WM voxels have a common
    face.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        filledvol: Input filled volume, usually wm.mgz.
        labelstring: Label string, usually wm.
        normvol: Normalization volume, usually norm.mgz.
        newfilledvol: New filled volume output, usually wm.mgz.
        debug_voxel: Specify the voxel to debug with coordinates C R S.
        nocorners: No removal of corner configurations in addition to edge ones.
        write: Turn on diagnostic writing.
        keep: Keep WM edits.
        test: Adds a voxel to test removal by mri_pretess, retained with -keep.\
            Output not saved.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `MriPretessOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(MRI_PRETESS_METADATA)
    cargs = []
    cargs.append("mri_pretess")
    cargs.append(execution.input_file(filledvol))
    cargs.append(labelstring)
    cargs.append(execution.input_file(normvol))
    cargs.append(newfilledvol)
    if debug_voxel is not None:
        cargs.extend([
            "-debug_voxel",
            *map(str, debug_voxel)
        ])
    if nocorners:
        cargs.append("-nocorners")
    if write:
        cargs.append("-w")
    if keep:
        cargs.append("-keep")
    if test:
        cargs.append("-test")
    ret = MriPretessOutputs(
        root=execution.output_file("."),
        out_newfilledvol=execution.output_file(newfilledvol),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "MRI_PRETESS_METADATA",
    "MriPretessOutputs",
    "mri_pretess",
]
