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

import typing
import pathlib
from styxdefs import *
import dataclasses

FAT_PROC_ALIGN_ANAT_PAIR_METADATA = Metadata(
    id="b81d41214e66c7f77b2bbc885c2f23369ad68254.boutiques",
    name="fat_proc_align_anat_pair",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


class FatProcAlignAnatPairOutputs(typing.NamedTuple):
    """
    Output object returned when calling `fat_proc_align_anat_pair(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    aligned_t1w: OutputPathType
    """Aligned T1w volume"""
    qc_snapshot_t1w_on_t2w: OutputPathType
    """QC snapshot of the T1w volume overlaying the T2w volume"""
    qc_snapshot_t1w_edges_on_t2w: OutputPathType
    """QC snapshot of the T1w edges overlaying the T2w volume"""


def fat_proc_align_anat_pair(
    input_t1w: InputPathType,
    input_t2w: InputPathType,
    output_prefix: str,
    output_grid: float | None = None,
    input_t2w_mask: InputPathType | None = None,
    do_ss_tmp_t1w: bool = False,
    warp: str | None = None,
    matrix: InputPathType | None = None,
    workdir: str | None = None,
    no_cmd_out: bool = False,
    no_clean: bool = False,
    runner: Runner | None = None,
) -> FatProcAlignAnatPairOutputs:
    """
    A tool for aligning a T1w anatomical image to a T2w anatomical image using
    solid-body parameters (translation and rotation).
    
    Author: AFNI Developers
    
    URL: https://afni.nimh.nih.gov/
    
    Args:
        input_t1w: T1-weighted volume.
        input_t2w: T2-weighted volume.
        output_prefix: Output prefix for files and snapshots.
        output_grid: Specify output T1w volume's final resolution (isotropic).
        input_t2w_mask: Input a mask to apply to the T2w volume for alignment.
        do_ss_tmp_t1w: Apply skullstripping to the T1w volume during an\
            intermediate step.
        warp: Specify the degrees of freedom for warping using options from\
            3dAllineate.
        matrix: Apply a pre-made matrix from 3dAllineate.
        workdir: Specify a working directory.
        no_cmd_out: Do not save the command line call and the location where it\
            was run.
        no_clean: Do not delete the temporary working directory.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `FatProcAlignAnatPairOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(FAT_PROC_ALIGN_ANAT_PAIR_METADATA)
    cargs = []
    cargs.append("fat_proc_align_anat_pair")
    cargs.extend([
        "-in_t1w",
        execution.input_file(input_t1w)
    ])
    cargs.extend([
        "-in_t2w",
        execution.input_file(input_t2w)
    ])
    cargs.extend([
        "-prefix",
        output_prefix
    ])
    if output_grid is not None:
        cargs.extend([
            "-newgrid",
            str(output_grid)
        ])
    if input_t2w_mask is not None:
        cargs.extend([
            "-in_t2w_mask",
            execution.input_file(input_t2w_mask)
        ])
    if do_ss_tmp_t1w:
        cargs.append("-do_ss_tmp_t1w")
    if warp is not None:
        cargs.extend([
            "-warp",
            warp
        ])
    if matrix is not None:
        cargs.extend([
            "-matrix",
            execution.input_file(matrix)
        ])
    if workdir is not None:
        cargs.extend([
            "-workdir",
            workdir
        ])
    if no_cmd_out:
        cargs.append("-no_cmd_out")
    if no_clean:
        cargs.append("-no_clean")
    ret = FatProcAlignAnatPairOutputs(
        root=execution.output_file("."),
        aligned_t1w=execution.output_file(output_prefix + "_t1w_aligned.nii.gz"),
        qc_snapshot_t1w_on_t2w=execution.output_file(output_prefix + "_QC_T1w_over_T2w.png"),
        qc_snapshot_t1w_edges_on_t2w=execution.output_file(output_prefix + "_QC_T1w_edges_over_T2w.png"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "FAT_PROC_ALIGN_ANAT_PAIR_METADATA",
    "FatProcAlignAnatPairOutputs",
    "fat_proc_align_anat_pair",
]
