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

import typing
import pathlib
from styxdefs import *
import dataclasses

APARCSTATSDIFF_METADATA = Metadata(
    id="c9cea4353f4e4aca9c0c94b627fe528484a4d224.boutiques",
    name="aparcstatsdiff",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class AparcstatsdiffOutputs(typing.NamedTuple):
    """
    Output object returned when calling `aparcstatsdiff(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_file: OutputPathType
    """Output table with percentage differences"""


def aparcstatsdiff(
    subj1: str,
    subj2: str,
    hemi: str,
    parc: str,
    meas: str,
    outdir: str | None = None,
    runner: Runner | None = None,
) -> AparcstatsdiffOutputs:
    """
    Utility to calculate percentage differences in aparc morphometry data between
    two subjects.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        subj1: Subject 1 identifier.
        subj2: Subject 2 identifier.
        hemi: Hemisphere (rh or lh).
        parc: Parcellation scheme (aparc or aparc.a2009s).
        meas: Measure type (area, volume, or thickness).
        outdir: Directory to write the output table file.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `AparcstatsdiffOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(APARCSTATSDIFF_METADATA)
    cargs = []
    cargs.append("aparcstatsdiff")
    cargs.append(subj1)
    cargs.append(subj2)
    cargs.append(hemi)
    cargs.append(parc)
    cargs.append(meas)
    if outdir is not None:
        cargs.append(outdir)
    ret = AparcstatsdiffOutputs(
        root=execution.output_file("."),
        output_file=execution.output_file("aparcstats-" + hemi + "." + parc + "." + meas + ".txt"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "APARCSTATSDIFF_METADATA",
    "AparcstatsdiffOutputs",
    "aparcstatsdiff",
]
