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

import typing
import pathlib
from styxdefs import *
import dataclasses

MRI_ROBUST_REGISTER_METADATA = Metadata(
    id="9447b4640a01ad953999f030b2233f0a06f973eb.boutiques",
    name="mri_robust_register",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class MriRobustRegisterOutputs(typing.NamedTuple):
    """
    Output object returned when calling `mri_robust_register(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    reg_output: OutputPathType
    """Registration output file containing the transformation from movable to
    destination."""
    mapped_output: OutputPathType
    """Movable volume mapped and resampled at destination."""
    mapped_hdr_output: OutputPathType
    """Movable volume aligned to destination (header only)."""
    weights_output_file: OutputPathType
    """Weights indicating outlier probabilities in destination space."""
    iscale_out_file: OutputPathType
    """Output text file containing the intensity scale value."""
    half_mov_file: OutputPathType
    """Half-way movable volume resampled."""
    half_dst_file: OutputPathType
    """Half-way destination volume resampled."""
    half_weights_file: OutputPathType
    """Half-way weights resampled in halfway space."""
    half_mov_lta_file: OutputPathType
    """Transform output from movable to half-way space."""
    half_dst_lta_file: OutputPathType
    """Transform output from destination to half-way space."""
    ent_mov_file: OutputPathType
    """Movable entropy image for ROBENT cost function."""
    ent_dst_file: OutputPathType
    """Target entropy image for ROBENT cost function."""


def mri_robust_register(
    movable_volume: InputPathType,
    target_volume: InputPathType,
    output_registration: str,
    runner: Runner | None = None,
) -> MriRobustRegisterOutputs:
    """
    Inverse consistent registration of two volumes using robust and standard cost
    functions.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        movable_volume: Input movable volume to be aligned to target.
        target_volume: Input target volume.
        output_registration: Output registration (transform from mov to dst).
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `MriRobustRegisterOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(MRI_ROBUST_REGISTER_METADATA)
    cargs = []
    cargs.append("mri_robust_register")
    cargs.append("--mov")
    cargs.append(execution.input_file(movable_volume))
    cargs.append("--dst")
    cargs.append(execution.input_file(target_volume))
    cargs.append("--lta")
    cargs.append(output_registration)
    cargs.append("[OUTLIER_SENSITIVITY_OPTION]")
    cargs.append("[OPTIONS]")
    ret = MriRobustRegisterOutputs(
        root=execution.output_file("."),
        reg_output=execution.output_file(output_registration),
        mapped_output=execution.output_file("[MAPPED_MOVABLE]"),
        mapped_hdr_output=execution.output_file("[MAPPED_MOVABLE_HDR]"),
        weights_output_file=execution.output_file("[WEIGHTS_OUTPUT]"),
        iscale_out_file=execution.output_file("[ISCALEOUT_FILE]"),
        half_mov_file=execution.output_file("[HALFMOV_FILE]"),
        half_dst_file=execution.output_file("[HALFDST_FILE]"),
        half_weights_file=execution.output_file("[HALFWEIGHTS_FILE]"),
        half_mov_lta_file=execution.output_file("[HALFMOVLTA_FILE]"),
        half_dst_lta_file=execution.output_file("[HALFDSTLTA_FILE]"),
        ent_mov_file=execution.output_file("[ENTMOV_FILE]"),
        ent_dst_file=execution.output_file("[ENTDST_FILE]"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "MRI_ROBUST_REGISTER_METADATA",
    "MriRobustRegisterOutputs",
    "mri_robust_register",
]
