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

import typing
import pathlib
from styxdefs import *
import dataclasses

ASEG2FEAT_METADATA = Metadata(
    id="a171951e01eefa6d930d2f5fc71421003b6f23e3.boutiques",
    name="aseg2feat",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class Aseg2featOutputs(typing.NamedTuple):
    """
    Output object returned when calling `aseg2feat(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    segmentation_output: OutputPathType
    """Result segmentation in FEAT functional space."""
    stats_output: OutputPathType
    """Directory where results are saved when using --svstats."""


def aseg2feat(
    feat: str,
    featdirfile: InputPathType | None = None,
    seg: str | None = None,
    aparc_aseg: bool = False,
    svstats: bool = False,
    standard: bool = False,
    debug: bool = False,
    help_: bool = False,
    version: bool = False,
    runner: Runner | None = None,
) -> Aseg2featOutputs:
    """
    Resamples the FreeSurfer automatic subcortical segmentation (aseg) to the FEAT
    functional space.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        feat: FEAT output directory. Multiple --feat arguments can be supplied.
        featdirfile: File with a list of FEAT directories. Can be used in\
            conjunction with --feat.
        seg: Change segmentation volume, default is aseg.
        aparc_aseg: Use aparc+aseg.mgz. Same as --seg aparc+aseg.mgz.
        svstats: Save result in featdir/stats instead of featdir/reg/freesurfer.
        standard: Map results to standard space instead of native functional\
            space. Implies --svstats.
        debug: Turn on debugging.
        help_: Print help and exit.
        version: Print version and exit.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `Aseg2featOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(ASEG2FEAT_METADATA)
    cargs = []
    cargs.append("aseg2feat")
    cargs.extend([
        "--feat",
        feat
    ])
    if featdirfile is not None:
        cargs.extend([
            "--featdirfile",
            execution.input_file(featdirfile)
        ])
    if seg is not None:
        cargs.extend([
            "--seg",
            seg
        ])
    if aparc_aseg:
        cargs.append("--aparc+aseg")
    if svstats:
        cargs.append("--svstats")
    if standard:
        cargs.append("--standard")
    if debug:
        cargs.append("--debug")
    if help_:
        cargs.append("--help")
    if version:
        cargs.append("--version")
    ret = Aseg2featOutputs(
        root=execution.output_file("."),
        segmentation_output=execution.output_file(feat + "/reg/freesurfer/aseg.nii.gz"),
        stats_output=execution.output_file(feat + "/stats"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "ASEG2FEAT_METADATA",
    "Aseg2featOutputs",
    "aseg2feat",
]
