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

import typing
import pathlib
from styxdefs import *
import dataclasses

CONNECTED_COMPONENTS_METADATA = Metadata(
    id="415ac7eebb3cd7123aaeb6ad6eb398b6cc1343ba.boutiques",
    name="connected_components",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class ConnectedComponentsOutputs(typing.NamedTuple):
    """
    Output object returned when calling `connected_components(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_labelled_image_file: OutputPathType
    """Labeled connected components image output file."""


def connected_components(
    runner: Runner | None = None,
) -> ConnectedComponentsOutputs:
    """
    A tool for identifying connected components in an image.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `ConnectedComponentsOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(CONNECTED_COMPONENTS_METADATA)
    cargs = []
    cargs.append("connected_components")
    ret = ConnectedComponentsOutputs(
        root=execution.output_file("."),
        output_labelled_image_file=execution.output_file("[OUTPUT_IMAGE].nii.gz"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "CONNECTED_COMPONENTS_METADATA",
    "ConnectedComponentsOutputs",
    "connected_components",
]
