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

import typing
import pathlib
from styxdefs import *
import dataclasses

EXPORT_GCAM_METADATA = Metadata(
    id="71849e2de237c64059ec889d31c3f9a65e91dede.boutiques",
    name="exportGcam",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class ExportGcamOutputs(typing.NamedTuple):
    """
    Output object returned when calling `export_gcam(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_gcam_file: OutputPathType
    """Output GCAM file."""


def export_gcam(
    fixed: InputPathType,
    moving: InputPathType,
    morph: InputPathType,
    out_gcam: InputPathType,
    zlib_buffer: float | None = None,
    bbox_threshold: float | None = None,
    interp_method: typing.Literal["linear", "nearest"] | None = "linear",
    test: bool = False,
    runner: Runner | None = None,
) -> ExportGcamOutputs:
    """
    A tool for exporting GCAM (Geodesic Coordinate-based Anatomic Mapping) morphs.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        fixed: Fixed volume.
        moving: Moving volume.
        morph: Morph.
        out_gcam: Output GCAM (Geodesic Coordinate-based Anatomic Mapping).
        zlib_buffer: Zlib buffer pre-allocation multiplier.
        bbox_threshold: Threshold for bounding box. If absent, no bbox will be\
            used.
        interp_method: Interpolation method. Choices: linear, nearest. Default\
            is linear.
        test: Write out test files to verify the equivalence of tm3d and gcam\
            morphs.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `ExportGcamOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(EXPORT_GCAM_METADATA)
    cargs = []
    cargs.append("exportGcam")
    cargs.extend([
        "--fixed",
        execution.input_file(fixed)
    ])
    cargs.extend([
        "--moving",
        execution.input_file(moving)
    ])
    cargs.extend([
        "--morph",
        execution.input_file(morph)
    ])
    cargs.extend([
        "--out_gcam",
        execution.input_file(out_gcam)
    ])
    if zlib_buffer is not None:
        cargs.extend([
            "--zlib_buffer",
            str(zlib_buffer)
        ])
    if bbox_threshold is not None:
        cargs.extend([
            "--bbox_threshold",
            str(bbox_threshold)
        ])
    if interp_method is not None:
        cargs.extend([
            "--interp",
            interp_method
        ])
    if test:
        cargs.append("--test")
    ret = ExportGcamOutputs(
        root=execution.output_file("."),
        output_gcam_file=execution.output_file(pathlib.Path(out_gcam).name),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "EXPORT_GCAM_METADATA",
    "ExportGcamOutputs",
    "export_gcam",
]
