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

import typing
import pathlib
from styxdefs import *
import dataclasses

MRI_WBC_METADATA = Metadata(
    id="92584218abde258bddf747b7925b1c16f3270082.boutiques",
    name="mri_wbc",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


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


def mri_wbc(
    functional_volume: InputPathType,
    lh_functional_surface: InputPathType,
    lh_surface: InputPathType,
    rh_functional_surface: InputPathType,
    rh_surface: InputPathType,
    volume_mask: InputPathType | None = None,
    lh_inflated: InputPathType | None = None,
    lh_mask: InputPathType | None = None,
    lh_label: InputPathType | None = None,
    rh_inflated: InputPathType | None = None,
    rh_mask: InputPathType | None = None,
    rh_label: InputPathType | None = None,
    rho_threshold: float | None = None,
    dist_threshold: float | None = None,
    threads: float | None = None,
    debug: bool = False,
    checkopts: bool = False,
    runner: Runner | None = None,
) -> MriWbcOutputs:
    """
    A tool for working with functional brain imaging data on surfaces and volumes.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        functional_volume: Functional volume file.
        lh_functional_surface: Left hemisphere functional surface file.
        lh_surface: Left hemisphere surface file.
        rh_functional_surface: Right hemisphere functional surface file.
        rh_surface: Right hemisphere surface file.
        volume_mask: Mask for functional volume.
        lh_inflated: Optional left hemisphere inflated surface file.
        lh_mask: Mask for left hemisphere functional surface.
        lh_label: Label mask for left hemisphere functional surface.
        rh_inflated: Optional right hemisphere inflated surface file.
        rh_mask: Mask for right hemisphere functional surface.
        rh_label: Label mask for right hemisphere functional surface.
        rho_threshold: Rho threshold value.
        dist_threshold: Distance threshold value.
        threads: Number of threads to use.
        debug: Turn on debugging.
        checkopts: Check options and exit without running.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `MriWbcOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(MRI_WBC_METADATA)
    cargs = []
    cargs.append("mri_wbc")
    cargs.extend([
        "--fvol",
        execution.input_file(functional_volume)
    ])
    if volume_mask is not None:
        cargs.extend([
            "--volmask",
            execution.input_file(volume_mask)
        ])
    cargs.extend([
        "--lh",
        execution.input_file(lh_functional_surface)
    ])
    cargs.extend([
        "--lh",
        execution.input_file(lh_surface)
    ])
    if lh_inflated is not None:
        cargs.extend([
            "--lh",
            execution.input_file(lh_inflated)
        ])
    if lh_mask is not None:
        cargs.extend([
            "--lhmask",
            execution.input_file(lh_mask)
        ])
    if lh_label is not None:
        cargs.extend([
            "--lhlabel",
            execution.input_file(lh_label)
        ])
    cargs.extend([
        "--rh",
        execution.input_file(rh_functional_surface)
    ])
    cargs.extend([
        "--rh",
        execution.input_file(rh_surface)
    ])
    if rh_inflated is not None:
        cargs.extend([
            "--rh",
            execution.input_file(rh_inflated)
        ])
    if rh_mask is not None:
        cargs.extend([
            "--rhmask",
            execution.input_file(rh_mask)
        ])
    if rh_label is not None:
        cargs.extend([
            "--rhlabel",
            execution.input_file(rh_label)
        ])
    if rho_threshold is not None:
        cargs.extend([
            "--rho",
            str(rho_threshold)
        ])
    if dist_threshold is not None:
        cargs.extend([
            "--dist",
            str(dist_threshold)
        ])
    if threads is not None:
        cargs.extend([
            "--threads",
            str(threads)
        ])
    if debug:
        cargs.append("--debug")
    if checkopts:
        cargs.append("--checkopts")
    ret = MriWbcOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "MRI_WBC_METADATA",
    "MriWbcOutputs",
    "mri_wbc",
]
