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

import typing
import pathlib
from styxdefs import *
import dataclasses

IMAGE_INTENSITY_STATISTICS_METADATA = Metadata(
    id="ba7ab9e8e494076bff274459f3f86dfd1563d5d9.boutiques",
    name="ImageIntensityStatistics",
    package="ants",
    container_image_tag="antsx/ants:v2.5.3",
)


class ImageIntensityStatisticsOutputs(typing.NamedTuple):
    """
    Output object returned when calling `image_intensity_statistics(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    intensity_statistics: OutputPathType
    """The output file containing intensity statistics."""


def image_intensity_statistics(
    image_dimension: int,
    input_image: InputPathType,
    label_image: InputPathType | None = None,
    runner: Runner | None = None,
) -> ImageIntensityStatisticsOutputs:
    """
    This tool computes intensity statistics of an input image, optionally given a
    label image.
    
    Author: ANTs Developers
    
    URL: https://github.com/ANTsX/ANTs
    
    Args:
        image_dimension: The dimensionality of the image (e.g., 2D, 3D).
        input_image: The input image for which intensity statistics will be\
            computed.
        label_image: An optional label image which defines regions of interest.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `ImageIntensityStatisticsOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(IMAGE_INTENSITY_STATISTICS_METADATA)
    cargs = []
    cargs.append("ImageIntensityStatistics")
    cargs.append(str(image_dimension))
    cargs.append(execution.input_file(input_image))
    if label_image is not None:
        cargs.append(execution.input_file(label_image))
    ret = ImageIntensityStatisticsOutputs(
        root=execution.output_file("."),
        intensity_statistics=execution.output_file("intensity_statistics.txt"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "IMAGE_INTENSITY_STATISTICS_METADATA",
    "ImageIntensityStatisticsOutputs",
    "image_intensity_statistics",
]
