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

import typing
import pathlib
from styxdefs import *
import dataclasses

V__SKULL_STRIP_TOUCH_UP_METADATA = Metadata(
    id="51b46d6e6f2f24c8b7822210349a52ed8df3d90e.boutiques",
    name="@SkullStrip_TouchUp",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


class VSkullStripTouchUpOutputs(typing.NamedTuple):
    """
    Output object returned when calling `v__skull_strip_touch_up(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_folder: OutputPathType
    """Output folder containing the touch-up results"""
    output_mask: OutputPathType
    """Output binary mask (if -mask_out flag is used)"""


def v__skull_strip_touch_up(
    prefix: str,
    brain_dataset: InputPathType,
    head_dataset: InputPathType,
    mask_out: bool = False,
    orig_dim: bool = False,
    runner: Runner | None = None,
) -> VSkullStripTouchUpOutputs:
    """
    Helper program to touch up failed skull stripping by resampling data, allowing
    manual edits, and outputting corrected data.
    
    Author: AFNI Team
    
    URL:
    https://afni.nimh.nih.gov/pub/dist/doc/program_help/@SkullStrip_TouchUp.html
    
    Args:
        prefix: Output file and folder name.
        brain_dataset: Skull stripped data set to touch up.
        head_dataset: Whole head anatomical data set.
        mask_out: Output a binary mask in addition to actual data.
        orig_dim: Edit in the original image dimensions.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `VSkullStripTouchUpOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(V__SKULL_STRIP_TOUCH_UP_METADATA)
    cargs = []
    cargs.append("@SkullStrip_TouchUp")
    cargs.append("-prefix")
    cargs.append(prefix)
    cargs.append("-brain")
    cargs.append(execution.input_file(brain_dataset))
    cargs.append("-head")
    cargs.append(execution.input_file(head_dataset))
    if mask_out:
        cargs.append("-mask_out")
    if orig_dim:
        cargs.append("-orig_dim")
    ret = VSkullStripTouchUpOutputs(
        root=execution.output_file("."),
        output_folder=execution.output_file(prefix + "_SS_touch_up"),
        output_mask=execution.output_file(prefix + "_mask.nii.gz"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "VSkullStripTouchUpOutputs",
    "V__SKULL_STRIP_TOUCH_UP_METADATA",
    "v__skull_strip_touch_up",
]
