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

import typing
import pathlib
from styxdefs import *
import dataclasses

MRIS_VOLMASK_METADATA = Metadata(
    id="ff800b0130320a3ca061f0dce6a9fb1136b538ad.boutiques",
    name="mris_volmask",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class MrisVolmaskOutputs(typing.NamedTuple):
    """
    Output object returned when calling `mris_volmask(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""


def mris_volmask(
    io_: str,
    cap_distance: float | None = None,
    label_background: float | None = None,
    label_left_white: float | None = None,
    label_left_ribbon: float | None = None,
    label_right_white: float | None = None,
    label_right_ribbon: float | None = None,
    surf_white: str | None = None,
    surf_pial: str | None = None,
    aseg_name: str | None = None,
    out_root: str | None = None,
    subjects_dir: str | None = None,
    save_distance: bool = False,
    lh_only: bool = False,
    rh_only: bool = False,
    parallel: bool = False,
    edit_aseg: bool = False,
    save_ribbon: bool = False,
    runner: Runner | None = None,
) -> MrisVolmaskOutputs:
    """
    Computes a volume mask, at the same resolution as the <subject>/mri/brain.mgz.
    The volume mask contains 4 values: LH_WM (default 10), LH_GM (default 100),
    RH_WM (default 20), RH_GM (default 200).
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        io_: Positional argument that represents input/output settings.
        cap_distance: Maximum distance up to which the signed distance function\
            computation is accurate.
        label_background: Override default value for background label value\
            (0).
        label_left_white: Override default value for left white matter label\
            (20).
        label_left_ribbon: Override default value for left ribbon label (10).
        label_right_white: Override default value for right white matter label\
            (120).
        label_right_ribbon: Override default value for right ribbon label\
            (110).
        surf_white: Surface root name (e.g. <subject>/surf/$hemi.<NAME> -\
            default value is white).
        surf_pial: Surface root name (e.g. <subject>/surf/$hemi.<NAME> -\
            default value is pial).
        aseg_name: Specify a different name for the aseg input file (default is\
            aseg).
        out_root: Output root name (default is ribbon). Output files would be,\
            for example, mri/ribbon.mgz.
        subjects_dir: Specify SUBJECTS_DIR, default is read from environment.
        save_distance: Save the signed distance function as ?h.dwhite.mgz and\
            ?h.dpial.mgz.
        lh_only: Only process left hemisphere.
        rh_only: Only process right hemisphere.
        parallel: Run hemispheres in parallel and combine the result.
        edit_aseg: Edit the aseg using the ribbons and save to aseg.ribbon.mgz.
        save_ribbon: Save just the ribbon for the hemispheres - in the format\
            ?h.ribbon.mgz.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `MrisVolmaskOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(MRIS_VOLMASK_METADATA)
    cargs = []
    cargs.append("mris_volmask")
    if cap_distance is not None:
        cargs.extend([
            "--cap_distance",
            str(cap_distance)
        ])
    if label_background is not None:
        cargs.extend([
            "--label_background",
            str(label_background)
        ])
    if label_left_white is not None:
        cargs.extend([
            "--label_left_white",
            str(label_left_white)
        ])
    if label_left_ribbon is not None:
        cargs.extend([
            "--label_left_ribbon",
            str(label_left_ribbon)
        ])
    if label_right_white is not None:
        cargs.extend([
            "--label_right_white",
            str(label_right_white)
        ])
    if label_right_ribbon is not None:
        cargs.extend([
            "--label_right_ribbon",
            str(label_right_ribbon)
        ])
    if surf_white is not None:
        cargs.extend([
            "--surf_white",
            surf_white
        ])
    if surf_pial is not None:
        cargs.extend([
            "--surf_pial",
            surf_pial
        ])
    if aseg_name is not None:
        cargs.extend([
            "--aseg_name",
            aseg_name
        ])
    if out_root is not None:
        cargs.extend([
            "--out_root",
            out_root
        ])
    if subjects_dir is not None:
        cargs.extend([
            "--sd",
            subjects_dir
        ])
    if save_distance:
        cargs.append("--save_distance")
    if lh_only:
        cargs.append("--lh-only")
    if rh_only:
        cargs.append("--rh-only")
    if parallel:
        cargs.append("--parallel")
    if edit_aseg:
        cargs.append("--edit_aseg")
    if save_ribbon:
        cargs.append("--save_ribbon")
    cargs.append(io_)
    ret = MrisVolmaskOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "MRIS_VOLMASK_METADATA",
    "MrisVolmaskOutputs",
    "mris_volmask",
]
