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

import typing
import pathlib
from styxdefs import *
import dataclasses

TKREGISTER2_CMDL_METADATA = Metadata(
    id="a084019981b8c19c88bf65a10695c9febf690ada.boutiques",
    name="tkregister2_cmdl",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class Tkregister2CmdlOutputs(typing.NamedTuple):
    """
    Output object returned when calling `tkregister2_cmdl(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""


def tkregister2_cmdl(
    movable_volume: InputPathType,
    target_volume: InputPathType,
    fstarg_flag: bool = False,
    reg_file: InputPathType | None = None,
    check_reg_flag: bool = False,
    regheader_flag: bool = False,
    regheader_center_flag: bool = False,
    fsl_targ_flag: bool = False,
    fsl_targ_lr_flag: bool = False,
    gca_subject: str | None = None,
    gca_skull_subject: str | None = None,
    no_zero_cras_flag: bool = False,
    movbright: float | None = None,
    no_inorm_flag: bool = False,
    fmov: float | None = None,
    fmov_targ_flag: bool = False,
    plane: str | None = None,
    slice_: float | None = None,
    volview: str | None = None,
    fov: float | None = None,
    movscale: float | None = None,
    surf: str | None = None,
    surf_rgb: list[float] | None = None,
    lh_only_flag: bool = False,
    rh_only_flag: bool = False,
    fstal_flag: bool = False,
    talxfmname: str | None = None,
    ixfm: InputPathType | None = None,
    xfm: InputPathType | None = None,
    xfmout: InputPathType | None = None,
    fsl: InputPathType | None = None,
    fslregout: InputPathType | None = None,
    freeview: InputPathType | None = None,
    vox2vox: InputPathType | None = None,
    lta: InputPathType | None = None,
    lta_inv: InputPathType | None = None,
    ltaout: InputPathType | None = None,
    ltaout_inv_flag: bool = False,
    feat: str | None = None,
    fsfeat: str | None = None,
    identity_flag: bool = False,
    subject_id: str | None = None,
    subjects_dir: str | None = None,
    nofix_flag: bool = False,
    float2int: str | None = None,
    title: str | None = None,
    tag_flag: bool = False,
    mov_orientation: str | None = None,
    targ_orientation: str | None = None,
    int_: list[str] | None = None,
    double_window_size_flag: bool = False,
    window_scale: float | None = None,
    det: InputPathType | None = None,
    aseg_flag: bool = False,
    aparc_flag: bool = False,
    wmparc_flag: bool = False,
    gdiagno: float | None = None,
    trans: list[float] | None = None,
    rot: list[float] | None = None,
    conf_targ_flag: bool = False,
    runner: Runner | None = None,
) -> Tkregister2CmdlOutputs:
    """
    tkregister2 is a tool to assist in the manual tuning of the linear registration
    between two volumes, mainly for the purpose of interacting with the FreeSurfer
    anatomical stream.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        movable_volume: Path to the movable volume.
        target_volume: Path to the target volume.
        fstarg_flag: Target is relative to subjectid/mri.
        reg_file: Path to input/output registration file.
        check_reg_flag: Only check, no --reg needed.
        regheader_flag: Compute registration from headers.
        regheader_center_flag: Same as --regheader but aligns volume centers.
        fsl_targ_flag: Use FSLDIR/data/standard/avg152T1.nii.gz.
        fsl_targ_lr_flag: Use FSLDIR/data/standard/avg152T1_LR-marked.nii.gz.
        gca_subject: Subject ID for linear GCA registration check.
        gca_skull_subject: Subject ID for linear 'with skull' GCA registration\
            check.
        no_zero_cras_flag: Do not zero target cras (done with --fstal).
        movbright: Brightness of movable volume.
        no_inorm_flag: Turn off intensity normalization.
        fmov: Set movable volume brightness.
        fmov_targ_flag: Apply movable brightness to the target.
        plane: Startup view plane: cor, sag, ax.
        slice_: Startup slice number.
        volview: Startup with targ or mov.
        fov: Window FOV in mm (default is 256).
        movscale: Scale size of movable volume by scale.
        surf: Display surface as an overlay.
        surf_rgb: Set surface color (0-255) for R G B.
        lh_only_flag: Only load/display left hemisphere.
        rh_only_flag: Only load/display right hemisphere.
        fstal_flag: Set movable to be tal and reg to be taliarach.xfm.
        talxfmname: Set movable to be tal and reg to be talxfmname.
        ixfm: MNI-style inverse registration input matrix.
        xfm: MNI-style registration input matrix.
        xfmout: MNI-style registration output matrix.
        fsl: FSL-style registration input matrix.
        fslregout: FSL-Style registration output matrix.
        freeview: FreeView registration output matrix.
        vox2vox: Vox2vox matrix in ascii.
        lta: Linear Transform Array file.
        lta_inv: Read in LTA and invert.
        ltaout: Output a Linear Transform Array.
        ltaout_inv_flag: Invert transform in ltaoutfile.
        feat: Check example_func2standard registration.
        fsfeat: Check reg/freesurfer/register.dat registration.
        identity_flag: Use identity as registration matrix.
        subject_id: Set subject id.
        subjects_dir: Use specified directory as SUBJECTS_DIR.
        nofix_flag: Don't fix old tkregister matrices.
        float2int: Specify old tkregister float2int.
        title: Set window title.
        tag_flag: Tag movable volume near the col/row origin.
        mov_orientation: Supply orientation string for movable volume.
        targ_orientation: Supply orientation string for target volume.
        int_: Use registration from intermediate volume.
        double_window_size_flag: Double window size.
        window_scale: Scale window by specified scale.
        det: Save determinant of registration matrix to specified file.
        aseg_flag: Load aseg and hit 'd' to toggle.
        aparc_flag: Load aparc+aseg and hit 'c' to toggle.
        wmparc_flag: Load wmparc and hit 'c' to toggle.
        gdiagno: Set debug level.
        trans: Translation (mm) to apply to registration matrix.
        rot: Rotation angles (deg) to apply to registration matrix.
        conf_targ_flag: Conform target (assumes reg computed to conform target,\
            eg, GCA).
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `Tkregister2CmdlOutputs`).
    """
    if int_ is not None and (len(int_) != 2): 
        raise ValueError(f"Length of 'int_' must be 2 but was {len(int_)}")
    runner = runner or get_global_runner()
    execution = runner.start_execution(TKREGISTER2_CMDL_METADATA)
    cargs = []
    cargs.append("tkregister2_cmdl")
    cargs.extend([
        "--mov",
        execution.input_file(movable_volume)
    ])
    cargs.extend([
        "--targ",
        execution.input_file(target_volume)
    ])
    if fstarg_flag:
        cargs.append("--fstarg")
    if reg_file is not None:
        cargs.extend([
            "--reg",
            execution.input_file(reg_file)
        ])
    if check_reg_flag:
        cargs.append("--check-reg")
    if regheader_flag:
        cargs.append("--regheader")
    if regheader_center_flag:
        cargs.append("--regheader-center")
    if fsl_targ_flag:
        cargs.append("--fsl-targ")
    if fsl_targ_lr_flag:
        cargs.append("--fsl-targ-lr")
    if gca_subject is not None:
        cargs.extend([
            "--gca",
            gca_subject
        ])
    if gca_skull_subject is not None:
        cargs.extend([
            "--gca-skull",
            gca_skull_subject
        ])
    if no_zero_cras_flag:
        cargs.append("--no-zero-cras")
    if movbright is not None:
        cargs.extend([
            "--movbright",
            str(movbright)
        ])
    if no_inorm_flag:
        cargs.append("--no-inorm")
    if fmov is not None:
        cargs.extend([
            "--fmov",
            str(fmov)
        ])
    if fmov_targ_flag:
        cargs.append("--fmov-targ")
    if plane is not None:
        cargs.extend([
            "--plane",
            plane
        ])
    if slice_ is not None:
        cargs.extend([
            "--slice",
            str(slice_)
        ])
    if volview is not None:
        cargs.extend([
            "--volview",
            volview
        ])
    if fov is not None:
        cargs.extend([
            "--fov",
            str(fov)
        ])
    if movscale is not None:
        cargs.extend([
            "--movscale",
            str(movscale)
        ])
    if surf is not None:
        cargs.extend([
            "--surf",
            surf
        ])
    if surf_rgb is not None:
        cargs.extend([
            "--surf-rgb",
            *map(str, surf_rgb)
        ])
    if lh_only_flag:
        cargs.append("--lh-only")
    if rh_only_flag:
        cargs.append("--rh-only")
    if fstal_flag:
        cargs.append("--fstal")
    if talxfmname is not None:
        cargs.extend([
            "--talxfmname",
            talxfmname
        ])
    if ixfm is not None:
        cargs.extend([
            "--ixfm",
            execution.input_file(ixfm)
        ])
    if xfm is not None:
        cargs.extend([
            "--xfm",
            execution.input_file(xfm)
        ])
    if xfmout is not None:
        cargs.extend([
            "--xfmout",
            execution.input_file(xfmout)
        ])
    if fsl is not None:
        cargs.extend([
            "--fsl",
            execution.input_file(fsl)
        ])
    if fslregout is not None:
        cargs.extend([
            "--fslregout",
            execution.input_file(fslregout)
        ])
    if freeview is not None:
        cargs.extend([
            "--freeview",
            execution.input_file(freeview)
        ])
    if vox2vox is not None:
        cargs.extend([
            "--vox2vox",
            execution.input_file(vox2vox)
        ])
    if lta is not None:
        cargs.extend([
            "--lta",
            execution.input_file(lta)
        ])
    if lta_inv is not None:
        cargs.extend([
            "--lta-inv",
            execution.input_file(lta_inv)
        ])
    if ltaout is not None:
        cargs.extend([
            "--ltaout",
            execution.input_file(ltaout)
        ])
    if ltaout_inv_flag:
        cargs.append("--ltaout-inv")
    if feat is not None:
        cargs.extend([
            "--feat",
            feat
        ])
    if fsfeat is not None:
        cargs.extend([
            "--fsfeat",
            fsfeat
        ])
    if identity_flag:
        cargs.append("--identity")
    if subject_id is not None:
        cargs.extend([
            "--s",
            subject_id
        ])
    if subjects_dir is not None:
        cargs.extend([
            "--sd",
            subjects_dir
        ])
    if nofix_flag:
        cargs.append("--nofix")
    if float2int is not None:
        cargs.extend([
            "--float2int",
            float2int
        ])
    if title is not None:
        cargs.extend([
            "--title",
            title
        ])
    if tag_flag:
        cargs.append("--tag")
    if mov_orientation is not None:
        cargs.extend([
            "--mov-orientation",
            mov_orientation
        ])
    if targ_orientation is not None:
        cargs.extend([
            "--targ-orientation",
            targ_orientation
        ])
    if int_ is not None:
        cargs.extend([
            "--int",
            *int_
        ])
    if double_window_size_flag:
        cargs.append("--2")
    if window_scale is not None:
        cargs.extend([
            "--size",
            str(window_scale)
        ])
    if det is not None:
        cargs.extend([
            "--det",
            execution.input_file(det)
        ])
    if aseg_flag:
        cargs.append("--aseg")
    if aparc_flag:
        cargs.append("--aparc+aseg")
    if wmparc_flag:
        cargs.append("--wmparc")
    if gdiagno is not None:
        cargs.extend([
            "--gdiagno",
            str(gdiagno)
        ])
    if trans is not None:
        cargs.extend([
            "--trans",
            *map(str, trans)
        ])
    if rot is not None:
        cargs.extend([
            "--rot",
            *map(str, rot)
        ])
    if conf_targ_flag:
        cargs.append("--conf-targ")
    ret = Tkregister2CmdlOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "TKREGISTER2_CMDL_METADATA",
    "Tkregister2CmdlOutputs",
    "tkregister2_cmdl",
]
