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

import typing
import pathlib
from styxdefs import *
import dataclasses

V_3D_FFT_METADATA = Metadata(
    id="346ceaa099cde8147ff4ea8529349b8671ac8691.boutiques",
    name="3dFFT",
    package="afni",
    container_image_tag="afni/afni_make_build:AFNI_24.2.06",
)


class V3dFftOutputs(typing.NamedTuple):
    """
    Output object returned when calling `v_3d_fft(...)`.
    """
    root: OutputPathType
    """Output root folder. This is the root folder for all outputs."""
    output_dataset: OutputPathType | None
    """Output dataset generated by 3dFFT."""


def v_3d_fft(
    dataset: InputPathType,
    abs_: bool = False,
    phase: bool = False,
    complex_: bool = False,
    inverse: bool = False,
    lx: float | None = None,
    ly: float | None = None,
    lz: float | None = None,
    alt_in: bool = False,
    alt_out: bool = False,
    input_: InputPathType | None = None,
    prefix: str | None = None,
    runner: Runner | None = None,
) -> V3dFftOutputs:
    """
    Performs the FFT of the input dataset in 3 directions (x, y, z) and produces the
    output dataset.
    
    Author: AFNI Developers
    
    URL: https://afni.nimh.nih.gov/
    
    Args:
        dataset: Input dataset (e.g., dataset.nii).
        abs_: Outputs the magnitude of the FFT (default).
        phase: Outputs the phase of the FFT (-PI..PI).
        complex_: Outputs the complex-valued FFT.
        inverse: Does the inverse FFT instead of the forward FFT.
        lx: Use FFT of length 'xx' in the x-direction.
        ly: Use FFT of length 'yy' in the y-direction.
        lz: Use FFT of length 'zz' in the z-direction.
        alt_in: Alternate signs of input data before FFT to bring zero\
            frequency from edge of FFT-space to center of grid for cosmetic\
            purposes.
        alt_out: Alternate signs of output data after FFT. Use '-altOUT' with\
            '-altIN' on the forward transform to get the signs of the recovered\
            image correct.
        input_: Read the input dataset from specified file instead of from the\
            last argument on the command line.
        prefix: Use specified prefix for the output dataset.
        runner: Command runner.
    Returns:
        NamedTuple of outputs (described in `V3dFftOutputs`).
    """
    runner = runner or get_global_runner()
    execution = runner.start_execution(V_3D_FFT_METADATA)
    cargs = []
    cargs.append("3dFFT")
    cargs.append(execution.input_file(dataset))
    if abs_:
        cargs.append("--abs")
    if phase:
        cargs.append("--phase")
    if complex_:
        cargs.append("--complex")
    if inverse:
        cargs.append("--inverse")
    if lx is not None:
        cargs.extend([
            "--Lx",
            str(lx)
        ])
    if ly is not None:
        cargs.extend([
            "--Ly",
            str(ly)
        ])
    if lz is not None:
        cargs.extend([
            "--Lz",
            str(lz)
        ])
    if alt_in:
        cargs.append("--altIN")
    if alt_out:
        cargs.append("--altOUT")
    if input_ is not None:
        cargs.extend([
            "--input",
            execution.input_file(input_)
        ])
    if prefix is not None:
        cargs.extend([
            "--prefix",
            prefix
        ])
    ret = V3dFftOutputs(
        root=execution.output_file("."),
        output_dataset=execution.output_file(prefix + ".nii.gz") if (prefix is not None) else None,
    )
    execution.run(cargs)
    return ret


__all__ = [
    "V3dFftOutputs",
    "V_3D_FFT_METADATA",
    "v_3d_fft",
]
