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

import typing
import pathlib
from styxdefs import *
import dataclasses

MRIS_SAMPLE_PARC_METADATA = Metadata(
    id="63fdac72bbfef323f1126c39c936ff5c938f8b5d.boutiques",
    name="mris_sample_parc",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class MrisSampleParcOutputs(typing.NamedTuple):
    """
    Output object returned when calling `mris_sample_parc(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    outfile: OutputPathType
    """Output annotation file."""


def mris_sample_parc(
    subject_name: str,
    hemisphere: str,
    parc_name: str,
    output_annot: str,
    sdir: str | None = None,
    surf: str | None = None,
    fix: float | None = None,
    replace: float | None = None,
    trans: list[float] | None = None,
    cortex: str | None = None,
    projmm: float | None = None,
    proj: float | None = None,
    projfrac: float | None = None,
    file: str | None = None,
    ct: str | None = None,
    v_level: float | None = None,
    filter_: float | None = None,
    smooth: float | None = None,
    w_size: float | None = None,
    thickness: str | None = None,
    change_unknown: float | None = None,
    help_: bool = False,
    version: bool = False,
    runner: Runner | None = None,
) -> MrisSampleParcOutputs:
    """
    This program samples a volumetric parcellation onto a surface.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        subject_name: The subject ID.
        hemisphere: Hemisphere: rh or lh.
        parc_name: Parcellation filename.
        output_annot: Output annotation filename.
        sdir: Use as subjects directory (default: $SUBJECTS_DIR).
        surf: Use as surface (default: 'white').
        fix: Fix topology of all labels smaller than the specified number of\
            vertices (default=-1, do all).
        replace: Replace label with deeper ones.
        trans: Translate one label number to another.
        cortex: Mask regions outside of the specified cortex label.
        projmm: Project the specified number of millimeters along surface\
            normal (default=0.0).
        proj: Same as -projmm.
        projfrac: Project the specified percent along surface normal\
            (default=0.5).
        file: Use as translation file (default: 'cma_parcellation_colors.txt').
        ct: Embed color table into output annotation file.
        v_level: Diagnostic level (default=0).
        filter_: Apply mode filter a specified number of times to parcellation\
            (default=0).
        smooth: Smooth surface a specified number of times (default=0).
        w_size: Use window size for sampling (default=7).
        thickness: Use thickness file (default: 'thickness').
        change_unknown: Change largest connected unknown region to specified\
            label (default: don't change).
        help_: Print help info.
        version: Print version info.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `MrisSampleParcOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(MRIS_SAMPLE_PARC_METADATA)
    cargs = []
    cargs.append("mris_sample_parc")
    cargs.append(subject_name)
    cargs.append(hemisphere)
    cargs.append(parc_name)
    cargs.append(output_annot)
    if sdir is not None:
        cargs.extend([
            "-sdir",
            sdir
        ])
    if surf is not None:
        cargs.extend([
            "-surf",
            surf
        ])
    if fix is not None:
        cargs.extend([
            "-fix",
            str(fix)
        ])
    if replace is not None:
        cargs.extend([
            "-replace",
            str(replace)
        ])
    if trans is not None:
        cargs.extend([
            "-trans",
            *map(str, trans)
        ])
    if cortex is not None:
        cargs.extend([
            "-cortex",
            cortex
        ])
    if projmm is not None:
        cargs.extend([
            "-projmm",
            str(projmm)
        ])
    if proj is not None:
        cargs.extend([
            "-proj",
            str(proj)
        ])
    if projfrac is not None:
        cargs.extend([
            "-projfrac",
            str(projfrac)
        ])
    if file is not None:
        cargs.extend([
            "-file",
            file
        ])
    if ct is not None:
        cargs.extend([
            "-ct",
            ct
        ])
    if v_level is not None:
        cargs.extend([
            "-v",
            str(v_level)
        ])
    if filter_ is not None:
        cargs.extend([
            "-f",
            str(filter_)
        ])
    if smooth is not None:
        cargs.extend([
            "-a",
            str(smooth)
        ])
    if w_size is not None:
        cargs.extend([
            "-w",
            str(w_size)
        ])
    if thickness is not None:
        cargs.extend([
            "-t",
            thickness
        ])
    if change_unknown is not None:
        cargs.extend([
            "-u",
            str(change_unknown)
        ])
    if help_:
        cargs.append("--help")
    if version:
        cargs.append("--version")
    ret = MrisSampleParcOutputs(
        root=execution.output_file("."),
        outfile=execution.output_file(output_annot),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "MRIS_SAMPLE_PARC_METADATA",
    "MrisSampleParcOutputs",
    "mris_sample_parc",
]
