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

import typing
import pathlib
from styxdefs import *
import dataclasses

MRI_XVOLAVG_METADATA = Metadata(
    id="ef5784badf94298a73c9e048e6ca4f281cd306da.boutiques",
    name="mri_xvolavg",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class MriXvolavgOutputs(typing.NamedTuple):
    """
    Output object returned when calling `mri_xvolavg(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    averaged_output: OutputPathType
    """The averaged output volume."""


def mri_xvolavg(
    input_volumes: list[InputPathType],
    vol_type: str,
    output_volume: str,
    output_type: str | None = None,
    runner: Runner | None = None,
) -> MriXvolavgOutputs:
    """
    Tool to average multiple volumes together (including 4D volumes).
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        input_volumes: Path(s) to input volume(s). This option can be repeated\
            for each input volume.
        vol_type: Format type of all input volumes.
        output_volume: Path to output volume.
        output_type: Format type of the output volume (default is that of input\
            volumes).
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `MriXvolavgOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(MRI_XVOLAVG_METADATA)
    cargs = []
    cargs.append("mri_xvolavg")
    cargs.extend([
        "--vol",
        *[execution.input_file(f) for f in input_volumes]
    ])
    cargs.extend([
        "--vol_type",
        vol_type
    ])
    cargs.extend([
        "--out",
        output_volume
    ])
    if output_type is not None:
        cargs.extend([
            "--out_type",
            output_type
        ])
    ret = MriXvolavgOutputs(
        root=execution.output_file("."),
        averaged_output=execution.output_file(output_volume),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "MRI_XVOLAVG_METADATA",
    "MriXvolavgOutputs",
    "mri_xvolavg",
]
