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

import typing
import pathlib
from styxdefs import *
import dataclasses

GPS_METADATA = Metadata(
    id="b6e9756556d50c5c524e3645c380d3d12a887881.boutiques",
    name="gps",
    package="fsl",
    container_image_tag="brainlife/fsl:6.0.4-patched2",
)


class GpsOutputs(typing.NamedTuple):
    """
    Output object returned when calling `gps(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_file: OutputPathType | None
    """Output file with generated directions"""


def gps(
    ndir: float,
    optws: bool = False,
    output: str | None = "bvecs#.txt",
    ranseed: float | None = None,
    init: InputPathType | None = None,
    report: bool = False,
    verbose: bool = False,
    help_: bool = False,
    runner: Runner | None = None,
) -> GpsOutputs:
    """
    Generate set of diffusion gradient directions.
    
    Author: FMRIB Analysis Group, University of Oxford
    
    URL: https://fsl.fmrib.ox.ac.uk/fsl/fslwiki
    
    Args:
        ndir: Number of directions.
        optws: Perform additional optimisation on the whole sphere (needed for\
            eddy).
        output: Name of output file (default: bvecs#.txt).
        ranseed: Seed random generator with supplied number.
        init: File with bvecs to use as initialisation.
        report: Report coulomb forces for initial configuration.
        verbose: Switch on diagnostic messages.
        help_: Display help message.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `GpsOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(GPS_METADATA)
    cargs = []
    cargs.append("gps")
    cargs.extend([
        "--ndir",
        str(ndir)
    ])
    if optws:
        cargs.append("--optws")
    if output is not None:
        cargs.extend([
            "--out",
            output
        ])
    if ranseed is not None:
        cargs.extend([
            "--ranseed",
            str(ranseed)
        ])
    if init is not None:
        cargs.extend([
            "--init",
            execution.input_file(init)
        ])
    if report:
        cargs.append("--report")
    if verbose:
        cargs.append("-v,--verbose")
    if help_:
        cargs.append("-h,--help")
    ret = GpsOutputs(
        root=execution.output_file("."),
        output_file=execution.output_file(output) if (output is not None) else None,
    )
    execution.run(cargs)
    return ret


__all__ = [
    "GPS_METADATA",
    "GpsOutputs",
    "gps",
]
