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

import typing
import pathlib
from styxdefs import *
import dataclasses

MRIS_ANATOMICAL_STATS_METADATA = Metadata(
    id="26651665f8aa89f4302f7661390895c29f6b22f4.boutiques",
    name="mris_anatomical_stats",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class MrisAnatomicalStatsOutputs(typing.NamedTuple):
    """
    Output object returned when calling `mris_anatomical_stats(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_log_file: OutputPathType | None
    """Output log file of the statistics"""
    output_table_file: OutputPathType | None
    """Tabular output stored in a table file"""
    output_ctab_file: OutputPathType | None
    """Output annotation color table file"""


def mris_anatomical_stats(
    subjectname: str,
    hemisphere: str,
    surfacename: str | None = None,
    thickness_range: list[float] | None = None,
    label_file: InputPathType | None = None,
    thickness_file: InputPathType | None = None,
    annotation_file: InputPathType | None = None,
    tabular_output: bool = False,
    tablefile: str | None = None,
    logfile: str | None = None,
    nsmooth: float | None = None,
    color_table: str | None = None,
    noglobal: bool = False,
    th3_computation: bool = False,
    runner: Runner | None = None,
) -> MrisAnatomicalStatsOutputs:
    """
    This program computes a number of anatomical properties.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        subjectname: Subject name.
        hemisphere: Hemisphere.
        surfacename: Surface name.
        thickness_range: Only consider thicknesses in the specified range.
        label_file: Limit calculations to specified label.
        thickness_file: Use specified file for computing thickness statistics.
        annotation_file: Compute properties for each label in the annotation\
            file separately.
        tabular_output: Tabular output.
        tablefile: Table output to tablefile. Must use -a or -l options to\
            specify input.
        logfile: Write stats to file named log.
        nsmooth: Smooth thickness map # of iterations before using it.
        color_table: Output annotation file's color table to text file.
        noglobal: Do not compute global brain stats.
        th3_computation: Compute vertex-wise volume by dividing each obliquely\
            truncated trilateral pyramid into three tetrahedra.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `MrisAnatomicalStatsOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(MRIS_ANATOMICAL_STATS_METADATA)
    cargs = []
    cargs.append("mris_anatomical_stats")
    cargs.append(subjectname)
    cargs.append(hemisphere)
    if surfacename is not None:
        cargs.append(surfacename)
    if thickness_range is not None:
        cargs.extend([
            "-i",
            *map(str, thickness_range)
        ])
    if label_file is not None:
        cargs.extend([
            "-l",
            execution.input_file(label_file)
        ])
    if thickness_file is not None:
        cargs.extend([
            "-t",
            execution.input_file(thickness_file)
        ])
    if annotation_file is not None:
        cargs.extend([
            "-a",
            execution.input_file(annotation_file)
        ])
    if tabular_output:
        cargs.append("-b")
    if tablefile is not None:
        cargs.extend([
            "-f",
            tablefile
        ])
    if logfile is not None:
        cargs.extend([
            "-log",
            logfile
        ])
    if nsmooth is not None:
        cargs.extend([
            "-nsmooth",
            str(nsmooth)
        ])
    if color_table is not None:
        cargs.extend([
            "-c",
            color_table
        ])
    if noglobal:
        cargs.append("-noglobal")
    if th3_computation:
        cargs.append("-th3")
    ret = MrisAnatomicalStatsOutputs(
        root=execution.output_file("."),
        output_log_file=execution.output_file(logfile + ".txt") if (logfile is not None) else None,
        output_table_file=execution.output_file(tablefile + ".txt") if (tablefile is not None) else None,
        output_ctab_file=execution.output_file(color_table + ".txt") if (color_table is not None) else None,
    )
    execution.run(cargs)
    return ret


__all__ = [
    "MRIS_ANATOMICAL_STATS_METADATA",
    "MrisAnatomicalStatsOutputs",
    "mris_anatomical_stats",
]
