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

import typing
import pathlib
from styxdefs import *
import dataclasses

WFILEMASK_METADATA = Metadata(
    id="2af18e367bd17f7afc3d6c0507042e5513f946c5.boutiques",
    name="wfilemask",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class WfilemaskOutputs(typing.NamedTuple):
    """
    Output object returned when calling `wfilemask(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_w_file: OutputPathType
    """Output file with specified label regions zeroed out"""


def wfilemask(
    w_file: InputPathType,
    label_file: InputPathType,
    output_file: str,
    permission_mask: str | None = None,
    help_flag: bool = False,
    version_flag: bool = False,
    runner: Runner | None = None,
) -> WfilemaskOutputs:
    """
    Zero-out regions of a surface value file (.w file) using a label.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        w_file: Input w file.
        label_file: Label file to use as a mask.
        output_file: Output w file.
        permission_mask: Set Unix file permission mask.
        help_flag: Display help message and exit.
        version_flag: Print version and exit.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `WfilemaskOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(WFILEMASK_METADATA)
    cargs = []
    cargs.append("wfilemask")
    cargs.extend([
        "-w",
        execution.input_file(w_file)
    ])
    cargs.extend([
        "-l",
        execution.input_file(label_file)
    ])
    cargs.extend([
        "-o",
        output_file
    ])
    if permission_mask is not None:
        cargs.extend([
            "-umask",
            permission_mask
        ])
    if help_flag:
        cargs.append("-help")
    if version_flag:
        cargs.append("-version")
    ret = WfilemaskOutputs(
        root=execution.output_file("."),
        output_w_file=execution.output_file(output_file),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "WFILEMASK_METADATA",
    "WfilemaskOutputs",
    "wfilemask",
]
