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

import typing
import pathlib
from styxdefs import *
import dataclasses

MRI_COREG_METADATA = Metadata(
    id="9bbb6e6425088ffae2c2ae1d212b227cca2ac3c8.boutiques",
    name="mri_coreg",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class MriCoregOutputs(typing.NamedTuple):
    """
    Output object returned when calling `mri_coreg(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    out_registration: OutputPathType
    """Output registration (LTA format)"""
    out_params: OutputPathType
    """File with output parameters"""
    out_cost: OutputPathType
    """Final cost value file"""
    saved_init_reg: OutputPathType
    """Saved initial registration"""
    saved_init_reg_only: OutputPathType
    """Saved initial registration (exit after save)"""
    movout_volume: OutputPathType
    """Preprocessed moving volume"""
    mov_idither_volume: OutputPathType
    """Moving intensity dither volume"""


def mri_coreg(
    movvol: InputPathType,
    refvol: InputPathType,
    reg: str,
    runner: Runner | None = None,
) -> MriCoregOutputs:
    """
    mri_coreg performs a linear registration between two volumes using the method
    compatible with spm_coreg.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        movvol: Source volume (mov).
        refvol: Target volume (ref or targ).
        reg: Output registration file.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `MriCoregOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(MRI_COREG_METADATA)
    cargs = []
    cargs.append("mri_coreg")
    cargs.append("--mov")
    cargs.append(execution.input_file(movvol))
    cargs.append("--ref")
    cargs.append(execution.input_file(refvol))
    cargs.append("--reg")
    cargs.append(reg)
    cargs.append("[ADDITIONAL_PARAMETERS]")
    ret = MriCoregOutputs(
        root=execution.output_file("."),
        out_registration=execution.output_file(reg),
        out_params=execution.output_file("[OUT_PARAM_FILE]"),
        out_cost=execution.output_file("[OUT_COST_FILE]"),
        saved_init_reg=execution.output_file("[INIT_REG_SAVE]"),
        saved_init_reg_only=execution.output_file("[INIT_REG_SAVE_ONLY]"),
        movout_volume=execution.output_file("[MOVOUT_VOLUME]"),
        mov_idither_volume=execution.output_file("[MOV_IDITHER_VOLUME]"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "MRI_COREG_METADATA",
    "MriCoregOutputs",
    "mri_coreg",
]
