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

import typing
import pathlib
from styxdefs import *
import dataclasses

MRI_HAUSDORFF_DIST_METADATA = Metadata(
    id="3bfc7962f48ea4f5a174be4b80f4251d364d4270.boutiques",
    name="mri_hausdorff_dist",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class MriHausdorffDistOutputs(typing.NamedTuple):
    """
    Output object returned when calling `mri_hausdorff_dist(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_text: OutputPathType
    """Output text file containing the results of Hausdorff distance
    calculation"""


def mri_hausdorff_dist(
    vol1: InputPathType,
    vol2: InputPathType,
    output_text_file: InputPathType,
    threshold: float | None = None,
    input_file_flag: bool = False,
    blur_sigma: float | None = None,
    max_flag: bool = False,
    label_index: float | None = None,
    runner: Runner | None = None,
) -> MriHausdorffDistOutputs:
    """
    Tool for computing the mean or max of the minimum distances between point sets
    in 3D volumes.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        vol1: First input volume.
        vol2: Second input volume.
        output_text_file: Output text file.
        threshold: Binarize input volumes with given threshold.
        input_file_flag: Read volumes from an input file (first argument is the\
            input filename).
        blur_sigma: Blur the input image with Gaussian of specified sigma.
        max_flag: Compute the maximum of the minimum distances instead of the\
            mean.
        label_index: Use specified label index as the target label.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `MriHausdorffDistOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(MRI_HAUSDORFF_DIST_METADATA)
    cargs = []
    cargs.append("mri_hausdorff_dist")
    cargs.append(execution.input_file(vol1))
    cargs.append(execution.input_file(vol2))
    cargs.append(execution.input_file(output_text_file))
    cargs.append("[BINARIZE_FLAG]")
    if threshold is not None:
        cargs.extend([
            "-b",
            str(threshold)
        ])
    if input_file_flag:
        cargs.append("-F")
    if blur_sigma is not None:
        cargs.extend([
            "-g",
            str(blur_sigma)
        ])
    if max_flag:
        cargs.append("-max")
    if label_index is not None:
        cargs.extend([
            "-l",
            str(label_index)
        ])
    ret = MriHausdorffDistOutputs(
        root=execution.output_file("."),
        output_text=execution.output_file(pathlib.Path(output_text_file).name),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "MRI_HAUSDORFF_DIST_METADATA",
    "MriHausdorffDistOutputs",
    "mri_hausdorff_dist",
]
