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

import typing
import pathlib
from styxdefs import *
import dataclasses

V_3D_TSHIFT_METADATA = Metadata(
    id="1e963c8aacff12ed5089324cd001cc9158093823.boutiques",
    name="3dTshift",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


class V3dTshiftOutputs(typing.NamedTuple):
    """
    Output object returned when calling `v_3d_tshift(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    out_file: OutputPathType | None
    """Output image file name."""
    timing_file: OutputPathType
    """Afni formatted timing file, if ``slice_timing`` is a list."""


def v_3d_tshift(
    in_file: InputPathType,
    prefix: str | None = None,
    ignore: int | None = None,
    interp: typing.Literal["Fourier", "linear", "cubic", "quintic", "heptic"] | None = None,
    num_threads: int | None = None,
    outputtype: typing.Literal["NIFTI", "AFNI", "NIFTI_GZ"] | None = None,
    rlt: bool = False,
    rltplus: bool = False,
    slice_encoding_direction: typing.Literal["k", "k-"] | None = None,
    tpattern: typing.Literal["alt+z", "altplus", "alt+z2", "alt-z", "altminus", "alt-z2", "seq+z", "seqplus", "seq-z", "seqminus"] | None = None,
    tr: float | None = None,
    tslice: int | None = None,
    tzero: float | None = None,
    runner: Runner | None = None,
) -> V3dTshiftOutputs:
    """
    Shifts voxel time series from input so that separate slices are aligned to the
    same temporal origin.
    
    Author: AFNI Developers
    
    URL: https://afni.nimh.nih.gov/
    
    Args:
        in_file: Input file to 3dtshift.
        prefix: Prefix for output image file name.
        ignore: Ignore the first set of points specified.
        interp: 'fourier' or 'linear' or 'cubic' or 'quintic' or 'heptic'.\
            Different interpolation methods (see 3dtshift for details) default =\
            fourier.
        num_threads: Set number of threads.
        outputtype: 'nifti' or 'afni' or 'nifti_gz'. Afni output filetype.
        rlt: Before shifting, remove the mean and linear trend.
        rltplus: Before shifting, remove the mean and linear trend and later\
            put back the mean.
        slice_encoding_direction: 'k' or 'k-'. Direction in which slice_timing\
            is specified (default: k). if negative,slice_timing is defined in\
            reverse order, that is, the first entry corresponds to the slice with\
            the largest index, and the final entry corresponds to slice index zero.\
            only in effect when slice_timing is passed as list, not when it is\
            passed as file.
        tpattern: 'alt+z' or 'altplus' or 'alt+z2' or 'alt-z' or 'altminus' or\
            'alt-z2' or 'seq+z' or 'seqplus' or 'seq-z' or 'seqminus' or a string.\
            Use specified slice time pattern rather than one in header.
        tr: Manually set the tr. you can attach suffix "s" for seconds or "ms"\
            for milliseconds.
        tslice: Align each slice to time offset of given slice.
        tzero: Align each slice to given time offset.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `V3dTshiftOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(V_3D_TSHIFT_METADATA)
    cargs = []
    cargs.append("3dTshift")
    if prefix is not None:
        cargs.extend([
            "-prefix",
            prefix
        ])
    if ignore is not None:
        cargs.extend([
            "-ignore",
            str(ignore)
        ])
    cargs.append(execution.input_file(in_file))
    if interp is not None:
        cargs.extend([
            "-",
            interp
        ])
    if num_threads is not None:
        cargs.append(str(num_threads))
    if outputtype is not None:
        cargs.append(outputtype)
    if rlt:
        cargs.append("-rlt")
    if rltplus:
        cargs.append("-rlt+")
    if slice_encoding_direction is not None:
        cargs.append(slice_encoding_direction)
    if tpattern is not None:
        cargs.extend([
            "-tpattern",
            tpattern
        ])
    if tr is not None:
        cargs.extend([
            "-TR",
            str(tr)
        ])
    if tslice is not None:
        cargs.extend([
            "-slice",
            str(tslice)
        ])
    if tzero is not None:
        cargs.extend([
            "-tzero",
            str(tzero)
        ])
    ret = V3dTshiftOutputs(
        root=execution.output_file("."),
        out_file=execution.output_file(prefix) if (prefix is not None) else None,
        timing_file=execution.output_file("timing_file"),
    )
    execution.run(cargs)
    return ret


__all__ = [
    "V3dTshiftOutputs",
    "V_3D_TSHIFT_METADATA",
    "v_3d_tshift",
]
