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

import typing
import pathlib
from styxdefs import *
import dataclasses

MRI_TWOCLASS_METADATA = Metadata(
    id="427d89171227769404d91a8705196b0fd4c94fb1.boutiques",
    name="mri_twoclass",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class MriTwoclassOutputs(typing.NamedTuple):
    """
    Output object returned when calling `mri_twoclass(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    result_volume: OutputPathType
    """Output volume storing the results"""


def mri_twoclass(
    segmentation_volume: InputPathType,
    output_subject: str,
    output_volume: InputPathType,
    c1_subjects: list[str],
    c2_subjects: list[str],
    f_threshold: float | None = None,
    bonferroni_correction: bool = False,
    runner: Runner | None = None,
) -> MriTwoclassOutputs:
    """
    Compute cross-subject statistics of two sets of labels.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        segmentation_volume: Input segmentation volume.
        output_subject: Output subject name.
        output_volume: Output volume.
        c1_subjects: List of subjects from class 1.
        c2_subjects: List of subjects from class 2.
        f_threshold: Specify F threshold.
        bonferroni_correction: Perform Bonferroni correction.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `MriTwoclassOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(MRI_TWOCLASS_METADATA)
    cargs = []
    cargs.append("mri_twoclass")
    cargs.append(execution.input_file(segmentation_volume))
    cargs.append(output_subject)
    cargs.append(execution.input_file(output_volume))
    cargs.extend(c1_subjects)
    cargs.append(":")
    cargs.extend(c2_subjects)
    if f_threshold is not None:
        cargs.extend([
            "-t",
            str(f_threshold)
        ])
    if bonferroni_correction:
        cargs.append("-b")
    ret = MriTwoclassOutputs(
        root=execution.output_file("."),
        result_volume=execution.output_file(pathlib.Path(output_volume).name),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "MRI_TWOCLASS_METADATA",
    "MriTwoclassOutputs",
    "mri_twoclass",
]
