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

import typing
import pathlib
from styxdefs import *
import dataclasses

DMRI_MATCH_METADATA = Metadata(
    id="efe736f14c6cc3e4977733f00b21400160482da4.boutiques",
    name="dmri_match",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class DmriMatchOutputs(typing.NamedTuple):
    """
    Output object returned when calling `dmri_match(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_file: OutputPathType
    """Output file from dmri_match"""


def dmri_match(
    parcellation1: InputPathType,
    parcellation2: InputPathType,
    num_clusters: float,
    clustering_path1: InputPathType,
    clustering_path2: InputPathType,
    output: str,
    labels: bool = False,
    euclidean: bool = False,
    bounding_box: bool = False,
    symmetry: bool = False,
    inter_hemi_ratio_removal: str | None = None,
    runner: Runner | None = None,
) -> DmriMatchOutputs:
    """
    Tool for matching diffusion MRI parcellations.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        parcellation1: First parcellation input file.
        parcellation2: Second parcellation input file.
        num_clusters: Number of clusters.
        clustering_path1: First clustering path.
        clustering_path2: Second clustering path.
        output: Output file.
        labels: Use labels (no additional input expected).
        euclidean: Use Euclidean distance for matching.
        bounding_box: Use bounding box constraint (no additional input\
            expected).
        symmetry: Use symmetry constraint (no additional input expected).
        inter_hemi_ratio_removal: Inter-hemispheric ratio cluster removal\
            constraint.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `DmriMatchOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(DMRI_MATCH_METADATA)
    cargs = []
    cargs.append("dmri_match")
    cargs.extend([
        "-s1",
        execution.input_file(parcellation1)
    ])
    cargs.extend([
        "-s2",
        execution.input_file(parcellation2)
    ])
    cargs.extend([
        "-c",
        str(num_clusters)
    ])
    cargs.extend([
        "-h1",
        execution.input_file(clustering_path1)
    ])
    cargs.extend([
        "-h2",
        execution.input_file(clustering_path2)
    ])
    if labels:
        cargs.append("-labels")
    if euclidean:
        cargs.append("-euclid")
    if bounding_box:
        cargs.append("-bb")
    if symmetry:
        cargs.append("-sym")
    if inter_hemi_ratio_removal is not None:
        cargs.append(inter_hemi_ratio_removal)
    cargs.extend([
        "-o",
        output
    ])
    ret = DmriMatchOutputs(
        root=execution.output_file("."),
        output_file=execution.output_file(output),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "DMRI_MATCH_METADATA",
    "DmriMatchOutputs",
    "dmri_match",
]
