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

import typing
import pathlib
from styxdefs import *
import dataclasses

HISTO_REGISTER_BLOCK_METADATA = Metadata(
    id="a9ce2e4f5a3f5c4fa13464f62cf2766ed76dbba2.boutiques",
    name="histo_register_block",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class HistoRegisterBlockOutputs(typing.NamedTuple):
    """
    Output object returned when calling `histo_register_block(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    aligned_output: OutputPathType
    """Aligned output file"""


def histo_register_block(
    seg_time1: InputPathType,
    seg_time2: InputPathType,
    transform1: InputPathType,
    transform2: InputPathType,
    output_file: str,
    out_like: InputPathType | None = None,
    invert_transform: bool = False,
    runner: Runner | None = None,
) -> HistoRegisterBlockOutputs:
    """
    A tool to align a histological slice with a block face image.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        seg_time1: Segmented image at time point 1.
        seg_time2: Segmented image at time point 2.
        transform1: Transformation file for time point 1.
        transform2: Transformation file for time point 2.
        output_file: Output file name for the aligned image.
        out_like: Set output volume parameters like the reference volume.
        invert_transform: Invert transform coordinates.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `HistoRegisterBlockOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(HISTO_REGISTER_BLOCK_METADATA)
    cargs = []
    cargs.append("histo_register_block")
    cargs.append(execution.input_file(seg_time1))
    cargs.append(execution.input_file(seg_time2))
    cargs.append(execution.input_file(transform1))
    cargs.append(execution.input_file(transform2))
    cargs.append(output_file)
    if out_like is not None:
        cargs.extend([
            "-out_like",
            execution.input_file(out_like)
        ])
    if invert_transform:
        cargs.append("-I")
    ret = HistoRegisterBlockOutputs(
        root=execution.output_file("."),
        aligned_output=execution.output_file(output_file),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "HISTO_REGISTER_BLOCK_METADATA",
    "HistoRegisterBlockOutputs",
    "histo_register_block",
]
