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

import typing
import pathlib
from styxdefs import *
import dataclasses

MRI_EDIT_SEGMENTATION_WITH_SURFACES_METADATA = Metadata(
    id="b7676f431b8610a951f255b96b0e4e26a937a332.boutiques",
    name="mri_edit_segmentation_with_surfaces",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class MriEditSegmentationWithSurfacesOutputs(typing.NamedTuple):
    """
    Output object returned when calling `mri_edit_segmentation_with_surfaces(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_volume_file: OutputPathType
    """Edited output volume"""


def mri_edit_segmentation_with_surfaces(
    aseg_name: InputPathType,
    surface_dir: str,
    norm_volume: InputPathType,
    output_volume: str,
    label_file: InputPathType | None = None,
    hypo_flag: typing.Literal["1", "0"] | None = None,
    cerebellum_flag: typing.Literal["1", "0"] | None = None,
    cortex_flag: typing.Literal["1", "0"] | None = None,
    annotation_file: InputPathType | None = None,
    runner: Runner | None = None,
) -> MriEditSegmentationWithSurfacesOutputs:
    """
    This program edits an aseg with the surface.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        aseg_name: The aseg file to be edited.
        surface_dir: Directory containing surface files.
        norm_volume: Normalized volume file.
        output_volume: Output volume file.
        label_file: Limit calculations to specified label.
        hypo_flag: Turn hypointensity editing on/off (1=on, 0=off).
        cerebellum_flag: Turn cerebellum editing on/off (1=on, 0=off).
        cortex_flag: Turn cortex editing on/off (1=on, 0=off).
        annotation_file: Compute properties for each label in the annotation\
            file separately.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `MriEditSegmentationWithSurfacesOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(MRI_EDIT_SEGMENTATION_WITH_SURFACES_METADATA)
    cargs = []
    cargs.append("mri_edit_segmentation_with_surfaces")
    cargs.append(execution.input_file(aseg_name))
    cargs.append(surface_dir)
    cargs.append(execution.input_file(norm_volume))
    cargs.append(output_volume)
    if label_file is not None:
        cargs.extend([
            "-l",
            execution.input_file(label_file)
        ])
    if hypo_flag is not None:
        cargs.extend([
            "-hypo",
            hypo_flag
        ])
    if cerebellum_flag is not None:
        cargs.extend([
            "-cerebellum",
            cerebellum_flag
        ])
    if cortex_flag is not None:
        cargs.extend([
            "-cortex",
            cortex_flag
        ])
    if annotation_file is not None:
        cargs.extend([
            "-a",
            execution.input_file(annotation_file)
        ])
    ret = MriEditSegmentationWithSurfacesOutputs(
        root=execution.output_file("."),
        output_volume_file=execution.output_file(output_volume),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "MRI_EDIT_SEGMENTATION_WITH_SURFACES_METADATA",
    "MriEditSegmentationWithSurfacesOutputs",
    "mri_edit_segmentation_with_surfaces",
]
