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

import typing
import pathlib
from styxdefs import *
import dataclasses

MRIS_REGISTER_TO_VOLUME_METADATA = Metadata(
    id="9bdc925a77ef7d3c8dc9cd1fecb43c21110eb66b.boutiques",
    name="mris_register_to_volume",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


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


def mris_register_to_volume(
    surface: str,
    pial: str,
    reg: str,
    mri_reg: str,
    pial_only: str | None = None,
    noglobal: bool = False,
    median: bool = False,
    tx_mmd: list[float] | None = None,
    ty_mmd: list[float] | None = None,
    tz_mmd: list[float] | None = None,
    ax_mmd: list[float] | None = None,
    ay_mmd: list[float] | None = None,
    az_mmd: list[float] | None = None,
    cost: str | None = None,
    interp: str | None = None,
    noise: float | None = None,
    seed: float | None = None,
    skip: list[float] | None = None,
    sigma: list[float] | None = None,
    cnr: bool = False,
    max_rot: float | None = None,
    max_trans: float | None = None,
    border: float | None = None,
    subject: str | None = None,
    dilate: float | None = None,
    patch: str | None = None,
    label: str | None = None,
    out_reg: str | None = None,
    runner: Runner | None = None,
) -> MrisRegisterToVolumeOutputs:
    """
    Aligns cortical surfaces to a volumetric template.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        surface: The main surface file.
        pial: Pial surface name.
        reg: Registration file.
        mri_reg: MRI volume registration file.
        pial_only: Pial surface name (only).
        noglobal: Do not use global optimization.
        median: Use median filtering.
        tx_mmd: Translation in x (min, max, delta).
        ty_mmd: Translation in y (min, max, delta).
        tz_mmd: Translation in z (min, max, delta).
        ax_mmd: Rotation about x (min, max, delta).
        ay_mmd: Rotation about y (min, max, delta).
        az_mmd: Rotation about z (min, max, delta).
        cost: Cost file.
        interp: Interpolation type: trilinear or nearest.
        noise: Add noise with stddev for testing sensitivity.
        seed: Random seed for use with noise.
        skip: Number of vertices to skip.
        sigma: Size of blurring kernels to use.
        cnr: Use CNR-based similarity function.
        max_rot: Max angle (degrees) to search over.
        max_trans: Max translation (mm) to search over.
        border: Size of the border region to ignore.
        subject: Specify name of subject (for register.dat file).
        dilate: Dilate ripflags ndil times.
        patch: Load patch and limit calculations.
        label: Load label and limit calculations.
        out_reg: Output registration at lowest cost.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `MrisRegisterToVolumeOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(MRIS_REGISTER_TO_VOLUME_METADATA)
    cargs = []
    cargs.append("mris_register_to_volume")
    cargs.extend([
        "--surf",
        surface
    ])
    cargs.extend([
        "--pial",
        pial
    ])
    if pial_only is not None:
        cargs.extend([
            "--pial_only",
            pial_only
        ])
    cargs.extend([
        "--reg",
        reg
    ])
    if noglobal:
        cargs.append("--noglobal")
    if median:
        cargs.append("--median")
    cargs.extend([
        "--mri_reg",
        mri_reg
    ])
    if tx_mmd is not None:
        cargs.extend([
            "--tx-mmd",
            *map(str, tx_mmd)
        ])
    if ty_mmd is not None:
        cargs.extend([
            "--ty-mmd",
            *map(str, ty_mmd)
        ])
    if tz_mmd is not None:
        cargs.extend([
            "--tz-mmd",
            *map(str, tz_mmd)
        ])
    if ax_mmd is not None:
        cargs.extend([
            "--ax-mmd",
            *map(str, ax_mmd)
        ])
    if ay_mmd is not None:
        cargs.extend([
            "--ay-mmd",
            *map(str, ay_mmd)
        ])
    if az_mmd is not None:
        cargs.extend([
            "--az-mmd",
            *map(str, az_mmd)
        ])
    if cost is not None:
        cargs.extend([
            "--cost",
            cost
        ])
    if interp is not None:
        cargs.extend([
            "--interp",
            interp
        ])
    if noise is not None:
        cargs.extend([
            "--noise",
            str(noise)
        ])
    if seed is not None:
        cargs.extend([
            "--seed",
            str(seed)
        ])
    if skip is not None:
        cargs.extend([
            "--skip",
            *map(str, skip)
        ])
    if sigma is not None:
        cargs.extend([
            "--sigma",
            *map(str, sigma)
        ])
    if cnr:
        cargs.append("--CNR")
    if max_rot is not None:
        cargs.extend([
            "--max_rot",
            str(max_rot)
        ])
    if max_trans is not None:
        cargs.extend([
            "--max_trans",
            str(max_trans)
        ])
    if border is not None:
        cargs.extend([
            "--border",
            str(border)
        ])
    if subject is not None:
        cargs.extend([
            "--s",
            subject
        ])
    if dilate is not None:
        cargs.extend([
            "--dilate",
            str(dilate)
        ])
    if patch is not None:
        cargs.extend([
            "--patch",
            patch
        ])
    if label is not None:
        cargs.extend([
            "--label",
            label
        ])
    if out_reg is not None:
        cargs.extend([
            "--out-reg",
            out_reg
        ])
    ret = MrisRegisterToVolumeOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "MRIS_REGISTER_TO_VOLUME_METADATA",
    "MrisRegisterToVolumeOutputs",
    "mris_register_to_volume",
]
