Copyright (c) 2004, Sylvain Paris and Francois Sillion All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of ARTIS, GRAVIR-IMAG nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Source code can be downloaded from Sylvain Paris' page.
Provides the framework to define 2D functions. The interface targets filtering based on convolution. For that purpose, it can be used with the FFT module available here.
The coumpound list gives a good overview of the available functions.
Here is an example of a typical use using the 2D array defined in the basic tools.
// Create a normalized Gaussian function centered on (0,0) // with standard deviations sigma_x=1 and sigma_y=2 // and rotated of 45 degrees. Function_2D::Normalized_gaussian gaussian(0,0,1.0,2.0,M_PI/4); // Create an array 201 by 101 to store the Gaussian values between // x in [-100..+100], y in [-50..+50]. Array_2D<real_type> array(201,101); // Actually fill the array with the Gaussian values. Function_2D::fill(gaussian,&array);
Note that this module works well with the FFT module. For instance, using the previous code, the Fourier transform can be straightforwardly computed with:
// FFT initialization FFT::Support::set_wisdom_file("wisdom.fftw"); FFT::Support support(gaussian.x_size(),gaussian.y_size()); // Store f data in the fftw structures. support.load_space_data(gaussian); // Compute the FFT. support.space_to_frequency(); // Create an array of complex values. Array_2D<FFT::Support::complex_type> complex_array; // Retrieve the complex data. support.save_frequency_data(&complex_array);