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

import typing
import pathlib
from styxdefs import *
import dataclasses

DMRI_PATHS_METADATA = Metadata(
    id="6eda0635b358ac171fbbf14d968294d81a352fc1.boutiques",
    name="dmri_paths",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


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


def dmri_paths(
    indir: str | None = None,
    outdir: str | None = None,
    dwi: InputPathType | None = None,
    grad: InputPathType | None = None,
    bval: InputPathType | None = None,
    mask: InputPathType | None = None,
    bpdir: str | None = None,
    ntr: float | None = 1,
    fmin: float | None = 0,
    basereg: InputPathType | None = None,
    basemask: InputPathType | None = None,
    roi1: InputPathType | None = None,
    roi2: InputPathType | None = None,
    roimesh1: InputPathType | None = None,
    roimesh2: InputPathType | None = None,
    roiref1: InputPathType | None = None,
    roiref2: InputPathType | None = None,
    prior: InputPathType | None = None,
    nprior: InputPathType | None = None,
    nset: float | None = None,
    lprior: InputPathType | None = None,
    lset: float | None = None,
    seg: InputPathType | None = None,
    tprior: InputPathType | None = None,
    cprior: InputPathType | None = None,
    reg: InputPathType | None = None,
    regnl: InputPathType | None = None,
    init: InputPathType | None = None,
    nb: float | None = 5000,
    ns: float | None = 5000,
    nk: float | None = 10,
    nu: float | None = 40,
    sdp: InputPathType | None = None,
    debug: bool = False,
    checkopts: bool = False,
    version: bool = False,
    runner: Runner | None = None,
) -> DmriPathsOutputs:
    """
    Tool for diffusion MRI path analysis.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        indir: Input subject directory (optional), specify multiple for\
            longitudinal data.
        outdir: Output directory (one per path).
        dwi: DWI volume series.
        grad: Text file of diffusion gradients.
        bval: Text file of diffusion b-values.
        mask: Mask volume.
        bpdir: BEDPOST directory.
        ntr: Max number of tracts per voxel (default 1).
        fmin: Tract volume fraction threshold (default 0).
        basereg: Base-to-DWI registration, needed for longitudinal data only\
            (.mat, as many as input directories).
        basemask: Base template mask volume.
        roi1: End ROI 1 (volume or label, one per path).
        roi2: End ROI 2 (volume or label, one per path).
        roimesh1: Mesh for end ROI 1 (for label ROIs).
        roimesh2: Mesh for end ROI 2 (for label ROIs).
        roiref1: Reference volume for end ROI 1 (for label ROIs).
        roiref2: Reference volume for end ROI 2 (for label ROIs).
        prior: Spatial path priors (negative log-likelihoods off and on the\
            path, one pair per path).
        nprior: Near-neighbor label priors (negative log-likelihood and list of\
            labels, one pair per path).
        nset: Subset of near-neighbor label priors (default all).
        lprior: Local-neighbor label priors (negative log-likelihood and list\
            of labels, one pair per path).
        lset: Subset of local-neighbor label priors (default all).
        seg: Segmentation map of test subject, specify multiple for\
            longitudinal data.
        tprior: Path tangent vector priors (negative log-likelihood, one per\
            path).
        cprior: Path curvature priors (negative log-likelihood, one per path).
        reg: DWI-to-atlas affine registration (.mat).
        regnl: DWI-to-atlas nonlinear registration (.m3z).
        init: Text file of initial control points (one per path).
        nb: Number of burn-in samples (default 5000).
        ns: Number of post-burn-in samples (default 5000).
        nk: Keep every nk-th sample (default 10).
        nu: Update proposal every nu-th sample (default 40).
        sdp: Text file with initial proposal standard deviations for control\
            point perturbations.
        debug: Turn on debugging.
        checkopts: Don't run anything, just check options and exit.
        version: Print out version and exit.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `DmriPathsOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(DMRI_PATHS_METADATA)
    cargs = []
    cargs.append("dmri_paths")
    if indir is not None:
        cargs.extend([
            "--indir",
            indir
        ])
    if outdir is not None:
        cargs.extend([
            "--outdir",
            outdir
        ])
    if dwi is not None:
        cargs.extend([
            "--dwi",
            execution.input_file(dwi)
        ])
    if grad is not None:
        cargs.extend([
            "--grad",
            execution.input_file(grad)
        ])
    if bval is not None:
        cargs.extend([
            "--bval",
            execution.input_file(bval)
        ])
    if mask is not None:
        cargs.extend([
            "--mask",
            execution.input_file(mask)
        ])
    if bpdir is not None:
        cargs.extend([
            "--bpdir",
            bpdir
        ])
    if ntr is not None:
        cargs.extend([
            "--ntr",
            str(ntr)
        ])
    if fmin is not None:
        cargs.extend([
            "--fmin",
            str(fmin)
        ])
    if basereg is not None:
        cargs.extend([
            "--basereg",
            execution.input_file(basereg)
        ])
    if basemask is not None:
        cargs.extend([
            "--basemask",
            execution.input_file(basemask)
        ])
    if roi1 is not None:
        cargs.extend([
            "--roi1",
            execution.input_file(roi1)
        ])
    if roi2 is not None:
        cargs.extend([
            "--roi2",
            execution.input_file(roi2)
        ])
    if roimesh1 is not None:
        cargs.extend([
            "--roimesh1",
            execution.input_file(roimesh1)
        ])
    if roimesh2 is not None:
        cargs.extend([
            "--roimesh2",
            execution.input_file(roimesh2)
        ])
    if roiref1 is not None:
        cargs.extend([
            "--roiref1",
            execution.input_file(roiref1)
        ])
    if roiref2 is not None:
        cargs.extend([
            "--roiref2",
            execution.input_file(roiref2)
        ])
    if prior is not None:
        cargs.extend([
            "--prior",
            execution.input_file(prior)
        ])
    if nprior is not None:
        cargs.extend([
            "--nprior",
            execution.input_file(nprior)
        ])
    if nset is not None:
        cargs.extend([
            "--nset",
            str(nset)
        ])
    if lprior is not None:
        cargs.extend([
            "--lprior",
            execution.input_file(lprior)
        ])
    if lset is not None:
        cargs.extend([
            "--lset",
            str(lset)
        ])
    if seg is not None:
        cargs.extend([
            "--seg",
            execution.input_file(seg)
        ])
    if tprior is not None:
        cargs.extend([
            "--tprior",
            execution.input_file(tprior)
        ])
    if cprior is not None:
        cargs.extend([
            "--cprior",
            execution.input_file(cprior)
        ])
    if reg is not None:
        cargs.extend([
            "--reg",
            execution.input_file(reg)
        ])
    if regnl is not None:
        cargs.extend([
            "--regnl",
            execution.input_file(regnl)
        ])
    if init is not None:
        cargs.extend([
            "--init",
            execution.input_file(init)
        ])
    if nb is not None:
        cargs.extend([
            "--nb",
            str(nb)
        ])
    if ns is not None:
        cargs.extend([
            "--ns",
            str(ns)
        ])
    if nk is not None:
        cargs.extend([
            "--nk",
            str(nk)
        ])
    if nu is not None:
        cargs.extend([
            "--nu",
            str(nu)
        ])
    if sdp is not None:
        cargs.extend([
            "--sdp",
            execution.input_file(sdp)
        ])
    if debug:
        cargs.append("--debug")
    if checkopts:
        cargs.append("--checkopts")
    if version:
        cargs.append("--version")
    ret = DmriPathsOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "DMRI_PATHS_METADATA",
    "DmriPathsOutputs",
    "dmri_paths",
]
