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

import typing
import pathlib
from styxdefs import *
import dataclasses

TFIM_METADATA = Metadata(
    id="e2647e37a1429074565987a0998548003c59d175.boutiques",
    name="tfim",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


class TfimOutputs(typing.NamedTuple):
    """
    Output object returned when calling `tfim(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    diff_output: OutputPathType
    """Difference image output. Default prefix is 'tfim'."""
    tspm_output: OutputPathType
    """T-statistic of difference. Default prefix is 'tfim'."""
    corr_output: OutputPathType
    """Equivalent correlation statistic output. Written if -eqcorr is used."""


def tfim(
    set1_images: list[InputPathType],
    set2_images: list[InputPathType],
    base1_value: float | None = None,
    runner: Runner | None = None,
) -> TfimOutputs:
    """
    MCW TFIM: t-tests on sets of functional images.
    
    Author: AFNI Team
    
    URL: https://afni.nimh.nih.gov/pub/dist/doc/program_help/tfim.html
    
    Args:
        set1_images: First set of image files.
        set2_images: Second set of image files.
        base1_value: Base value for the first set of images. Used for Usage 2.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `TfimOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(TFIM_METADATA)
    cargs = []
    cargs.append("tfim")
    cargs.append("[OPTIONS]")
    cargs.append("-set1")
    cargs.extend([
        "-set1",
        *[execution.input_file(f) for f in set1_images]
    ])
    cargs.append("-set2")
    cargs.extend([
        "-set2",
        *[execution.input_file(f) for f in set2_images]
    ])
    cargs.append("-base1")
    if base1_value is not None:
        cargs.extend([
            "-base1",
            str(base1_value)
        ])
    ret = TfimOutputs(
        root=execution.output_file("."),
        diff_output=execution.output_file("[PREFIX].diff"),
        tspm_output=execution.output_file("[PREFIX].tspm"),
        corr_output=execution.output_file("[PREFIX].corr"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "TFIM_METADATA",
    "TfimOutputs",
    "tfim",
]
