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

import typing
import pathlib
from styxdefs import *
import dataclasses

FSCALC_METADATA = Metadata(
    id="8980bc90eda2781be7235010d28f030a03b7741c.boutiques",
    name="fscalc",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class FscalcOutputs(typing.NamedTuple):
    """
    Output object returned when calling `fscalc(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    result_vol: OutputPathType
    """Resulting output volume from the operations specified."""


def fscalc(
    input1: str,
    operation: str,
    output_file: str,
    input2: str | None = None,
    output_data_type: str | None = None,
    debug: bool = False,
    tmpdir: str | None = None,
    nocleanup: bool = False,
    log_file: str | None = None,
    runner: Runner | None = None,
) -> FscalcOutputs:
    """
    A frontend tool to perform mathematical operations on volumes/surfaces of data
    using mris_calc.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        input1: First input image or constant.
        operation: Operation to perform between input volumes.
        output_file: Output volume file.
        input2: Second input image or constant. Optional for some unary\
            operations.
        output_data_type: Specify output data type (uchar, short, int, float).
        debug: Enable debug mode.
        tmpdir: Temporary directory for processing.
        nocleanup: Prevent cleanup of temporary files.
        log_file: Specify a log file for operation log.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `FscalcOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(FSCALC_METADATA)
    cargs = []
    cargs.append("fscalc")
    cargs.append(input1)
    cargs.append(operation)
    if input2 is not None:
        cargs.append(input2)
    cargs.extend([
        "--o",
        output_file
    ])
    if output_data_type is not None:
        cargs.extend([
            "--odt",
            output_data_type
        ])
    if debug:
        cargs.append("--debug")
    if tmpdir is not None:
        cargs.extend([
            "--tmpdir",
            tmpdir
        ])
    if nocleanup:
        cargs.append("--nocleanup")
    if log_file is not None:
        cargs.extend([
            "--log",
            log_file
        ])
    ret = FscalcOutputs(
        root=execution.output_file("."),
        result_vol=execution.output_file(output_file),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "FSCALC_METADATA",
    "FscalcOutputs",
    "fscalc",
]
