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

import typing
import pathlib
from styxdefs import *
import dataclasses

MRI_LABEL2LABEL_METADATA = Metadata(
    id="17d5d1cd510c5a4c3d458511bf6609ccc3e1301b.boutiques",
    name="mri_label2label",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


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


def mri_label2label(
    src_label: InputPathType,
    trg_label: str,
    erode: float | None = None,
    open_: float | None = None,
    close: float | None = None,
    dilate: float | None = None,
    ring: float | None = None,
    src_subject: str | None = None,
    trg_subject: str | None = None,
    subject: str | None = None,
    outmask: str | None = None,
    outstat: str | None = None,
    sample: str | None = None,
    regmethod: str | None = None,
    usepathfiles: bool = False,
    hemi: str | None = None,
    src_hemi: str | None = None,
    trg_hemi: str | None = None,
    src_ico_order: float | None = None,
    trg_ico_order: float | None = None,
    direct: str | None = None,
    trgsurf: str | None = None,
    surfreg: str | None = None,
    srcsurfreg: str | None = None,
    trgsurfreg: str | None = None,
    srcsurfreg_file: str | None = None,
    trgsurfreg_file: str | None = None,
    paint: str | None = None,
    dmindmin: str | None = None,
    baryfill: str | None = None,
    label_cortex: str | None = None,
    surf_label2mask: str | None = None,
    srcmask: str | None = None,
    srcmasksign: str | None = None,
    srcmaskframe: float | None = None,
    xfm: str | None = None,
    reg: str | None = None,
    xfm_invert: bool = False,
    projabs: str | None = None,
    projfrac: str | None = None,
    sd: str | None = None,
    nohash: bool = False,
    norevmap: bool = False,
    to_scanner: str | None = None,
    to_tkr: str | None = None,
    scanner: bool = False,
    runner: Runner | None = None,
) -> MriLabel2labelOutputs:
    """
    No description.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        src_label: Input label file.
        trg_label: Output label file.
        erode: Erode the label N times before writing.
        open_: Open the label N times before writing.
        close: Close the label N times before writing.
        dilate: Dilate the label N times before writing.
        ring: Dilate the label N times then remove the original before writing.
        src_subject: Source subject.
        trg_subject: Target subject.
        subject: Use for both target and source.
        outmask: Save output label as a binary mask (surf only).
        outstat: Save output label stat as a mask (surf only).
        sample: Sample label onto surface.
        regmethod: Registration method (surface, volume).
        usepathfiles: Read from and write to a path file.
        hemi: Hemisphere (lh or rh) (with surface).
        src_hemi: Source Hemisphere (lh or rh).
        trg_hemi: Target Hemisphere (lh or rh).
        src_ico_order: When srcsubject=ico.
        trg_ico_order: When trgsubject=ico.
        direct: Use the [xyz] coords for src and trg surfaces to do direct\
            lookup.
        trgsurf: Get xyz from this surface (white).
        surfreg: Surface registration (sphere.reg).
        srcsurfreg: Source surface registration (sphere.reg).
        trgsurfreg: Target surface registration (sphere.reg).
        srcsurfreg_file: Specify full path to source reg.
        trgsurfreg_file: Specify full path to target reg.
        paint: Map to closest vertex on source surfname if d < dmax.
        dmindmin: Bin mask with vertex of closest label point when painting.
        baryfill: Fill with barycentric interpolation.
        label_cortex: Create a label like ?h.cortex.label.
        surf_label2mask: Convert a label to a binary mask.
        srcmask: Source mask surfvalfile thresh <format>.
        srcmasksign: Source mask sign (<abs>, pos, neg).
        srcmaskframe: Source mask frame number (0-based).
        xfm: Use xfm file instead of computing tal xfm.
        reg: Use register.dat file instead of computing tal xfm.
        xfm_invert: Invert xfm, or reg.
        projabs: Project dist mm along surf normal.
        projfrac: Project frac of thickness along surf normal.
        sd: Use specified subjects directory.
        nohash: Don't use hash table when regmethod is surface.
        norevmap: Don't use reverse mapping when regmethod is surface.
        to_scanner: Convert coords to scanner RAS prior to other operations.
        to_tkr: Convert coords to tkregister RAS prior to other operations.
        scanner: Set output coordinate type to scanner.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `MriLabel2labelOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(MRI_LABEL2LABEL_METADATA)
    cargs = []
    cargs.append("mri_label2label")
    cargs.extend([
        "--srclabel",
        execution.input_file(src_label)
    ])
    cargs.extend([
        "--trglabel",
        trg_label
    ])
    if erode is not None:
        cargs.extend([
            "--erode",
            str(erode)
        ])
    if open_ is not None:
        cargs.extend([
            "--open",
            str(open_)
        ])
    if close is not None:
        cargs.extend([
            "--close",
            str(close)
        ])
    if dilate is not None:
        cargs.extend([
            "--dilate",
            str(dilate)
        ])
    if ring is not None:
        cargs.extend([
            "--ring",
            str(ring)
        ])
    if src_subject is not None:
        cargs.extend([
            "--srcsubject",
            src_subject
        ])
    if trg_subject is not None:
        cargs.extend([
            "--trgsubject",
            trg_subject
        ])
    if subject is not None:
        cargs.extend([
            "--s",
            subject
        ])
    if outmask is not None:
        cargs.extend([
            "--outmask",
            outmask
        ])
    if outstat is not None:
        cargs.extend([
            "--outstat",
            outstat
        ])
    if sample is not None:
        cargs.extend([
            "--sample",
            sample
        ])
    if regmethod is not None:
        cargs.extend([
            "--regmethod",
            regmethod
        ])
    if usepathfiles:
        cargs.append("--usepathfiles")
    if hemi is not None:
        cargs.extend([
            "--hemi",
            hemi
        ])
    if src_hemi is not None:
        cargs.extend([
            "--srchemi",
            src_hemi
        ])
    if trg_hemi is not None:
        cargs.extend([
            "--trghemi",
            trg_hemi
        ])
    if src_ico_order is not None:
        cargs.extend([
            "--srcicoorder",
            str(src_ico_order)
        ])
    if trg_ico_order is not None:
        cargs.extend([
            "--trgicoorder",
            str(trg_ico_order)
        ])
    if direct is not None:
        cargs.extend([
            "--direct",
            direct
        ])
    if trgsurf is not None:
        cargs.extend([
            "--trgsurf",
            trgsurf
        ])
    if surfreg is not None:
        cargs.extend([
            "--surfreg",
            surfreg
        ])
    if srcsurfreg is not None:
        cargs.extend([
            "--srcsurfreg",
            srcsurfreg
        ])
    if trgsurfreg is not None:
        cargs.extend([
            "--trgsurfreg",
            trgsurfreg
        ])
    if srcsurfreg_file is not None:
        cargs.extend([
            "--srcsurfreg-file",
            srcsurfreg_file
        ])
    if trgsurfreg_file is not None:
        cargs.extend([
            "--trgsurfreg-file",
            trgsurfreg_file
        ])
    if paint is not None:
        cargs.extend([
            "--paint",
            paint
        ])
    if dmindmin is not None:
        cargs.extend([
            "--dmindmin",
            dmindmin
        ])
    if baryfill is not None:
        cargs.extend([
            "--baryfill",
            baryfill
        ])
    if label_cortex is not None:
        cargs.extend([
            "--label-cortex",
            label_cortex
        ])
    if surf_label2mask is not None:
        cargs.extend([
            "--surf-label2mask",
            surf_label2mask
        ])
    if srcmask is not None:
        cargs.extend([
            "--srcmask",
            srcmask
        ])
    if srcmasksign is not None:
        cargs.extend([
            "--srcmasksign",
            srcmasksign
        ])
    if srcmaskframe is not None:
        cargs.extend([
            "--srcmaskframe",
            str(srcmaskframe)
        ])
    if xfm is not None:
        cargs.extend([
            "--xfm",
            xfm
        ])
    if reg is not None:
        cargs.extend([
            "--reg",
            reg
        ])
    if xfm_invert:
        cargs.append("--xfm-invert")
    if projabs is not None:
        cargs.extend([
            "--projabs",
            projabs
        ])
    if projfrac is not None:
        cargs.extend([
            "--projfrac",
            projfrac
        ])
    if sd is not None:
        cargs.extend([
            "--sd",
            sd
        ])
    if nohash:
        cargs.append("--nohash")
    if norevmap:
        cargs.append("--norevmap")
    if to_scanner is not None:
        cargs.extend([
            "--to-scanner",
            to_scanner
        ])
    if to_tkr is not None:
        cargs.extend([
            "--to-tkr",
            to_tkr
        ])
    if scanner:
        cargs.append("--scanner")
    ret = MriLabel2labelOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "MRI_LABEL2LABEL_METADATA",
    "MriLabel2labelOutputs",
    "mri_label2label",
]
