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

import typing
import pathlib
from styxdefs import *
import dataclasses

POST_RECON_ALL_METADATA = Metadata(
    id="043904c04e1a7c309fb6aa5cb7234831a996fdf4.boutiques",
    name="post-recon-all",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


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


def post_recon_all(
    subject: str,
    no_subfields: bool = False,
    no_subregions: bool = False,
    no_cvs: bool = False,
    no_qcache: bool = False,
    no_sclimbic: bool = False,
    no_hthsu: bool = False,
    no_synthstrip: bool = False,
    no_synthseg: bool = False,
    no_qastats: bool = False,
    no_samseg: bool = False,
    no_xhemi: bool = False,
    no_cos7: bool = False,
    threads: float | None = None,
    force: bool = False,
    exit_on_error: bool = False,
    runner: Runner | None = None,
) -> PostReconAllOutputs:
    """
    Post-processing script typically run after recon-all in FreeSurfer.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        subject: Subject identifier to be processed.
        no_subfields: Do not run subfields extraction.
        no_subregions: Do not run subregions extraction.
        no_cvs: Do not run CVS processing (default behavior).
        no_qcache: Do not run qcache processing.
        no_sclimbic: Do not run sclimbic processing.
        no_hthsu: Do not run hypothalamic subunits processing.
        no_synthstrip: Do not run synthstrip processing.
        no_synthseg: Do not run synthseg processing.
        no_qastats: Do not run qastats processing.
        no_samseg: Do not run samseg processing.
        no_xhemi: Do not run xhemi processing.
        no_cos7: Do not run commands from CentOS7 container.
        threads: Number of threads to be used.
        force: Force rerunning even if output is newer than input.
        exit_on_error: Exit immediately if an error occurs.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `PostReconAllOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(POST_RECON_ALL_METADATA)
    cargs = []
    cargs.extend([
        "-all",
        "post-recon" + subject
    ])
    if no_subfields:
        cargs.append("--no-subfields")
    if no_subregions:
        cargs.append("--no-subregions")
    if no_cvs:
        cargs.append("--no-cvs")
    if no_qcache:
        cargs.append("--no-qcache")
    if no_sclimbic:
        cargs.append("--no-sclimbic")
    if no_hthsu:
        cargs.append("--no-hthsu")
    if no_synthstrip:
        cargs.append("--no-synthstrip")
    if no_synthseg:
        cargs.append("--no-synthseg")
    if no_qastats:
        cargs.append("--no-qastats")
    if no_samseg:
        cargs.append("--no-samseg")
    if no_xhemi:
        cargs.append("--no-xhemi")
    if no_cos7:
        cargs.append("--no-cos7")
    if threads is not None:
        cargs.extend([
            "--threads",
            str(threads)
        ])
    if force:
        cargs.append("--force")
    if exit_on_error:
        cargs.append("--exit-on-error")
    ret = PostReconAllOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "POST_RECON_ALL_METADATA",
    "PostReconAllOutputs",
    "post_recon_all",
]
