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

import typing
import pathlib
from styxdefs import *
import dataclasses

SEGMENT_THALAMIC_NUCLEI_SH_METADATA = Metadata(
    id="8160107af015d05eab1a7764f08870c3a3705de2.boutiques",
    name="segmentThalamicNuclei.sh",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class SegmentThalamicNucleiShOutputs(typing.NamedTuple):
    """
    Output object returned when calling `segment_thalamic_nuclei_sh(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    thalamic_nuclei_output: OutputPathType
    """Segmented thalamic nuclei output file"""


def segment_thalamic_nuclei_sh(
    subject_id: str,
    output_dir: str,
    runner: Runner | None = None,
) -> SegmentThalamicNucleiShOutputs:
    """
    Segment the thalamic nuclei using FreeSurfer.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        subject_id: Subject ID for segmentation.
        output_dir: Output directory for the segmented thalamic nuclei.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `SegmentThalamicNucleiShOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(SEGMENT_THALAMIC_NUCLEI_SH_METADATA)
    cargs = []
    cargs.append("segmentThalamicNuclei.sh")
    cargs.append(subject_id)
    cargs.append(output_dir)
    ret = SegmentThalamicNucleiShOutputs(
        root=execution.output_file("."),
        thalamic_nuclei_output=execution.output_file(output_dir + "/" + subject_id + "_thalamic_nuclei.mgz"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "SEGMENT_THALAMIC_NUCLEI_SH_METADATA",
    "SegmentThalamicNucleiShOutputs",
    "segment_thalamic_nuclei_sh",
]
