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

import typing
import pathlib
from styxdefs import *
import dataclasses

V_3D_SURF2_VOL_METADATA = Metadata(
    id="a6bb6d317a47760e2a6d03dd8a906341403df071.boutiques",
    name="3dSurf2Vol",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


class V3dSurf2VolOutputs(typing.NamedTuple):
    """
    Output object returned when calling `v_3d_surf2_vol(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_file: OutputPathType
    """Output dataset"""


def v_3d_surf2_vol(
    spec: InputPathType,
    surface_volume: InputPathType,
    surf_a: str,
    grid_parent: InputPathType,
    map_func: str,
    prefix: str,
    surf_b: str | None = None,
    surf_xyz_1d: InputPathType | None = None,
    sdata_1d: InputPathType | None = None,
    sdata: InputPathType | None = None,
    f_steps: float | None = None,
    f_index: str | None = None,
    f_p1_fr: float | None = None,
    f_pn_fr: float | None = None,
    f_p1_mm: float | None = None,
    f_pn_mm: float | None = None,
    stop_gap: bool = False,
    cmask: str | None = None,
    data_expr: str | None = None,
    datum: str | None = None,
    debug: int | None = None,
    dnode: int | None = None,
    dvoxel: int | None = None,
    noscale: bool = False,
    sxyz_orient_as_gpar: bool = False,
    runner: Runner | None = None,
) -> V3dSurf2VolOutputs:
    """
    Map data from a surface domain to an AFNI volume domain.
    
    Author: AFNI Team
    
    URL: https://afni.nimh.nih.gov/pub/dist/doc/program_help/3dSurf2Vol.html
    
    Args:
        spec: SUMA spec file.
        surface_volume: AFNI surface volume dataset.
        surf_a: Specify surface A from spec file.
        grid_parent: AFNI grid parent dataset.
        map_func: Surface to dataset function.
        prefix: Prefix for the output dataset.
        surf_b: Specify surface B from spec file.
        surf_xyz_1d: 1D coordinate file.
        sdata_1d: 1D sub-surface data file.
        sdata: NIML or GIFTI formatted dataset.
        f_steps: Partition segments into this many steps.
        f_index: Index by points or voxels.
        f_p1_fr: Offset p1 by a fraction of the length.
        f_pn_fr: Offset pn by a fraction of the length.
        f_p1_mm: Offset p1 by a distance in mm.
        f_pn_mm: Offset pn by a distance in mm.
        stop_gap: Stop when a zero gap has been hit.
        cmask: Command for dataset mask.
        data_expr: Apply expression to surface input.
        datum: Set data type in output dataset.
        debug: Verbose output level.
        dnode: Extra output for specified node.
        dvoxel: Extra output for specified voxel.
        noscale: No scale factor in output dataset.
        sxyz_orient_as_gpar: Assume grid parent orientation for surface xyz.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `V3dSurf2VolOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(V_3D_SURF2_VOL_METADATA)
    cargs = []
    cargs.append("3dSurf2Vol")
    cargs.extend([
        "-spec",
        execution.input_file(spec)
    ])
    cargs.extend([
        "-sv",
        execution.input_file(surface_volume)
    ])
    cargs.extend([
        "-surf_A",
        surf_a
    ])
    if surf_b is not None:
        cargs.extend([
            "-surf_B",
            surf_b
        ])
    cargs.extend([
        "-grid_parent",
        execution.input_file(grid_parent)
    ])
    cargs.extend([
        "-map_func",
        map_func
    ])
    cargs.extend([
        "-prefix",
        prefix
    ])
    if surf_xyz_1d is not None:
        cargs.extend([
            "-surf_xyz_1D",
            execution.input_file(surf_xyz_1d)
        ])
    if sdata_1d is not None:
        cargs.extend([
            "-sdata_1D",
            execution.input_file(sdata_1d)
        ])
    if sdata is not None:
        cargs.extend([
            "-sdata",
            execution.input_file(sdata)
        ])
    if f_steps is not None:
        cargs.extend([
            "-f_steps",
            str(f_steps)
        ])
    if f_index is not None:
        cargs.extend([
            "-f_index",
            f_index
        ])
    if f_p1_fr is not None:
        cargs.extend([
            "-f_p1_fr",
            str(f_p1_fr)
        ])
    if f_pn_fr is not None:
        cargs.extend([
            "-f_pn_fr",
            str(f_pn_fr)
        ])
    if f_p1_mm is not None:
        cargs.extend([
            "-f_p1_mm",
            str(f_p1_mm)
        ])
    if f_pn_mm is not None:
        cargs.extend([
            "-f_pn_mm",
            str(f_pn_mm)
        ])
    if stop_gap:
        cargs.append("-stop_gap")
    if cmask is not None:
        cargs.extend([
            "-cmask",
            cmask
        ])
    if data_expr is not None:
        cargs.extend([
            "-data_expr",
            data_expr
        ])
    if datum is not None:
        cargs.extend([
            "-datum",
            datum
        ])
    if debug is not None:
        cargs.extend([
            "-debug",
            str(debug)
        ])
    if dnode is not None:
        cargs.extend([
            "-dnode",
            str(dnode)
        ])
    if dvoxel is not None:
        cargs.extend([
            "-dvoxel",
            str(dvoxel)
        ])
    if noscale:
        cargs.append("-noscale")
    if sxyz_orient_as_gpar:
        cargs.append("-sxyz_orient_as_gpar")
    ret = V3dSurf2VolOutputs(
        root=execution.output_file("."),
        output_file=execution.output_file(prefix + "+*[gz]"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "V3dSurf2VolOutputs",
    "V_3D_SURF2_VOL_METADATA",
    "v_3d_surf2_vol",
]
