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

import typing
import pathlib
from styxdefs import *
import dataclasses

REG_TRANSFORM_METADATA = Metadata(
    id="6c64fbb5ab15f44e615628373fe6cb0c895c027d.boutiques",
    name="reg_transform",
    package="niftyreg",
    container_image_tag="vnmd/niftyreg_1.4.0:20220819",
)


class RegTransformOutputs(typing.NamedTuple):
    """
    Output object returned when calling `reg_transform(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    cpp2def_output_file: OutputPathType
    """File containing the CPP to DEF converted deformation field."""
    comp1_output_file: OutputPathType
    """File containing the composed deformation field from two control point
    lattices."""
    comp2_output_file: OutputPathType
    """File containing the composed deformation field from a deformation field
    and a control point lattice."""
    comp3_output_file: OutputPathType
    """File containing the composed deformation field from two deformation
    fields."""
    def2disp_output_file: OutputPathType
    """File containing the converted displacement field from a deformation
    field."""
    disp2def_output_file: OutputPathType
    """File containing the converted deformation field from a displacement
    field."""
    upd_sform_output_file: OutputPathType
    """File containing the updated image with modified sform."""
    aff2def_output_file: OutputPathType
    """File containing the composed deformation field from a non-rigid and an
    affine transformation."""
    inv_affine_output_file: OutputPathType
    """File containing the inverted affine matrix."""
    comp_aff_output_file: OutputPathType
    """File containing the composed affine matrix."""


def reg_transform(
    reference_image: InputPathType,
    runner: Runner | None = None,
) -> RegTransformOutputs:
    """
    Tool for performing various transformation operations on medical images
    including control point to deformation conversion, composition of
    transformations, and converting between deformation and displacement fields.
    
    Author: Marc Modat
    
    URL: https://example.com/reg_transform_docs
    
    Args:
        reference_image: Filename of the reference image.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `RegTransformOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(REG_TRANSFORM_METADATA)
    cargs = []
    cargs.append("reg_transform")
    cargs.append("-ref")
    cargs.extend([
        "-ref",
        execution.input_file(reference_image)
    ])
    cargs.append("[OPTIONS]")
    ret = RegTransformOutputs(
        root=execution.output_file("."),
        cpp2def_output_file=execution.output_file("[CPP2DEF_OUTPUT]"),
        comp1_output_file=execution.output_file("[COMP1_OUTPUT]"),
        comp2_output_file=execution.output_file("[COMP2_OUTPUT]"),
        comp3_output_file=execution.output_file("[COMP3_OUTPUT]"),
        def2disp_output_file=execution.output_file("[DEF2DISP_OUTPUT]"),
        disp2def_output_file=execution.output_file("[DISP2DEF_OUTPUT]"),
        upd_sform_output_file=execution.output_file("[UPD_SFORM_OUTPUT]"),
        aff2def_output_file=execution.output_file("[AFF2DEF_OUTPUT]"),
        inv_affine_output_file=execution.output_file("[INV_AFFINE_OUTPUT]"),
        comp_aff_output_file=execution.output_file("[COMP_AFF_OUTPUT]"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "REG_TRANSFORM_METADATA",
    "RegTransformOutputs",
    "reg_transform",
]
