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

import typing
import pathlib
from styxdefs import *
import dataclasses

ANTS_CORTICAL_THICKNESS_SH_METADATA = Metadata(
    id="927ff3d34dcb64b2fcbc355449b1223268e7ab32.boutiques",
    name="antsCorticalThickness.sh",
    package="ants",
    container_image_tag="antsx/ants:v2.5.3",
)


class AntsCorticalThicknessShOutputs(typing.NamedTuple):
    """
    Output object returned when calling `ants_cortical_thickness_sh(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    cortical_thickness: OutputPathType
    """The output cortical thickness map."""
    brain_extraction_mask: OutputPathType
    """The brain extraction mask."""
    brain_segmentation: OutputPathType
    """The brain segmentation image."""
    segmentation_posteriors: OutputPathType
    """The segmentation posteriors for different tissue classes."""


def ants_cortical_thickness_sh(
    image_dimension: typing.Literal[2, 3],
    anatomical_image: InputPathType,
    brain_template: InputPathType,
    brain_extraction_probability_mask: InputPathType,
    brain_segmentation_priors: str,
    output_prefix: str,
    runner: Runner | None = None,
) -> AntsCorticalThicknessShOutputs:
    """
    This script performs T1 anatomical brain processing including brain extraction,
    brain n-tissue segmentation, cortical thickness estimation, and optional
    registration to a template.
    
    Author: ANTs Developers
    
    URL: https://github.com/ANTsX/ANTs
    
    Args:
        image_dimension: 2 or 3 for 2- or 3-dimensional image.
        anatomical_image: Structural intensity image, typically T1.
        brain_template: Anatomical intensity template. This template is not\
            skull-stripped.
        brain_extraction_probability_mask: Brain probability mask in the\
            segmentation template space. A binary mask is acceptable.
        brain_segmentation_priors: Tissue probability priors corresponding to\
            the template image specified with the -e option. At least four priors\
            must exist, corresponding to CSF, Cortical GM, WM, Subcortical GM.
        output_prefix: Output prefix for the generated filenames.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `AntsCorticalThicknessShOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(ANTS_CORTICAL_THICKNESS_SH_METADATA)
    cargs = []
    cargs.append("antsCorticalThickness.sh")
    cargs.extend([
        "-d",
        str(image_dimension)
    ])
    cargs.extend([
        "-a",
        execution.input_file(anatomical_image)
    ])
    cargs.extend([
        "-e",
        execution.input_file(brain_template)
    ])
    cargs.extend([
        "-m",
        execution.input_file(brain_extraction_probability_mask)
    ])
    cargs.extend([
        "-p",
        brain_segmentation_priors
    ])
    cargs.append("[ADDITIONAL_PARAMETERS]")
    cargs.extend([
        "-o",
        output_prefix
    ])
    ret = AntsCorticalThicknessShOutputs(
        root=execution.output_file("."),
        cortical_thickness=execution.output_file(output_prefix + "CorticalThickness.nii.gz"),
        brain_extraction_mask=execution.output_file(output_prefix + "BrainExtractionMask.nii.gz"),
        brain_segmentation=execution.output_file(output_prefix + "BrainSegmentation.nii.gz"),
        segmentation_posteriors=execution.output_file(output_prefix + "BrainSegmentationPosteriors*.nii.gz"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "ANTS_CORTICAL_THICKNESS_SH_METADATA",
    "AntsCorticalThicknessShOutputs",
    "ants_cortical_thickness_sh",
]
