WPOCT Software Developer's Kit (SDK)
SDK For using Wasatch Photonics OCT Spectrometers
Averager.h
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include "OCTTypeDefs.h"
9 #include <boost/signals2.hpp>
10 #include <boost/bind.hpp>
11 #include <mutex>
12 
13 // Forward class declarations.
14 class ScanProcessor;
15 
16 class Averager
17 {
18 public:
19  Averager(ScanProcessor* scanProcessor);
20  virtual ~Averager();
21 
22  // Getters
23  bool VerticalAveragingBeingUsed () const
24  { return _useVerticalAveraging && _verticalAveragingFactor > 1; }
25 
26  bool BoxcarAveragingBeingUsed () const
27  { return _useBoxcar && _boxcarFactor > 1; }
28 
29  int GetZFactor () const { return _zFactor; }
30 
31  static bool LateralAveragingBeingUsed ()
32  { return _lateralAveragingFactor > 1; }
33 
34  static int GetNumAverages () { return _lateralAveragingFactor; }
35 
36  // Setters
37  void SetZFactor (int value) { _zFactor = value; }
38 
39  static bool SetNumAverages (int value) { _lateralAveragingFactor = value; return true; }
40 
41  virtual void InitGPUMethods (int programIndex) { }
42  virtual void OnWidthHeightChanged (int width, int height);
43 
44  virtual int VerticalOversampleReal (float factor) { return 0; }
45  virtual int LateralOversampleReal () { return 0; }
46  virtual int BoxcarAverage (float factor) { return 0; }
47 
48  void InitPadSize (int padW, int padH) { }
49  void ReleaseAvgMemory () { }
50 
51  int PadImage (unsigned short *origImage, int imgW, int ingH, double *&outData,
52  int outW, int outH) { return 0; }
53  int PadImage (unsigned short *origImage, int imgW, int ingH, float *&outData,
54  int outW, int outH) { return 0; }
55  int PadImage (double *origImage, int imgW, int imgH, double *&outData,
56  int outW, int outH) { return 0; }
57  int PadImage (float *origImage, int imgW, int imgH, float *&outData,
58  int outW, int outH) { return 0; }
59 
60  int SetPadImage (double *&B, int bw, int bh) { return 0; }
61  int SetPadBuffer (double *&B, int bw, int bh) { return 0; }
62  int GetPadImage (double *&B, int bw, int bh) { return 0; }
63  int GetPadBuffer (double *&B, int bw, int bh) { return 0; }
64 
65  int LocalSum (double *&B, int bw, int bh, int cw, int ch) { return 0; }
66 
67 protected:
68  ScanProcessor* _scanProcessor;
69  bool _initialized;
70 
71  bool _useBoxcar;
72  bool _useLateralAveraging;
73  bool _useVerticalAveraging;
74 
75  int _boxcarFactor;
76  int _verticalAveragingFactor;
77 
78  int _zFactor;
79 
80  static std::mutex _mutexLateral;
81  static int _lateralAveragingFactor;
82 
83  virtual void InitStorage ();
84  virtual void ReleaseStorage ();
85 
86 private:
87  boost::signals2::connection _widthHeightConnection;
88 
89  // Methods
90  void Init ();
91 };
typedefs used across UtensilConverter
Definition: Averager.h:17
Class that processes scans.
Definition: ScanProcessor.h:32