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

import typing
import pathlib
from styxdefs import *
import dataclasses

SEGMENT_HA_T2_SH_METADATA = Metadata(
    id="e35fef1406f0bc21d5d98039621ba41ed9020379.boutiques",
    name="segmentHA_T2.sh",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class SegmentHaT2ShOutputs(typing.NamedTuple):
    """
    Output object returned when calling `segment_ha_t2_sh(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    left_hemisphere_labels: OutputPathType
    """Left hemisphere hippocampal and amygdala labels"""
    right_hemisphere_labels: OutputPathType
    """Right hemisphere hippocampal and amygdala labels"""


def segment_ha_t2_sh(
    input_image: InputPathType,
    output_directory: str,
    runner: Runner | None = None,
) -> SegmentHaT2ShOutputs:
    """
    Segments hippocampal and amygdala structures from T2-weighted MRI images using
    the FreeSurfer suite.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        input_image: Input T2-weighted MRI image file.
        output_directory: Output directory for segmented structures.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `SegmentHaT2ShOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(SEGMENT_HA_T2_SH_METADATA)
    cargs = []
    cargs.append("segmentHA_T2.sh")
    cargs.append(execution.input_file(input_image))
    cargs.append(output_directory)
    ret = SegmentHaT2ShOutputs(
        root=execution.output_file("."),
        left_hemisphere_labels=execution.output_file(output_directory + "/lh.hippoAmygLabels-T2.v21.mgz"),
        right_hemisphere_labels=execution.output_file(output_directory + "/rh.hippoAmygLabels-T2.v21.mgz"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "SEGMENT_HA_T2_SH_METADATA",
    "SegmentHaT2ShOutputs",
    "segment_ha_t2_sh",
]
