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

import typing
import pathlib
from styxdefs import *
import dataclasses

WMEDITS2SURF_METADATA = Metadata(
    id="e8eb1a9b712eb53b8fd7c00668424bc559f7cff6.boutiques",
    name="wmedits2surf",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class Wmedits2surfOutputs(typing.NamedTuple):
    """
    Output object returned when calling `wmedits2surf(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    lh_wmerase: OutputPathType
    """Left hemisphere white matter erase surface file."""
    rh_wmerase: OutputPathType
    """Right hemisphere white matter erase surface file."""
    lh_wmfill: OutputPathType
    """Left hemisphere white matter fill surface file."""
    rh_wmfill: OutputPathType
    """Right hemisphere white matter fill surface file."""
    wm_erase_stats: OutputPathType
    """Statistics on the number of voxels erased."""
    wm_fill_stats: OutputPathType
    """Statistics on the number of voxels filled."""


def wmedits2surf(
    subject: str,
    self: bool = False,
    overwrite: bool = False,
    tmp_dir: str | None = None,
    cleanup: bool = False,
    no_cleanup: bool = False,
    debug: bool = False,
    lh: bool = False,
    rh: bool = False,
    no_surfs: bool = False,
    runner: Runner | None = None,
) -> Wmedits2surfOutputs:
    """
    Computes binary maps of surface locations where the wm.mgz has been edited.
    Creates files for each hemisphere for each type of edit.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        subject: Subject identifier.
        overwrite: Force overwriting of existing results.
        tmp_dir: Temporary directory.
        cleanup: Cleanup temporary files after execution.
        no_cleanup: Do not cleanup temporary files after execution.
        debug: Debug mode.
        lh: Only do left hemisphere.
        rh: Only do right hemisphere.
        no_surfs: Do not compute surfaces, only count stats.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `Wmedits2surfOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(WMEDITS2SURF_METADATA)
    cargs = []
    cargs.append("wmedits2surf")
    cargs.extend([
        "--s",
        subject
    ])
    if self:
        cargs.append("--self")
    if overwrite:
        cargs.append("--overwrite")
    if tmp_dir is not None:
        cargs.extend([
            "--tmp",
            tmp_dir
        ])
    if cleanup:
        cargs.append("--cleanup")
    if no_cleanup:
        cargs.append("--no-cleanup")
    if debug:
        cargs.append("--debug")
    if lh:
        cargs.append("--lh")
    if rh:
        cargs.append("--rh")
    if no_surfs:
        cargs.append("--no-surfs")
    ret = Wmedits2surfOutputs(
        root=execution.output_file("."),
        lh_wmerase=execution.output_file("subject/surf/lh.wmerase.fsa.mgh"),
        rh_wmerase=execution.output_file("subject/surf/rh.wmerase.fsa.mgh"),
        lh_wmfill=execution.output_file("subject/surf/lh.wmfill.fsa.mgh"),
        rh_wmfill=execution.output_file("subject/surf/rh.wmfill.fsa.mgh"),
        wm_erase_stats=execution.output_file("subject/stats/wm.erase.dat"),
        wm_fill_stats=execution.output_file("subject/stats/wm.fill.dat"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "WMEDITS2SURF_METADATA",
    "Wmedits2surfOutputs",
    "wmedits2surf",
]
