ComputationalRadiationPhysics / liFFT

library for Library-independent FFTs
GNU Lesser General Public License v3.0
7 stars 6 forks source link

libLiFFT

library for Library-independent FFTs

Build Status codecov.io

This library contains a generic FFT interface that relies on C++11 features and template metaprogramming to do lots of compile time checks on the validity of the input. It also dynamically compiles only the used library code, which makes it possible to include libraries headers that are not installed on the system, as those are not used in that case. The currently implemented libraries are:

  1. FFTW
  2. CuFFT

For convenience it also contains a generic interface on top of libTIFF to read and write to the following sorts of Tiff images:

  1. 24Bit RGB
  2. 32Bit ARGB
  3. Single and double precision floating point (monochrome)

Almost all possible formats are converted to floating point or 32Bit ARGB images during loading. This allows importing and exporting files from analytic tools and image editors like jImage.

Software License

libLiFFT is licensed under LGPLv3 or later.

Namespace organization

All FFT related classes and methods are under the LiFFT namespace, the tiffWriter interface classes are under the tiffWriter namespace. The folder structure matches the namespace organization with the include folder being the top directory.

Examples

There are a couple of example applications that can be used as a reference for implementing own applications. All of them are in a separate folder:

Quickstart

A good example is the code from fftTiffImg:

void
do2D_FFT(const string& inFilePath, const string& outFilePath)
{
    using namespace LiFFT;
    using FFT = FFT_2D_R2C_F<>;
    auto input = FFT::wrapInput(tiffWriter::FloatImage<>(inFilePath, false));
    auto output = FFT::createNewOutput(input);
    auto fft = makeFFT<FFT_LIB, false>(input, output);
    input.getBase().load();
    fft(input, output);
    tiffWriter::FloatImage<> outImg(outFilePath, input.getBase().getWidth(), input.getBase().getHeight());
    auto fullOutput = types::makeSymmetricWrapper(output, input.getExtents()[1]);
    auto transformAcc = accessors::makeTransposeAccessor(
                            accessors::makeTransformAccessorFor(policies::CalcIntensityFunc(), fullOutput)
                        );
    policies::copy(fullOutput, outImg, transformAcc);
    outImg.save();
}

Usage notes

Naming convention

In general the following naming convention was used