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

import typing
import pathlib
from styxdefs import *
import dataclasses

V_3D_SURF_MASK_METADATA = Metadata(
    id="55dc0c4e1d7ff3d126a0dfcd22e6d94d6ee4130c.boutiques",
    name="3dSurfMask",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


class V3dSurfMaskOutputs(typing.NamedTuple):
    """
    Output object returned when calling `v_3d_surf_mask(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_mask: OutputPathType
    """Main output mask dataset."""
    distance_dataset: OutputPathType
    """Dataset reflecting voxel shortest distances to the surface."""


def v_3d_surf_mask(
    surface_type: str,
    surface_file: InputPathType,
    prefix: str,
    grid_parent: InputPathType,
    fill_method: str | None = None,
    surface_volume: InputPathType | None = None,
    mask_only: bool = False,
    flip_orientation: bool = False,
    no_distance: bool = False,
    runner: Runner | None = None,
) -> V3dSurfMaskOutputs:
    """
    Creates volumetric datasets marking voxels based on their location relative to a
    surface.
    
    Author: AFNI Developers
    
    URL: https://afni.nimh.nih.gov/
    
    Args:
        surface_type: Specify input surface.
        surface_file: Specify input surface filename.
        prefix: Prefix of output dataset.
        grid_parent: Specifies the grid for the output volume.
        fill_method: Fill method: SLOW or FAST (default: FAST).
        surface_volume: Specify the surface volume.
        mask_only: Produce an output dataset where voxels are 1 inside the\
            surface and 0 outside.
        flip_orientation: Flip triangle winding of surface mesh.
        no_distance: Do not compute the distances, just the mask from the first\
            step.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `V3dSurfMaskOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(V_3D_SURF_MASK_METADATA)
    cargs = []
    cargs.append("3dSurfMask")
    cargs.append(surface_type)
    cargs.append(execution.input_file(surface_file))
    cargs.append(prefix)
    cargs.append(execution.input_file(grid_parent))
    if fill_method is not None:
        cargs.extend([
            "-fill_method",
            fill_method
        ])
    if surface_volume is not None:
        cargs.extend([
            "-sv",
            execution.input_file(surface_volume)
        ])
    if mask_only:
        cargs.append("-mask_only")
    if flip_orientation:
        cargs.append("-flip_orientation")
    if no_distance:
        cargs.append("-no_dist")
    ret = V3dSurfMaskOutputs(
        root=execution.output_file("."),
        output_mask=execution.output_file(prefix + ".m+orig.BRIK"),
        distance_dataset=execution.output_file(prefix + ".d+orig.BRIK"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "V3dSurfMaskOutputs",
    "V_3D_SURF_MASK_METADATA",
    "v_3d_surf_mask",
]
