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

import typing
import pathlib
from styxdefs import *
import dataclasses

PCTSURFCON_METADATA = Metadata(
    id="0e082a082c6b181a71427db52d685c35d4270743.boutiques",
    name="pctsurfcon",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


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


def pctsurfcon(
    subject: str,
    fsvol: str | None = None,
    outbase: str | None = None,
    lh_only: bool = False,
    rh_only: bool = False,
    gm_proj_frac: float | None = None,
    gm_proj_abs: float | None = None,
    wm_proj_abs: float | None = None,
    neg: bool = False,
    no_mask: bool = False,
    pial: bool = False,
    tmp: str | None = None,
    nocleanup: bool = False,
    runner: Runner | None = None,
) -> PctsurfconOutputs:
    """
    Compute surface-wise gray/white matter contrast.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        subject: FreeSurfer subject name.
        fsvol: Use fsvol instead of rawavg.
        outbase: Use outbase instead of w-g.pct (?h.w-g.pct.mgh).
        lh_only: Compute left hemisphere only.
        rh_only: Compute right hemisphere only.
        gm_proj_frac: GM projection fraction (default 0.3).
        gm_proj_abs: GM projection distance (default is to use frac).
        wm_proj_abs: WM projection distance (default is 1 mm).
        neg: Compute G-W instead of W-G.
        no_mask: Do not mask out non-cortical regions.
        pial: Use pial surface as base to compute gray/CSF contrast.
        tmp: Temporary directory (implies --nocleanup).
        nocleanup: Do not delete temporary files.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `PctsurfconOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(PCTSURFCON_METADATA)
    cargs = []
    cargs.append("pctsurfcon")
    cargs.extend([
        "-s",
        "-" + subject
    ])
    if fsvol is not None:
        cargs.extend([
            "--fsvol",
            fsvol
        ])
    if outbase is not None:
        cargs.extend([
            "--b",
            outbase
        ])
    if lh_only:
        cargs.append("--lh-only")
    if rh_only:
        cargs.append("--rh-only")
    if gm_proj_frac is not None:
        cargs.extend([
            "--gm-proj-frac",
            str(gm_proj_frac)
        ])
    if gm_proj_abs is not None:
        cargs.extend([
            "--gm-proj-abs",
            str(gm_proj_abs)
        ])
    if wm_proj_abs is not None:
        cargs.extend([
            "--wm-proj-abs",
            str(wm_proj_abs)
        ])
    if neg:
        cargs.append("--neg")
    if no_mask:
        cargs.append("--no-mask")
    if pial:
        cargs.append("--pial")
    if tmp is not None:
        cargs.extend([
            "--tmp",
            tmp
        ])
    if nocleanup:
        cargs.append("--nocleanup")
    ret = PctsurfconOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "PCTSURFCON_METADATA",
    "PctsurfconOutputs",
    "pctsurfcon",
]
