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

import typing
import pathlib
from styxdefs import *
import dataclasses

MRISP_WRITE_METADATA = Metadata(
    id="7b8fc1540fc76774d461ee491e6eccf087b42779.boutiques",
    name="mrisp_write",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class MrispWriteOutputs(typing.NamedTuple):
    """
    Output object returned when calling `mrisp_write(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_file: OutputPathType
    """A file containing a surface-worth of per-vertex values saved in spherical
    coordinates."""


def mrisp_write(
    input_surface: InputPathType,
    overlay_filename: InputPathType,
    output_name: str,
    subjects_dir: str | None = None,
    coords: str | None = None,
    average_curvature: float | None = None,
    correlation_matrix: InputPathType | None = None,
    scale_factor: float | None = None,
    normalize_curvature: bool = False,
    verbose_vertex: float | None = None,
    write_diagnostics: bool = False,
    runner: Runner | None = None,
) -> MrispWriteOutputs:
    """
    This tool converts a surface overlay on a sphere into spherical coordinates.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        input_surface: Full path to input surface.
        overlay_filename: Full path to the overlay to map.
        output_name: Output file name. Can be full path to a .tif or .mgz file.
        subjects_dir: Set SUBJECTS_DIR. Default: uses environment variable.
        coords: Treat overlay as a surface and write it into a 3 frame\
            parameterization.
        average_curvature: Average curvature patterns navgs times.
        correlation_matrix: Use the overlay to compute the correlation matrix\
            within the specified label.
        scale_factor: Scale factor to adjust resolution of the spherical map.
        normalize_curvature: Normalize curvature by variance.
        verbose_vertex: Invoke diagnostics for specified vertex number.
        write_diagnostics: Write some diagnostics.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `MrispWriteOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(MRISP_WRITE_METADATA)
    cargs = []
    cargs.append("mrisp_write")
    cargs.append(execution.input_file(input_surface))
    cargs.append(execution.input_file(overlay_filename))
    cargs.append(output_name)
    if subjects_dir is not None:
        cargs.extend([
            "-SDIR",
            subjects_dir
        ])
    if coords is not None:
        cargs.extend([
            "-coords",
            coords
        ])
    if average_curvature is not None:
        cargs.extend([
            "-A",
            str(average_curvature)
        ])
    if correlation_matrix is not None:
        cargs.extend([
            "-CORR",
            execution.input_file(correlation_matrix)
        ])
    if scale_factor is not None:
        cargs.extend([
            "-SCALE",
            str(scale_factor)
        ])
    if normalize_curvature:
        cargs.append("-N")
    if verbose_vertex is not None:
        cargs.extend([
            "-V",
            str(verbose_vertex)
        ])
    if write_diagnostics:
        cargs.append("-W")
    ret = MrispWriteOutputs(
        root=execution.output_file("."),
        output_file=execution.output_file(output_name),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "MRISP_WRITE_METADATA",
    "MrispWriteOutputs",
    "mrisp_write",
]
