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

import typing
import pathlib
from styxdefs import *
import dataclasses

RCA_FIX_ENTO_METADATA = Metadata(
    id="483fc4d892e00dbb3db293128c06ac20a3ba5034.boutiques",
    name="rca-fix-ento",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class RcaFixEntoOutputs(typing.NamedTuple):
    """
    Output object returned when calling `rca_fix_ento(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    entowm_output: OutputPathType
    """Output segmentation of the WM around entorhinal cortex."""
    finalsurfs_output: OutputPathType
    """Edited brain.finalsurfs with manual edits."""
    backup_finalsufs_output: OutputPathType
    """Backup of the original brain.finalsurfs.manedit.mgz before edits."""


def rca_fix_ento(
    subject: str,
    threads: float | None = None,
    submit: bool = False,
    account: str | None = None,
    brain_mask: bool = False,
    runner: Runner | None = None,
) -> RcaFixEntoOutputs:
    """
    A tool to fix the entorhinal white matter in FreeSurfer using a deep learning
    network.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        subject: The subject identifier for processing.
        threads: Number of threads to use for processing.
        submit: Submit the task to sbatch with 1 thread and 14GB of memory.
        account: Specify the account to use when submitting to sbatch; default\
            is 'fhs'.
        brain_mask: Apply the ento fix to the brain.finalsurfs; this is turned\
            off due to a conflict with 255.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `RcaFixEntoOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(RCA_FIX_ENTO_METADATA)
    cargs = []
    cargs.append("rca-fix-ento")
    cargs.extend([
        "-s",
        subject
    ])
    if threads is not None:
        cargs.extend([
            "--threads",
            str(threads)
        ])
    if submit:
        cargs.append("--submit")
    if account is not None:
        cargs.extend([
            "--account",
            account
        ])
    if brain_mask:
        cargs.append("--brain-mask")
    ret = RcaFixEntoOutputs(
        root=execution.output_file("."),
        entowm_output=execution.output_file(subject + "/mri/entowm.mgz"),
        finalsurfs_output=execution.output_file(subject + "/mri/brain.finalsurfs.manedit.mgz"),
        backup_finalsufs_output=execution.output_file(subject + "/mri/backup.brain.finalsurfs.manedit.mgz"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "RCA_FIX_ENTO_METADATA",
    "RcaFixEntoOutputs",
    "rca_fix_ento",
]
