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

import typing
import pathlib
from styxdefs import *
import dataclasses

MRI_MATRIX_MULTIPLY_METADATA = Metadata(
    id="e27af9270450150cf8e376927c002e9ad9bce68e.boutiques",
    name="mri_matrix_multiply",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class MriMatrixMultiplyOutputs(typing.NamedTuple):
    """
    Output object returned when calling `mri_matrix_multiply(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_matrix_file: OutputPathType
    """Output matrix file resulting from the matrix multiplication."""


def mri_matrix_multiply(
    input_matrices: list[InputPathType],
    output_matrix: str,
    inverted_input_matrices: list[InputPathType] | None = None,
    verbose: bool = False,
    fsl: bool = False,
    binarize: bool = False,
    subject_name: str | None = None,
    runner: Runner | None = None,
) -> MriMatrixMultiplyOutputs:
    """
    Command-line tool for multiplying and manipulating MRI transformation matrices.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        input_matrices: Input matrix files for multiplication.
        output_matrix: Output matrix file.
        inverted_input_matrices: Input matrix files to be inverted before\
            multiplication.
        verbose: Verbose output.
        fsl: Assume input/output are FSL-style matrix files.
        binarize: 'Binarize' the output matrix.
        subject_name: Subject name for output reg.dat files.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `MriMatrixMultiplyOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(MRI_MATRIX_MULTIPLY_METADATA)
    cargs = []
    cargs.append("mri_matrix_multiply")
    cargs.extend([
        "-im",
        *[execution.input_file(f) for f in input_matrices]
    ])
    if inverted_input_matrices is not None:
        cargs.extend([
            "-iim",
            *[execution.input_file(f) for f in inverted_input_matrices]
        ])
    cargs.extend([
        "-om",
        output_matrix
    ])
    if verbose:
        cargs.append("-v")
    if fsl:
        cargs.append("-fsl")
    if binarize:
        cargs.append("-bin")
    if subject_name is not None:
        cargs.extend([
            "-s",
            subject_name
        ])
    ret = MriMatrixMultiplyOutputs(
        root=execution.output_file("."),
        output_matrix_file=execution.output_file(output_matrix),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "MRI_MATRIX_MULTIPLY_METADATA",
    "MriMatrixMultiplyOutputs",
    "mri_matrix_multiply",
]
