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

import typing
import pathlib
from styxdefs import *
import dataclasses

GROUPSTATSDIFF_METADATA = Metadata(
    id="474a0a73a03ccd5e8c25186fbb8a8f0ccde75dd7.boutiques",
    name="groupstatsdiff",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class GroupstatsdiffOutputs(typing.NamedTuple):
    """
    Output object returned when calling `groupstatsdiff(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""


def groupstatsdiff(
    group1_dir: str,
    group2_dir: str,
    output_dir: str,
    no_maps: bool = False,
    osgm: bool = False,
    no_common: bool = False,
    allow_subj_diff: bool = False,
    no_area: bool = False,
    no_volume: bool = False,
    no_ba: bool = False,
    no_aparcstats: bool = False,
    no_asegstats: bool = False,
    no_wparcstats: bool = False,
    no_stats: bool = False,
    no_prune: bool = False,
    fwhm_value: float | None = None,
    subjects_dir1: str | None = None,
    subjects_dir2: str | None = None,
    no_dice: bool = False,
    dice_ctab: str | None = None,
    runner: Runner | None = None,
) -> GroupstatsdiffOutputs:
    """
    Evaluate the differences between two groupstats outputs from recon-all analyses
    in Freesurfer.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        group1_dir: Output folder from groupstats for group 1.
        group2_dir: Output folder from groupstats for group 2.
        output_dir: Output folder for the difference analysis.
        no_maps: Only analyze ROI data, no maps.
        osgm: Use OSGM instead of native FSGD.
        no_common: Do not select common segments when running stattablediff.
        allow_subj_diff: Allow list of subjects to be different between the two\
            analyses.
        no_area: Do not compute area differences.
        no_volume: Do not compute volume differences.
        no_ba: Do not compute differences for BA labels.
        no_aparcstats: Do not do aparcstats.
        no_asegstats: Do not do asegstats.
        no_wparcstats: Do not do wmparcstats.
        no_stats: Do not do any ROI stats.
        no_prune: Do not prune when running mri_glmfit.
        fwhm_value: Override the FWHM from group analysis.
        subjects_dir1: Subjects directory 1 for computing dice (default is\
            parent dir of groupdir).
        subjects_dir2: Subjects directory 2 for computing dice (default is\
            parent dir of groupdir).
        no_dice: Do not compute dice.
        dice_ctab: CTAB to use for dice computation (default is\
            /usr/local/freesurfer/ASegStatsLUT.txt).
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `GroupstatsdiffOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(GROUPSTATSDIFF_METADATA)
    cargs = []
    cargs.append("groupstatsdiff")
    cargs.extend([
        "-g1",
        "-" + group1_dir
    ])
    cargs.extend([
        "-g2",
        "-" + group2_dir
    ])
    cargs.extend([
        "-o",
        "-" + output_dir
    ])
    if no_maps:
        cargs.append("--no-maps")
    if osgm:
        cargs.append("--osgm")
    if no_common:
        cargs.append("--no-common")
    if allow_subj_diff:
        cargs.append("--allow-subj-diff")
    if no_area:
        cargs.append("--no-area")
    if no_volume:
        cargs.append("--no-volume")
    if no_ba:
        cargs.append("--no-ba")
    if no_aparcstats:
        cargs.append("--no-aparcstats")
    if no_asegstats:
        cargs.append("--no-asegstats")
    if no_wparcstats:
        cargs.append("--no-wparcstats")
    if no_stats:
        cargs.append("--no-stats")
    if no_prune:
        cargs.append("--no-prune")
    if fwhm_value is not None:
        cargs.extend([
            "--fwhm",
            str(fwhm_value)
        ])
    if subjects_dir1 is not None:
        cargs.extend([
            "--sd1",
            subjects_dir1
        ])
    if subjects_dir2 is not None:
        cargs.extend([
            "--sd2",
            subjects_dir2
        ])
    if no_dice:
        cargs.append("--no-dice")
    if dice_ctab is not None:
        cargs.extend([
            "--dice-ctab",
            dice_ctab
        ])
    ret = GroupstatsdiffOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "GROUPSTATSDIFF_METADATA",
    "GroupstatsdiffOutputs",
    "groupstatsdiff",
]
