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

import typing
import pathlib
from styxdefs import *
import dataclasses

V_3DKMEANS_METADATA = Metadata(
    id="3a4bcacba0796e3087ac57c6df380dbd644dc61d.boutiques",
    name="3dkmeans",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


class V3dkmeansOutputs(typing.NamedTuple):
    """
    Output object returned when calling `v_3dkmeans(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    cluster_membership: OutputPathType
    """Output volume for the cluster membership."""
    cluster_distance: OutputPathType
    """Output volume for the cluster distance measures."""
    distances_text_file: OutputPathType
    """Output text file containing distances between clusters."""
    centroids_text_file: OutputPathType
    """Output text file containing cluster centroids."""
    within_cluster_sum_text_file: OutputPathType
    """Output text file containing within cluster sum of distances."""
    max_distance_text_file: OutputPathType
    """Output text file containing maximum distance within each cluster."""
    voxel_distance_to_centroid: OutputPathType
    """Output text file containing distance from voxel to its centroid."""


def v_3dkmeans(
    runner: Runner | None = None,
) -> V3dkmeansOutputs:
    """
    3d+t Clustering segmentation based on The C clustering library.
    
    Author: AFNI Team
    
    URL: https://afni.nimh.nih.gov/pub/dist/doc/program_help/3dkmeans.html
    
    Args:
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `V3dkmeansOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(V_3DKMEANS_METADATA)
    cargs = []
    cargs.append("3dkmeans")
    cargs.append("[OPTIONS]")
    ret = V3dkmeansOutputs(
        root=execution.output_file("."),
        cluster_membership=execution.output_file("[JOBNAME]_membership.nii.gz"),
        cluster_distance=execution.output_file("[JOBNAME]_distance.nii.gz"),
        distances_text_file=execution.output_file("FILE.dis.1D"),
        centroids_text_file=execution.output_file("FILE.cen.1D"),
        within_cluster_sum_text_file=execution.output_file("FILE.info1.1D"),
        max_distance_text_file=execution.output_file("FILE.info2.1D"),
        voxel_distance_to_centroid=execution.output_file("FILE.vcd.1D"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "V3dkmeansOutputs",
    "V_3DKMEANS_METADATA",
    "v_3dkmeans",
]
