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

import typing
import pathlib
from styxdefs import *
import dataclasses

V_5TT2GMWMI_METADATA = Metadata(
    id="5e6be0e8d2d77946c8326a477cc65c226f37e2c4.boutiques",
    name="5tt2gmwmi",
    package="mrtrix",
    container_image_tag="mrtrix3/mrtrix3:3.0.4",
)


@dataclasses.dataclass
class V5tt2gmwmiConfig:
    """
    temporarily set the value of an MRtrix config file entry.
    """
    key: str
    """temporarily set the value of an MRtrix config file entry."""
    value: str
    """temporarily set the value of an MRtrix config file entry."""
    
    def run(
        self,
        execution: Execution,
    ) -> list[str]:
        """
        Build command line arguments. This method is called by the main command.
        
        Args:
            execution: The execution object.
        Returns:
            Command line arguments
        """
        cargs = []
        cargs.append("-config")
        cargs.append(self.key)
        cargs.append(self.value)
        return cargs


class V5tt2gmwmiOutputs(typing.NamedTuple):
    """
    Output object returned when calling `v_5tt2gmwmi(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    mask_out: OutputPathType
    """the output mask image"""


def v_5tt2gmwmi(
    v_5tt_in: InputPathType,
    mask_out: str,
    mask_in: InputPathType | None = None,
    info: bool = False,
    quiet: bool = False,
    debug: bool = False,
    force: bool = False,
    nthreads: int | None = None,
    config: list[V5tt2gmwmiConfig] | None = None,
    help_: bool = False,
    version: bool = False,
    runner: Runner | None = None,
) -> V5tt2gmwmiOutputs:
    """
    Generate a mask image appropriate for seeding streamlines on the grey
    matter-white matter interface.
    
    
    
    References:
    
    Smith, R. E.; Tournier, J.-D.; Calamante, F. & Connelly, A.
    Anatomically-constrained tractography:Improved diffusion MRI streamlines
    tractography through effective use of anatomical information. NeuroImage,
    2012, 62, 1924-1938.
    
    Author: Robert E. Smith (robert.smith@florey.edu.au)
    
    URL:
    https://mrtrix.readthedocs.io/en/latest/reference/commands/5tt2gmwmi.html
    
    Args:
        v_5tt_in: the input 5TT segmented anatomical image.
        mask_out: the output mask image.
        mask_in: Filter an input mask image according to those voxels that lie\
            upon the grey matter - white matter boundary. If no input mask is\
            provided, the output will be a whole-brain mask image calculated using\
            the anatomical image only.
        info: display information messages.
        quiet: do not display information messages or progress status;\
            alternatively, this can be achieved by setting the MRTRIX_QUIET\
            environment variable to a non-empty string.
        debug: display debugging messages.
        force: force overwrite of output files (caution: using the same file as\
            input and output might cause unexpected behaviour).
        nthreads: use this number of threads in multi-threaded applications\
            (set to 0 to disable multi-threading).
        config: temporarily set the value of an MRtrix config file entry.
        help_: display this information page and exit.
        version: display version information and exit.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `V5tt2gmwmiOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(V_5TT2GMWMI_METADATA)
    cargs = []
    cargs.append("5tt2gmwmi")
    if mask_in is not None:
        cargs.extend([
            "-mask_in",
            execution.input_file(mask_in)
        ])
    if info:
        cargs.append("-info")
    if quiet:
        cargs.append("-quiet")
    if debug:
        cargs.append("-debug")
    if force:
        cargs.append("-force")
    if nthreads is not None:
        cargs.extend([
            "-nthreads",
            str(nthreads)
        ])
    if config is not None:
        cargs.extend([a for c in [s.run(execution) for s in config] for a in c])
    if help_:
        cargs.append("-help")
    if version:
        cargs.append("-version")
    cargs.append(execution.input_file(v_5tt_in))
    cargs.append(mask_out)
    ret = V5tt2gmwmiOutputs(
        root=execution.output_file("."),
        mask_out=execution.output_file(mask_out),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "V5tt2gmwmiConfig",
    "V5tt2gmwmiOutputs",
    "V_5TT2GMWMI_METADATA",
    "v_5tt2gmwmi",
]
