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

import typing
import pathlib
from styxdefs import *
import dataclasses

V_3D_DEPTH_MAP_METADATA = Metadata(
    id="4a6704d8156d9e0a414515196af7b7f69ca298eb.boutiques",
    name="3dDepthMap",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


class V3dDepthMapOutputs(typing.NamedTuple):
    """
    Output object returned when calling `v_3d_depth_map(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_file: OutputPathType
    """Main output file"""


def v_3d_depth_map(
    input_dataset: InputPathType,
    output_prefix: str,
    mask: InputPathType | None = None,
    dist_squared: bool = False,
    ignore_voxdims: bool = False,
    rimify: float | None = None,
    zeros_are_zero: bool = False,
    zeros_are_neg: bool = False,
    nz_are_neg: bool = False,
    bounds_are_not_zero: bool = False,
    only2_d: str | None = None,
    binary_only: bool = False,
    verbosity: float | None = None,
    runner: Runner | None = None,
) -> V3dDepthMapOutputs:
    """
    Calculates the Euclidean Distance Transform (EDT) for 3D volumes, allowing
    computation of ROI depth maps and applying various adjustments like masking and
    rimification.
    
    Author: AFNI Developers
    
    URL: https://afni.nimh.nih.gov/
    
    Args:
        input_dataset: Input dataset.
        output_prefix: Output prefix name.
        mask: Mask dataset, applied after the EDT has been calculated.
        dist_squared: Output EDT values as distance squared.
        ignore_voxdims: Ignore voxel dimensions, producing outputs as if each\
            voxel dimension was unity.
        rimify: Output a map of each ROI's boundary layer up to thickness RIM.
        zeros_are_zero: EDT values only reported within nonzero locations of\
            the input dataset.
        zeros_are_neg: EDT values in the zero/background regions will be\
            negative.
        nz_are_neg: EDT values in the nonzero ROI regions will be negative.
        bounds_are_not_zero: Treat FOV boundaries for nonzero ROIs as open\
            (i.e., continue infinitely).
        only2_d: Run EDT in 2D along the specified plane (axi|cor|sag).
        binary_only: Treat the input as a binary mask for a faster calculation.
        verbosity: Manage verbosity when running code (default: 1).
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `V3dDepthMapOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(V_3D_DEPTH_MAP_METADATA)
    cargs = []
    cargs.append("3dDepthMap")
    cargs.extend([
        "-input",
        execution.input_file(input_dataset)
    ])
    cargs.extend([
        "-prefix",
        output_prefix
    ])
    if mask is not None:
        cargs.extend([
            "-mask",
            execution.input_file(mask)
        ])
    if dist_squared:
        cargs.append("-dist_sq")
    if ignore_voxdims:
        cargs.append("-ignore_voxdims")
    if rimify is not None:
        cargs.extend([
            "-rimify",
            str(rimify)
        ])
    if zeros_are_zero:
        cargs.append("-zeros_are_zero")
    if zeros_are_neg:
        cargs.append("-zeros_are_neg")
    if nz_are_neg:
        cargs.append("-nz_are_neg")
    if bounds_are_not_zero:
        cargs.append("-bounds_are_not_zero")
    if only2_d is not None:
        cargs.extend([
            "-only2D",
            only2_d
        ])
    if binary_only:
        cargs.append("-binary_only")
    if verbosity is not None:
        cargs.extend([
            "-verb",
            str(verbosity)
        ])
    ret = V3dDepthMapOutputs(
        root=execution.output_file("."),
        output_file=execution.output_file(output_prefix + ".nii.gz"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "V3dDepthMapOutputs",
    "V_3D_DEPTH_MAP_METADATA",
    "v_3d_depth_map",
]
