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

import typing
import pathlib
from styxdefs import *
import dataclasses

DMRI_GROUP_BY_ENDPOINTS_METADATA = Metadata(
    id="87310592b138bba2f86c81c258d64cefe1c90e23.boutiques",
    name="dmri_groupByEndpoints",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


class DmriGroupByEndpointsOutputs(typing.NamedTuple):
    """
    Output object returned when calling `dmri_group_by_endpoints(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""


def dmri_group_by_endpoints(
    streamline_file: InputPathType,
    image_file: InputPathType,
    output_directory: str,
    runner: Runner | None = None,
) -> DmriGroupByEndpointsOutputs:
    """
    A tool to group streamlines by their endpoints using diffusion MRI data.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        streamline_file: The file containing streamline data.
        image_file: The image file to be used in grouping.
        output_directory: The directory where output will be saved.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `DmriGroupByEndpointsOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(DMRI_GROUP_BY_ENDPOINTS_METADATA)
    cargs = []
    cargs.append("dmri_groupByEndpoints")
    cargs.extend([
        "-s",
        execution.input_file(streamline_file)
    ])
    cargs.extend([
        "-i",
        execution.input_file(image_file)
    ])
    cargs.extend([
        "-d",
        output_directory
    ])
    ret = DmriGroupByEndpointsOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "DMRI_GROUP_BY_ENDPOINTS_METADATA",
    "DmriGroupByEndpointsOutputs",
    "dmri_group_by_endpoints",
]
