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

import typing
import pathlib
from styxdefs import *
import dataclasses

FILM_CIFTI_METADATA = Metadata(
    id="22269a4481a2fb1ccfa0138931cf5367c9b75cbc.boutiques",
    name="film_cifti",
    package="fsl",
    container_image_tag="mcin/fsl:6.0.5",
)


class FilmCiftiOutputs(typing.NamedTuple):
    """
    Output object returned when calling `film_cifti(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_results: OutputPathType
    """Output results file"""


def film_cifti(
    input_filename: InputPathType,
    basename: str,
    left_surface: InputPathType,
    right_surface: InputPathType,
    susan_threshold: float | None = None,
    susan_extent: float | None = None,
    surface_sigma: float | None = None,
    surface_extent: float | None = None,
    film_options: str | None = None,
    runner: Runner | None = None,
) -> FilmCiftiOutputs:
    """
    A tool for statistical analysis of CIFTI files using FILM.
    
    Author: FSL Community
    
    Args:
        input_filename: Input CIFTI file.
        basename: Output basename.
        left_surface: Geometry for left cortex.
        right_surface: Geometry for right cortex.
        susan_threshold: Susan brightness threshold for volumetric analysis\
            (default: 0).
        susan_extent: Susan mask size for volumetric analysis (default: 4).
        surface_sigma: Smoothing sigma for surface analysis (default: 0).
        surface_extent: Smoothing extent for surface analysis (default: 4).
        film_options: Film options to be used with all modes, list must be\
            wrapped by quotes.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `FilmCiftiOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(FILM_CIFTI_METADATA)
    cargs = []
    cargs.append("film_cifti")
    cargs.append("-i")
    cargs.append(execution.input_file(input_filename))
    cargs.append("-o")
    cargs.append(basename)
    cargs.append("-l")
    cargs.append(execution.input_file(left_surface))
    cargs.append("-r")
    cargs.append(execution.input_file(right_surface))
    if susan_threshold is not None:
        cargs.extend([
            "--st",
            str(susan_threshold)
        ])
    if susan_extent is not None:
        cargs.extend([
            "--sm",
            str(susan_extent)
        ])
    if surface_sigma is not None:
        cargs.extend([
            "--ss",
            str(surface_sigma)
        ])
    if surface_extent is not None:
        cargs.extend([
            "--se",
            str(surface_extent)
        ])
    if film_options is not None:
        cargs.extend([
            "--filmOptions",
            film_options
        ])
    ret = FilmCiftiOutputs(
        root=execution.output_file("."),
        output_results=execution.output_file(basename + "_results.nii.gz"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "FILM_CIFTI_METADATA",
    "FilmCiftiOutputs",
    "film_cifti",
]
