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

import typing
import pathlib
from styxdefs import *
import dataclasses

LONG_MRIS_SLOPES_METADATA = Metadata(
    id="5ba2dca61a52a3d9141cc6cd000056f304bcba66.boutiques",
    name="long_mris_slopes",
    package="freesurfer",
    container_image_tag="freesurfer/freesurfer:7.4.1",
)


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


def long_mris_slopes(
    qdec: InputPathType,
    meas: str,
    hemi: str,
    sd: str,
    do_avg: bool = False,
    do_rate: bool = False,
    do_pc1fit: bool = False,
    do_pc1: bool = False,
    do_spc: bool = False,
    do_stack: bool = False,
    do_label: bool = False,
    qcache: str | None = None,
    resid: str | None = None,
    fwhm: str | None = None,
    nosmooth: bool = False,
    time_: str | None = None,
    generic_time: bool = False,
    in_label: str | None = None,
    jac: bool = False,
    name_avg: str | None = None,
    name_rate: str | None = None,
    name_pc1fit: str | None = None,
    name_pc1: str | None = None,
    name_spc: str | None = None,
    name_resid: str | None = None,
    out_stack: str | None = None,
    out_label: str | None = None,
    isec_labels: str | None = None,
    stack_avg: str | None = None,
    stack_rate: str | None = None,
    stack_pc1fit: str | None = None,
    stack_pc1: str | None = None,
    stack_spc: str | None = None,
    stack_resid: str | None = None,
    runner: Runner | None = None,
) -> LongMrisSlopesOutputs:
    """
    Computes slope maps (e.g., of thickness) in a longitudinal study using
    FreeSurfer.
    
    Author: FreeSurfer Developers
    
    URL: https://github.com/freesurfer/freesurfer
    
    Args:
        qdec: (REQUIRED) QDEC table file specifying the subjects and time\
            points.
        meas: (REQUIRED) The surface input measure (e.g. thickness).
        hemi: (REQUIRED) Run one hemisphere: lh or rh or both.
        sd: (REQUIRED) Full path to FreeSurfer subjects directory.
        do_avg: Compute and output the temporal average.
        do_rate: Compute and output the rate.
        do_pc1fit: Compute and output the percent change (w.r.t. tp1 from\
            linear fit).
        do_pc1: Compute and output the percent change (w.r.t. tp1).
        do_spc: Compute and output the symmetrized percent change (w.r.t.\
            temporal average).
        do_stack: Save the stacked within subject file (time series).
        do_label: Compute and output intersected cortex label.
        qcache: Create cache for QDEC (resample to subject <QCACHE>, e.g.\
            fsaverage).
        resid: Residual time point (pass 1 for tp1 etc., pass 0 for average) to\
            export.
        fwhm: Smoothing at specific FWHM (required for percent change).
        nosmooth: Do not smooth the data.
        time_: Variable name for time column variable (e.g. age) in QDEC table.
        generic_time: Time points are ordered in QDEC file, assume\
            time=1,2,3...
        in_label: Use pre-existing label for smoothing and to mask the output.
        jac: Use this flag when mapping area or volume maps to correct Jacobian.
        name_avg: Filename (without hemi ?h) to store temporal average.
        name_rate: Filename (without hemi ?h) to store rate.
        name_pc1fit: Filename (without hemi ?h) to store percent change fit.
        name_pc1: Filename (without hemi ?h) to store percent change.
        name_spc: Filename (without hemi ?h) to store symmetrized percent\
            change.
        name_resid: Filename (without hemi ?h) to store residual.
        out_stack: Filename to store stacked measure file.
        out_label: Filename to store within-subject intersected cortex labels.
        isec_labels: Intersect labels on <qtarget> (usually cortex labels).
        stack_avg: Output stacked avg maps on <qtarget>.
        stack_rate: Output stacked rate maps on <qtarget>.
        stack_pc1fit: Output stacked PC1FIT maps on <qtarget>.
        stack_pc1: Output stacked PC1 maps on <qtarget>.
        stack_spc: Output stacked SPC maps on <qtarget>.
        stack_resid: Output stacked residual maps on <qtarget>.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `LongMrisSlopesOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(LONG_MRIS_SLOPES_METADATA)
    cargs = []
    cargs.append("long_mris_slopes")
    cargs.extend([
        "--qdec",
        execution.input_file(qdec)
    ])
    cargs.extend([
        "--meas",
        meas
    ])
    cargs.extend([
        "--hemi",
        hemi
    ])
    cargs.extend([
        "--sd",
        sd
    ])
    if do_avg:
        cargs.append("--do-avg")
    if do_rate:
        cargs.append("--do-rate")
    if do_pc1fit:
        cargs.append("--do-pc1fit")
    if do_pc1:
        cargs.append("--do-pc1")
    if do_spc:
        cargs.append("--do-spc")
    if do_stack:
        cargs.append("--do-stack")
    if do_label:
        cargs.append("--do-label")
    if qcache is not None:
        cargs.extend([
            "--qcache",
            qcache
        ])
    if resid is not None:
        cargs.extend([
            "--resid",
            resid
        ])
    if fwhm is not None:
        cargs.extend([
            "--fwhm",
            fwhm
        ])
    if nosmooth:
        cargs.append("--nosmooth")
    if time_ is not None:
        cargs.extend([
            "--time",
            time_
        ])
    if generic_time:
        cargs.append("--generic-time")
    if in_label is not None:
        cargs.extend([
            "--in-label",
            in_label
        ])
    if jac:
        cargs.append("--jac")
    if name_avg is not None:
        cargs.extend([
            "--name-avg",
            name_avg
        ])
    if name_rate is not None:
        cargs.extend([
            "--name-rate",
            name_rate
        ])
    if name_pc1fit is not None:
        cargs.extend([
            "--name-pc1fit",
            name_pc1fit
        ])
    if name_pc1 is not None:
        cargs.extend([
            "--name-pc1",
            name_pc1
        ])
    if name_spc is not None:
        cargs.extend([
            "--name-spc",
            name_spc
        ])
    if name_resid is not None:
        cargs.extend([
            "--name-resid",
            name_resid
        ])
    if out_stack is not None:
        cargs.extend([
            "--out-stack",
            out_stack
        ])
    if out_label is not None:
        cargs.extend([
            "--out-label",
            out_label
        ])
    if isec_labels is not None:
        cargs.extend([
            "--isec-labels",
            isec_labels
        ])
    if stack_avg is not None:
        cargs.extend([
            "--stack-avg",
            stack_avg
        ])
    if stack_rate is not None:
        cargs.extend([
            "--stack-rate",
            stack_rate
        ])
    if stack_pc1fit is not None:
        cargs.extend([
            "--stack-pc1fit",
            stack_pc1fit
        ])
    if stack_pc1 is not None:
        cargs.extend([
            "--stack-pc1",
            stack_pc1
        ])
    if stack_spc is not None:
        cargs.extend([
            "--stack-spc",
            stack_spc
        ])
    if stack_resid is not None:
        cargs.extend([
            "--stack-resid",
            stack_resid
        ])
    ret = LongMrisSlopesOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "LONG_MRIS_SLOPES_METADATA",
    "LongMrisSlopesOutputs",
    "long_mris_slopes",
]
