UsTK : Ultrasound ToolKit  version 2.0.1 under development (2024-05-20)
usConvolution2d.h
1 /****************************************************************************
2  *
3  * This file is part of the ustk software.
4  * Copyright (C) 2016 - 2017 by Inria. All rights reserved.
5  *
6  * This software is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * ("GPL") version 2 as published by the Free Software Foundation.
9  * See the file LICENSE.txt at the root directory of this source
10  * distribution for additional information about the GNU GPL.
11  *
12  * For using ustk with software that can not be combined with the GNU
13  * GPL, please contact Inria about acquiring a ViSP Professional
14  * Edition License.
15  *
16  * This software was developed at:
17  * Inria Rennes - Bretagne Atlantique
18  * Campus Universitaire de Beaulieu
19  * 35042 Rennes Cedex
20  * France
21  *
22  * If you have questions regarding the use of this file, please contact
23  * Inria at ustk@inria.fr
24  *
25  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
26  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27  *
28  * Authors:
29  * Pedro Patlan Rosales
30  * Marc Pouliquen
31  *
32  *****************************************************************************/
33 
39 #ifndef __usConvolution2d_h_
40 #define __usConvolution2d_h_
41 
42 #include <visp3/ustk_core/usConfig.h>
43 
44 #if defined(USTK_HAVE_FFTW)
45 
46 #include <fftw3.h>
47 #include <visp/vpMath.h>
48 #include <visp/vpMatrix.h>
49 
57 class VISP_EXPORT usConvolution2d
58 {
59 public:
61  virtual ~usConvolution2d();
62  void init(const vpMatrix &matrix1, const vpMatrix &matrix2);
63  vpMatrix run(const vpMatrix &matrix1, const vpMatrix &matrix2);
64 
65 private:
66  fftw_complex *outa;
67  fftw_complex *outb;
68  fftw_complex *outc;
69  fftw_complex *out;
70  fftw_complex *ad;
71  fftw_complex *bd;
72  fftw_plan p1;
73  fftw_plan p2;
74  fftw_plan p3;
75 
76  bool m_init;
77 
78  vpMatrix m_M1;
79  vpMatrix m_M2;
80  vpMatrix m_R;
81  unsigned int h_dst;
82  unsigned int w_dst;
83  unsigned int hf;
84  unsigned int wf;
85  unsigned int Am; // A row number
86  unsigned int An; // A col number
87  unsigned int Bm; // B row number
88  unsigned int Bn; // B col number
89 
90  void padding_zeros(void);
91 };
92 
93 #endif // USTK_HAVE_FFTW
94 #endif // __usConvolution2d_h_
Convolution process for elastography puropse, based on fftw thirdparty library.