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

import typing
import pathlib
from styxdefs import *
import dataclasses

LABEL_ELDERLY_SUBJECT_METADATA = Metadata(
    id="7a5cf9786ead1cc29d5308081c97520e6bd9cf60.boutiques",
    name="label_elderly_subject",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class LabelElderlySubjectOutputs(typing.NamedTuple):
    """
    Output object returned when calling `label_elderly_subject(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    labeled_volume: OutputPathType
    """Labeled output volume"""


def label_elderly_subject(
    norm_volume: InputPathType,
    transform_lta: InputPathType,
    aseg_volume: InputPathType,
    classifier_array: InputPathType | None = None,
    runner: Runner | None = None,
) -> LabelElderlySubjectOutputs:
    """
    Tool for labeling brain structures in MRI images of elderly subjects using
    Freesurfer.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        norm_volume: Normalized input volume (e.g. norm.mgz).
        transform_lta: Transformation file (e.g. talairach.lta).
        aseg_volume: Asegmentation volume file (e.g. aseg.mgz).
        classifier_array: Classifier array file (e.g. mixed.gca).
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `LabelElderlySubjectOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(LABEL_ELDERLY_SUBJECT_METADATA)
    cargs = []
    cargs.append("label_elderly_subject")
    cargs.append(execution.input_file(norm_volume))
    cargs.append(execution.input_file(transform_lta))
    if classifier_array is not None:
        cargs.append(execution.input_file(classifier_array))
    cargs.append(execution.input_file(aseg_volume))
    ret = LabelElderlySubjectOutputs(
        root=execution.output_file("."),
        labeled_volume=execution.output_file(pathlib.Path(aseg_volume).name + "_labeled.mgz"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "LABEL_ELDERLY_SUBJECT_METADATA",
    "LabelElderlySubjectOutputs",
    "label_elderly_subject",
]
