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

import typing
import pathlib
from styxdefs import *
import dataclasses

MRI_MC_METADATA = Metadata(
    id="60a4e6264f565573c6fbb9368b3b82aa19a0f230.boutiques",
    name="mri_mc",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class MriMcOutputs(typing.NamedTuple):
    """
    Output object returned when calling `mri_mc(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    extracted_surface: OutputPathType
    """The extracted surface output file."""


def mri_mc(
    input_volume: InputPathType,
    label_value: float,
    output_surface: str,
    connectivity: float | None = 1,
    runner: Runner | None = None,
) -> MriMcOutputs:
    """
    Extract a surface from a label volume using Marching Cubes algorithm.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        input_volume: The input volume from which to extract the surface.
        label_value: The label value of the structure to extract.
        output_surface: The file where the extracted surface mesh will be\
            saved.
        connectivity: The connectivity used for Marching Cubes. Options are:\
            1=6+, 2=18, 3=6, 4=26.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `MriMcOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(MRI_MC_METADATA)
    cargs = []
    cargs.append("mri_mc")
    cargs.append(execution.input_file(input_volume))
    cargs.append(str(label_value))
    if connectivity is not None:
        cargs.append(output_surface + str(connectivity))
    ret = MriMcOutputs(
        root=execution.output_file("."),
        extracted_surface=execution.output_file(output_surface),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "MRI_MC_METADATA",
    "MriMcOutputs",
    "mri_mc",
]
