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

import typing
import pathlib
from styxdefs import *
import dataclasses

ANTS_INTERMODALITY_INTRASUBJECT_SH_METADATA = Metadata(
    id="e4f43efff74611f07e60c00f682c377a411a79c7.boutiques",
    name="antsIntermodalityIntrasubject.sh",
    package="ants",
    container_image_tag="antsx/ants:v2.5.3",
)


class AntsIntermodalityIntrasubjectShOutputs(typing.NamedTuple):
    """
    Output object returned when calling `ants_intermodality_intrasubject_sh(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_transformed_image: OutputPathType
    """Output transformed image after registration."""
    output_transform: OutputPathType
    """Transformation matrix or warp field from the registration."""
    output_warped_image: OutputPathType
    """Output warped image in the template space."""


def ants_intermodality_intrasubject_sh(
    dimension: int,
    anatomical_t1_image: InputPathType,
    scalar_image_to_match: InputPathType,
    anatomical_t1brainmask: InputPathType,
    transform_type: typing.Literal[0, 1, 2, 3],
    t1_to_template_prefix: str,
    output_prefix: str,
    anatomical_reference_image: InputPathType | None = None,
    template_space: str | None = None,
    labels_in_template_space: InputPathType | None = None,
    auxiliary_scalar_images: InputPathType | None = None,
    auxiliary_dt_image: InputPathType | None = None,
    runner: Runner | None = None,
) -> AntsIntermodalityIntrasubjectShOutputs:
    """
    Performs registration between a scalar image and a T1 image.
    
    Author: ANTs Developers
    
    URL: https://github.com/ANTsX/ANTs
    
    Args:
        dimension: Dimensionality of the image, typically 3 for 3D images.
        anatomical_t1_image: Anatomical T1 image (brain or whole-head) to align\
            to.
        scalar_image_to_match: Scalar image to be matched, such as average\
            BOLD, average DWI, etc.
        anatomical_t1brainmask: Brain mask for the anatomical T1 image, should\
            mask out regions not appearing in the scalar image.
        transform_type: Type of transform: 0=rigid, 1=affine,\
            2=rigid+small_def, 3=affine+small_def.
        t1_to_template_prefix: Prefix for T1 to template transform files.
        output_prefix: Prefix for output files.
        anatomical_reference_image: Anatomical reference image to warp to,\
            often higher resolution than the anatomical T1 image.
        template_space: Template space.
        labels_in_template_space: Labels in the template space.
        auxiliary_scalar_images: Auxiliary scalar images to warp to the\
            template.
        auxiliary_dt_image: Auxiliary DT image to warp to the template.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `AntsIntermodalityIntrasubjectShOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(ANTS_INTERMODALITY_INTRASUBJECT_SH_METADATA)
    cargs = []
    cargs.append("antsIntermodalityIntrasubject.sh")
    cargs.extend([
        "-d",
        str(dimension)
    ])
    cargs.extend([
        "-r",
        execution.input_file(anatomical_t1_image)
    ])
    if anatomical_reference_image is not None:
        cargs.extend([
            "-R",
            execution.input_file(anatomical_reference_image)
        ])
    cargs.extend([
        "-i",
        execution.input_file(scalar_image_to_match)
    ])
    cargs.extend([
        "-x",
        execution.input_file(anatomical_t1brainmask)
    ])
    cargs.extend([
        "-t",
        str(transform_type)
    ])
    cargs.extend([
        "-w",
        t1_to_template_prefix
    ])
    if template_space is not None:
        cargs.extend([
            "-T",
            template_space
        ])
    cargs.extend([
        "-o",
        output_prefix
    ])
    if labels_in_template_space is not None:
        cargs.extend([
            "-l",
            execution.input_file(labels_in_template_space)
        ])
    if auxiliary_scalar_images is not None:
        cargs.extend([
            "-a",
            execution.input_file(auxiliary_scalar_images)
        ])
    if auxiliary_dt_image is not None:
        cargs.extend([
            "-b",
            execution.input_file(auxiliary_dt_image)
        ])
    ret = AntsIntermodalityIntrasubjectShOutputs(
        root=execution.output_file("."),
        output_transformed_image=execution.output_file(output_prefix + "Transformed.nii.gz"),
        output_transform=execution.output_file(output_prefix + "Transform.mat"),
        output_warped_image=execution.output_file(output_prefix + "Warped.nii.gz"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "ANTS_INTERMODALITY_INTRASUBJECT_SH_METADATA",
    "AntsIntermodalityIntrasubjectShOutputs",
    "ants_intermodality_intrasubject_sh",
]
