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

import typing
import pathlib
from styxdefs import *
import dataclasses

DMRI_GROUP_METADATA = Metadata(
    id="62e5f1536c9234b5603d09f4124d51072e3633cc.boutiques",
    name="dmri_group",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


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


def dmri_group(
    input_list: InputPathType,
    reference_volume: InputPathType,
    output_base: str,
    no_interpolation: bool = False,
    sections_num: float | None = None,
    debug_mode: bool = False,
    check_options: bool = False,
    runner: Runner | None = None,
) -> DmriGroupOutputs:
    """
    A tool to process and analyze diffusion MRI group data.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        input_list: Text file with list of individual inputs.
        reference_volume: Reference volume for output path.
        output_base: Base name of output stats files.
        no_interpolation: Do not attempt to interpolate along-tract measures\
            (Assume that subjects are sampled at equivalent positions).
        sections_num: Divide the pathway into a number of sections and output\
            average measures for each section.
        debug_mode: Turn on debugging.
        check_options: Don't run anything, just check options and exit.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `DmriGroupOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(DMRI_GROUP_METADATA)
    cargs = []
    cargs.append("dmri_group")
    cargs.extend([
        "--list",
        execution.input_file(input_list)
    ])
    cargs.extend([
        "--ref",
        execution.input_file(reference_volume)
    ])
    cargs.extend([
        "--out",
        output_base
    ])
    if no_interpolation:
        cargs.append("--nointerp")
    if sections_num is not None:
        cargs.extend([
            "--sec",
            str(sections_num)
        ])
    if debug_mode:
        cargs.append("--debug")
    if check_options:
        cargs.append("--checkopts")
    ret = DmriGroupOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "DMRI_GROUP_METADATA",
    "DmriGroupOutputs",
    "dmri_group",
]
