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

import typing
import pathlib
from styxdefs import *
import dataclasses

APPLYXFM4_D_METADATA = Metadata(
    id="589ce1a495f4b6b5b1c9c49ad166dfe4742dc738.boutiques",
    name="applyxfm4D",
    package="fsl",
    container_image_tag="mcin/fsl:6.0.5",
)


class Applyxfm4DOutputs(typing.NamedTuple):
    """
    Output object returned when calling `applyxfm4_d(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_file: OutputPathType
    """Transformed 4D volume output"""


def applyxfm4_d(
    input_volume: InputPathType,
    ref_volume: InputPathType,
    output_volume: str,
    transformation_matrix: str,
    runner: Runner | None = None,
) -> Applyxfm4DOutputs:
    """
    Applies 4D transformation matrices to 4D volumes.
    
    Author: Unknown
    
    Args:
        input_volume: Input 4D volume (e.g. img.nii.gz).
        ref_volume: Reference volume (e.g. ref.nii.gz).
        output_volume: Output volume after applying transformation (e.g.\
            output.nii.gz).
        transformation_matrix: Transformation matrix file or directory.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `Applyxfm4DOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(APPLYXFM4_D_METADATA)
    cargs = []
    cargs.append("applyxfm4D")
    cargs.append(execution.input_file(input_volume))
    cargs.append(execution.input_file(ref_volume))
    cargs.append(output_volume)
    cargs.append(transformation_matrix)
    ret = Applyxfm4DOutputs(
        root=execution.output_file("."),
        output_file=execution.output_file(output_volume + ".nii.gz"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "APPLYXFM4_D_METADATA",
    "Applyxfm4DOutputs",
    "applyxfm4_d",
]
