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

import typing
import pathlib
from styxdefs import *
import dataclasses

V__RETINO_PROC_METADATA = Metadata(
    id="0836ad099b5ae0ebd794fce9bafc7b29723fb572.boutiques",
    name="@RetinoProc",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


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


def v__retino_proc(
    tr: float,
    period_ecc: float,
    period_pol: float,
    ccw: list[InputPathType] | None = None,
    clw: list[InputPathType] | None = None,
    exp: list[InputPathType] | None = None,
    con: list[InputPathType] | None = None,
    epi_ref: InputPathType | None = None,
    epi_anat_ref: InputPathType | None = None,
    anat_vol: InputPathType | None = None,
    anat_vol_epi: InputPathType | None = None,
    surf_vol: InputPathType | None = None,
    surf_vol_epi: InputPathType | None = None,
    phase: bool = False,
    delay: bool = False,
    pre_ecc: float | None = None,
    pre_pol: float | None = None,
    on_ecc: str | None = None,
    on_pol: str | None = None,
    var_on_ecc: str | None = None,
    var_on_pol: str | None = None,
    nwedges: float | None = None,
    nrings: float | None = None,
    fwhm_pol: float | None = None,
    fwhm_ecc: float | None = None,
    ignore: float | None = None,
    no_tshift: bool = False,
    spec_left: InputPathType | None = None,
    spec_right: InputPathType | None = None,
    dorts: InputPathType | None = None,
    ccw_orts: list[InputPathType] | None = None,
    clw_orts: list[InputPathType] | None = None,
    exp_orts: list[InputPathType] | None = None,
    con_orts: list[InputPathType] | None = None,
    sid: str | None = None,
    out_dir: str | None = None,
    echo: bool = False,
    echo_edu: bool = False,
    a2e_opts: str | None = None,
    aea_opts: str | None = None,
    runner: Runner | None = None,
) -> VRetinoProcOutputs:
    """
    A script to process retinotopic FMRI data, using AFNI's 3dRetinoPhase and
    SurfRetinMap.
    
    Author: AFNI Developers
    
    URL: https://afni.nimh.nih.gov/
    
    Args:
        tr: TR, in seconds, of retinotopic scans.
        period_ecc: Period, in seconds, of eccentricity stimuli.
        period_pol: Period, in seconds, of polar angle stimuli.
        ccw: Input time series dataset for counterclockwise stimulus.
        clw: Input time series dataset for clockwise stimulus.
        exp: Input time series dataset for expanding stimulus.
        con: Input time series dataset for contracting stimulus.
        epi_ref: Specify a volume from the EPI time series to which all EPI\
            volumes are aligned.
        epi_anat_ref: Specify a volume from the EPI time series that is better\
            suited for aligning the T1 to it than EpiRef might be.
        anat_vol: T1 volume acquired during the same session as the retinotopic\
            scans.
        anat_vol_epi: Anatomical volume aligned to EPI reference.
        surf_vol: Surface Volume for the cortical surfaces.
        surf_vol_epi: Surface volume aligned to experiment's EPI data.
        phase: Use phase of fundamental frequency to estimate latency.
        delay: Use delay relative to reference time series to estimate latency.
        pre_ecc: Duration, in seconds, before eccentricity stimulus.
        pre_pol: Duration, in seconds, before polar angle stimulus.
        on_ecc: Number of stimulation blocks and duration of stimulation for\
            eccentricity stimulus.
        on_pol: Number of stimulation blocks and duration of stimulation for\
            polar angle stimulus.
        var_on_ecc: Multiple on durations for eccentricity stimulus.
        var_on_pol: Multiple on durations for polar angle stimulus.
        nwedges: Number of wedges in polar stimulus.
        nrings: Number of rings in eccentricity stimulus.
        fwhm_pol: Target smoothness for polar stimulus.
        fwhm_ecc: Target smoothness for eccentricity stimulus.
        ignore: Ignore volumes from the beginning of each time series.
        no_tshift: Do not correct for slice timing.
        spec_left: Spec file for left hemisphere.
        spec_right: Spec file for right hemisphere.
        dorts: Detrend time series using columns in ORT1D file.
        ccw_orts: Detrend time series for counterclockwise stimulus.
        clw_orts: Detrend time series for clockwise stimulus.
        exp_orts: Detrend time series for expanding stimulus.
        con_orts: Detrend time series for contracting stimulus.
        sid: SID is a flag identifying the subject.
        out_dir: Directory where processing results are to be stored.
        echo: Turn on the command echoing to help with debugging script failure.
        echo_edu: Turn on command echoing for certain programs only.
        a2e_opts: Pass options to @SUMA_AlignToExperiment script.
        aea_opts: Pass options to align_epi_anat.py.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `VRetinoProcOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(V__RETINO_PROC_METADATA)
    cargs = []
    cargs.append("@RetinoProc")
    if ccw is not None:
        cargs.extend([
            "-ccw",
            *[execution.input_file(f) for f in ccw]
        ])
    if clw is not None:
        cargs.extend([
            "-clw",
            *[execution.input_file(f) for f in clw]
        ])
    if exp is not None:
        cargs.extend([
            "-exp",
            *[execution.input_file(f) for f in exp]
        ])
    if con is not None:
        cargs.extend([
            "-con",
            *[execution.input_file(f) for f in con]
        ])
    if epi_ref is not None:
        cargs.extend([
            "-epi_ref",
            execution.input_file(epi_ref)
        ])
    if epi_anat_ref is not None:
        cargs.extend([
            "-epi_anat_ref",
            execution.input_file(epi_anat_ref)
        ])
    if anat_vol is not None:
        cargs.extend([
            "-anat_vol",
            execution.input_file(anat_vol)
        ])
    if anat_vol_epi is not None:
        cargs.extend([
            "-anat_vol@epi",
            execution.input_file(anat_vol_epi)
        ])
    if surf_vol is not None:
        cargs.extend([
            "-surf_vol",
            execution.input_file(surf_vol)
        ])
    if surf_vol_epi is not None:
        cargs.extend([
            "-surf_vol@epi",
            execution.input_file(surf_vol_epi)
        ])
    if phase:
        cargs.append("-phase")
    if delay:
        cargs.append("-delay")
    cargs.extend([
        "-TR",
        str(tr)
    ])
    cargs.extend([
        "-period_ecc",
        str(period_ecc)
    ])
    cargs.extend([
        "-period_pol",
        str(period_pol)
    ])
    if pre_ecc is not None:
        cargs.extend([
            "-pre_ecc",
            str(pre_ecc)
        ])
    if pre_pol is not None:
        cargs.extend([
            "-pre_pol",
            str(pre_pol)
        ])
    if on_ecc is not None:
        cargs.extend([
            "-on_ecc",
            on_ecc
        ])
    if on_pol is not None:
        cargs.extend([
            "-on_pol",
            on_pol
        ])
    if var_on_ecc is not None:
        cargs.extend([
            "-var_on_ecc",
            var_on_ecc
        ])
    if var_on_pol is not None:
        cargs.extend([
            "-var_on_pol",
            var_on_pol
        ])
    if nwedges is not None:
        cargs.extend([
            "-nwedges",
            str(nwedges)
        ])
    if nrings is not None:
        cargs.extend([
            "-nrings",
            str(nrings)
        ])
    if fwhm_pol is not None:
        cargs.extend([
            "-fwhm_pol",
            str(fwhm_pol)
        ])
    if fwhm_ecc is not None:
        cargs.extend([
            "-fwhm_ecc",
            str(fwhm_ecc)
        ])
    if ignore is not None:
        cargs.extend([
            "-ignore",
            str(ignore)
        ])
    if no_tshift:
        cargs.append("-no_tshift")
    if spec_left is not None:
        cargs.extend([
            "-spec_left",
            execution.input_file(spec_left)
        ])
    if spec_right is not None:
        cargs.extend([
            "-spec_right",
            execution.input_file(spec_right)
        ])
    if dorts is not None:
        cargs.extend([
            "-dorts",
            execution.input_file(dorts)
        ])
    if ccw_orts is not None:
        cargs.extend([
            "-ccw_orts",
            *[execution.input_file(f) for f in ccw_orts]
        ])
    if clw_orts is not None:
        cargs.extend([
            "-clw_orts",
            *[execution.input_file(f) for f in clw_orts]
        ])
    if exp_orts is not None:
        cargs.extend([
            "-exp_orts",
            *[execution.input_file(f) for f in exp_orts]
        ])
    if con_orts is not None:
        cargs.extend([
            "-con_orts",
            *[execution.input_file(f) for f in con_orts]
        ])
    if sid is not None:
        cargs.extend([
            "-sid",
            sid
        ])
    if out_dir is not None:
        cargs.extend([
            "-out_dir",
            out_dir
        ])
    if echo:
        cargs.append("-echo")
    if echo_edu:
        cargs.append("-echo_edu")
    if a2e_opts is not None:
        cargs.extend([
            "-A2E_opts",
            a2e_opts
        ])
    if aea_opts is not None:
        cargs.extend([
            "-AEA_opts",
            aea_opts
        ])
    ret = VRetinoProcOutputs(
        root=execution.output_file("."),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "VRetinoProcOutputs",
    "V__RETINO_PROC_METADATA",
    "v__retino_proc",
]
