I am performing a project with ITK for processing medical images. After a lot of work there is no further compilation errors, but in the linking process I am having the following info :
1>------Generation started: proyect: prueba_r01, configuration: Debug Win32 ------ 1>Linking… 1>Creating library C:\Documents and Settings\GTTS\Mis documentos\Visual Studio 2008\Projects\prueba_r01\Debug\prueba_r01.lib and object C:\Documents and Settings\GTTS\Mis documentos\Visual Studio 2008\Projects\prueba_r01\Debug\prueba_r01.exp
1>prueba_r01.obj : error LNK2019: extern symbol "public: double (* __thiscall prueba_r01::multiply_matrix_2D(double ()[2],double ()[2],int,int))[2]" (?multiply_matrix_2D@prueba_r01@@QAEPAY01NPAY01N0HH@Z) unresolved which is referenced in the function "private: void __thiscall prueba_r01::filtro(void)" (?filtro@prueba_r01@@AAEXXZ)
1>C:\Documents and Settings\GTTS\Mis documentos\Visual Studio 2008\Projects\prueba_r01\Debug\prueba_r01.exe : fatal error LNK1120: 1 externos sin resolver
1>prueba_r01 - 2 errors, 0 warnings ========== Generar: 0 corrects, 1 incorrects, 0 actualized, 0 omited ==========
The method multiply_matrix_2D produces the error when is called inside the private slot “filtro()” (translated as filter) The header of the file is :
#include <QtGui/QMainWindow>
#include "ui_prueba_r01.h"
#include "vicdef.h"
#include "itkImage.h"
#include "math.h"
#include <complex>
#include "fftw3.h"
using namespace std;
#define PI 3.14159265
class prueba_r01 : public QMainWindow
{
Q_OBJECT
public:
typedef double PixelType;
typedef itk::Image < PixelType, 2> ImageType;
ImageType::Pointer imagen;
double** H;
prueba_r01(QWidget *parent = 0, Qt::WFlags flags = 0);
~prueba_r01();
void matrix2D_H(int ancho, int alto, double eta, double sigma);
fftw_complex* multiply_matrix_2D(fftw_complex* out, fftw_complex* H,int a, int b);
private slots:
void openRGB();
void filtro();
private:
Ui::prueba_r01Class ui;
};
#endif // PRUEBA_R01_H
And the main part where the problem is located is in the .cpp file and is displayed here:
fftw_complex* res ;
res = (fftw_complex*) fftw_malloc(sizeof(fftw_complex)*a*b);
fftw_complex* H_casted= reinterpret_cast<fftw_complex*> (&H);
res = multiply_matrix_2D(out,H_casted, a, b);
The process of casting a **double pointer to *fftw_complex is done here, because I want to multiply a filter in frequency domain (H(w)) with the result of the fft transform of an image, that’s the reason. Is important to remark that fftw_complex is double[2], the first row for the real part, and the second for the imaginary And the problematic method is shown below:
fftw_complex* multiply_matrix_2D(fftw_complex* out, fftw_complex* H, int a ,int b){
/* The matrix out[axb] or [n0x(n1/2)+1] is the image after the FFT , and the out_H[axb] is the filter in the frequency domain,
both are multiplied POINT TO POINT, it has to be called twice, one for the imaginary part and another for the normal part
*/
fftw_complex *res;
res = (fftw_complex*) fftw_malloc(sizeof(fftw_complex)*a*b);
for (int i0 = 0; i0<a ; i0++){
for (int i1 = 0; i1<b ; i1++){
res[i1+a*i0][0] = out[i1+a*i0][0]*(H[0][0]+H[0][1]); // real part
res[i1+a*i0][1] = out[i1+a*i0][1]*(H[0][0]+H[0][1]); // imaginary part
}
}
return res;
}
Any help will be really nice!! I’m quite lost now… Thanks! Gracias! Antonio