UsTK : Ultrasound ToolKit  version 2.0.1 under development (2023-12-07)
usRFToPreScan2DConverter.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
30  * Marc Pouliquen
31  *
32  *****************************************************************************/
33 
39 #ifndef __usRFToPreScan2DConverter_h_
40 #define __usRFToPreScan2DConverter_h_
41 
42 #include <visp3/ustk_core/usConfig.h>
43 
44 #if defined(USTK_HAVE_FFTW)
45 // external includes
46 #include <fftw3.h>
47 
48 // std includes
49 #include <cmath>
50 #include <complex>
51 #include <vector>
52 
53 // visp/ustk includes
54 #include <visp3/ustk_core/usImagePreScan2D.h>
55 #include <visp3/ustk_core/usImageRF2D.h>
56 #include <visp3/ustk_core/usLogCompressor.h>
57 
100 class VISP_EXPORT usRFToPreScan2DConverter
101 {
103 
104 public:
105  usRFToPreScan2DConverter(int decimationFactor = 10);
106 
108 
109  void convert(const usImageRF2D<short int> &rfImage, usImagePreScan2D<unsigned char> &preScanImage);
110 
111  int getDecimationFactor();
112 
113  void setDecimationFactor(int decimationFactor);
114 
115 private:
116  void init(int widthRF, int heigthRF);
117  void enveloppeDetection(const short *s, double *out);
118 
119  usLogCompressor m_logCompressor;
120 
121  int m_decimationFactor;
122 
123  fftw_complex *m_fft_in, *m_fft_out, *m_fft_conv, *m_fft_out_inv;
124  fftw_plan m_p, m_pinv;
125 
126  double *m_env;
127  unsigned char *m_comp;
128 
129  int m_signalSize;
130  int m_scanLineNumber;
131 
132  bool m_isInit;
133 };
134 
135 #endif // USTK_HAVE_FFTW
136 #endif // __usRFToPreScan2DConverter_h_
Log-compression filter.
2D conversion from RF signal to pre-scan image
3D conversion from RF signal to pre-scan image
void init(int heightRF, int widthRF, int frameNumber)
void setDecimationFactor(int decimationFactor)
void convert(const usImageRF3D< short int > &rfImage, usImagePreScan3D< unsigned char > &preScanImage)