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

import typing
import pathlib
from styxdefs import *
import dataclasses

FSL_SBCA_METADATA = Metadata(
    id="9a0539cce0afbdc0ad35f76430d92a4e08805154.boutiques",
    name="fsl_sbca",
    package="fsl",
    container_image_tag="mcin/fsl:6.0.5",
)


class FslSbcaOutputs(typing.NamedTuple):
    """
    Output object returned when calling `fsl_sbca(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_seed_mask_image: OutputPathType
    """Output seed mask image"""
    output_seed_mask_image_base: OutputPathType
    """Output seed mask image"""
    output_target_time_courses: OutputPathType
    """Output target time courses"""
    output_confound_time_courses: OutputPathType
    """Output confound time courses"""


def fsl_sbca(
    infile: InputPathType,
    seed: InputPathType,
    target: InputPathType,
    out: str,
    runner: Runner | None = None,
) -> FslSbcaOutputs:
    """
    Performs seed-based correlation analysis on FMRI data using either a single seed
    coordinate or a seed mask.
    
    Author: Christian F. Beckmann
    
    URL: https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/SBCA
    
    Args:
        infile: Input file name (4D image file).
        seed: Seed voxel coordinate or file name of seed mask (3D/4D file).
        target: File name of target mask(s) (3D or 4D file).
        out: Output file base name.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `FslSbcaOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(FSL_SBCA_METADATA)
    cargs = []
    cargs.append("fsl_sbca")
    cargs.append("-i")
    cargs.extend([
        "--in",
        execution.input_file(infile)
    ])
    cargs.append("-s")
    cargs.extend([
        "--seed",
        execution.input_file(seed)
    ])
    cargs.append("-t")
    cargs.extend([
        "--target",
        execution.input_file(target)
    ])
    cargs.append("-o")
    cargs.extend([
        "--out",
        out
    ])
    cargs.append("[OPTIONS]")
    ret = FslSbcaOutputs(
        root=execution.output_file("."),
        output_seed_mask_image=execution.output_file(out + "_seeds"),
        output_seed_mask_image_base=execution.output_file(out + "_seedmask"),
        output_target_time_courses=execution.output_file(out + "_ttc<X>.txt"),
        output_confound_time_courses=execution.output_file(out + "_confounds.txt"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "FSL_SBCA_METADATA",
    "FslSbcaOutputs",
    "fsl_sbca",
]
