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

import typing
import pathlib
from styxdefs import *
import dataclasses

EXVIVO_HEMI_PROC_METADATA = Metadata(
    id="9ef40c3f2cab9928f235df79043cbc38b92918d6.boutiques",
    name="exvivo-hemi-proc",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


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


def exvivo_hemi_proc(
    flashdir: str,
    outdir: str,
    subject: str,
    right_hemi: bool = False,
    suptent: bool = False,
    no_rotate: bool = False,
    t1thresh: float | None = None,
    threads: float | None = None,
    check_only: bool = False,
    prep_only: bool = False,
    mask_only: bool = False,
    samseg_only: bool = False,
    stop_mmppsp_after: str | None = None,
    force: bool = False,
    runner: Runner | None = None,
) -> ExvivoHemiProcOutputs:
    """
    Processes whole hemisphere data for Jeans entorhinal subfield labeling project.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        flashdir: Path to the FLASH data directory.
        outdir: Output directory where results will be saved.
        subject: Full path to the subject.
        right_hemi: Process right hemisphere.
        suptent: Indicate no tentorium (cblum and bstem) in the sample.
        no_rotate: Indicate rotation is not needed.
        t1thresh: T1 threshold, default is 415.
        threads: Number of threads to use.
        check_only: Only perform check, without further processing.
        prep_only: Only run up to manual rotation.
        mask_only: Only run up to creation of masks.
        samseg_only: Only run up to samseg.
        stop_mmppsp_after: Stop processing after a specific step\
            {tess,fix,preaparc,sphere,spherereg,white,pial}.
        force: Force the execution, overriding checks.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `ExvivoHemiProcOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(EXVIVO_HEMI_PROC_METADATA)
    cargs = []
    cargs.append("exvivo-hemi-proc")
    cargs.extend([
        "--i",
        flashdir
    ])
    cargs.extend([
        "--o",
        outdir
    ])
    cargs.extend([
        "--s",
        subject
    ])
    if right_hemi:
        cargs.append("--rh")
    if suptent:
        cargs.append("--suptent")
    if no_rotate:
        cargs.append("--no-rotate")
    if t1thresh is not None:
        cargs.extend([
            "--t1thresh",
            str(t1thresh)
        ])
    if threads is not None:
        cargs.extend([
            "--threads",
            str(threads)
        ])
    if check_only:
        cargs.append("--check-only")
    if prep_only:
        cargs.append("--prep-only")
    if mask_only:
        cargs.append("--mask-only")
    if samseg_only:
        cargs.append("--samseg-only")
    if stop_mmppsp_after is not None:
        cargs.extend([
            "--stop-mmppsp-after",
            stop_mmppsp_after
        ])
    if force:
        cargs.append("--force")
    ret = ExvivoHemiProcOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "EXVIVO_HEMI_PROC_METADATA",
    "ExvivoHemiProcOutputs",
    "exvivo_hemi_proc",
]
