IMP  2.0.0
The Integrative Modeling Platform
FFToperations.h
Go to the documentation of this file.
1 /*!
2  * \file FFToperations.h
3  * \brief Operations involving FFT
4  * Copyright 2007-2013 IMP Inventors. All rights reserved.
5 */
6 
7 #ifndef IMPEM2D_FF_TOPERATIONS_H
8 #define IMPEM2D_FF_TOPERATIONS_H
9 
10 #include "IMP/em2d/em2d_config.h"
12 
13 IMPEM2D_BEGIN_NAMESPACE
14 
15 
16 /**
17  * Transforms a matrix as is given by FFT functions, into a image
18  * interpretation. Works the opposite way too.
19  * @param m The matrix to flip. The it is changed in situ
20  */
21 IMPEM2DEXPORT void do_matrix_to_image_flip(cv::Mat &m);
22 
23 
24 
25 
26 //! Autocorrelation without preprocessing
27 /*!
28  \param[in] M matrix containing the dft
29  \param[out] corr the matrix to store the autocorrelation. Must have the
30  proper dimensions when passed
31 */
32 /**
33  * Autocorrelation without preprocessing.
34  * @param M matrix containing the dft
35  * @param corr The matrix to store the autocorrelation. Must have the
36  * proper dimensions when passed.
37  */
39  const cv::Mat &M, cv::Mat &corr);
40 
41 /**
42  * Computes the autocorrelation matrix
43  * @param m The input matrix
44  * @param corr The result matrix containing the autocorrelation
45  */
46 IMPEM2DEXPORT void get_autocorrelation2d(const cv::Mat &m, cv::Mat &corr);
47 
48 
49 //! Correlation matrix between two 2D matrices using FFT
50 /*!
51  \param[in] A first matrix
52  \param[in] B second matrix
53  \param[out] corr matrix of results
54 */
55 IMPEM2DEXPORT void get_correlation2d(const cv::Mat &A,
56  const cv::Mat &B, cv::Mat &corr);
57 
58 
59 //! Correlation without preprocessing
60 //! Returns the correlation matrix between two 2D matrices using FFT
61 /*!
62  \param[in] M1 matrix containing the dft of the first matrix
63  \param[in] M2 matrix containing the dft of the second matrix
64  \param[out] corr matrix of results (It MUST have the right size in advance)
65 */
66 IMPEM2DEXPORT void get_correlation2d_no_preprocessing(const cv::Mat &M1,
67  const cv::Mat &M2, cv::Mat &corr);
68 
69 
70 /**
71  * Get the FFT of a matrix using padding with other matrix that can be
72  * computed with FFT in an optimal way. i.e. with a size that makes the
73  * FFT algorithm work faster
74  * @param m The input matrix
75  * @param M The output matrix with the FFT
76  * @note The output matrix can have (and frequently will have) different
77  * dimensions than the input matrix
78  */
79 IMPEM2DEXPORT void get_fft_using_optimal_size(const cv::Mat &m,cv::Mat &M);
80 
81 /**
82  * Computes the fft of a matrix and returns the real and imaginary matrices
83  * @param m The input matrix
84  * @param real The matrix with the real part of the FFT matrix
85  * @param imag The imaginary part of the FFT matrix
86  */
87 IMPEM2DEXPORT void get_spectrum(const cv::Mat &m, cv::Mat &real,cv::Mat &imag);
88 
89 
90 IMPEM2D_END_NAMESPACE
91 
92 #endif /* IMPEM2D_FF_TOPERATIONS_H */