WPOCT Software Developer's Kit (SDK)
SDK For using Wasatch Photonics OCT Spectrometers
MovingAverage.h
Go to the documentation of this file.
1 
6 #pragma once
7 #include <atomic>
8 #include "SameSizeBuffers.h"
9 #include <boost/thread/mutex.hpp>
10 #include <boost/signals2.hpp>
11 
12 // Forward declarations
13 class ScanProcessor;
14 
17 {
18 public:
19  // Constructor
20  MovingAverage(ScanProcessor* scanProcessor);
21 
22  // Getters for displaying a moving average.
23  bool Enabled () { return _enabled; }
24  int GetWindowSize () { return _windowSize; }
25 
26  // Setters for displaying a moving average.
27  bool SetEnabled (bool value);
28  bool SetWindowSize (int value);
29  bool Reset ();
30  int CalcMovingAverage (float*& inOutData);
31 
32  virtual void OnWidthHeightChanged (int width, int height);
33 
34 private:
35  boost::mutex _mutex;
36  boost::signals2::connection _widthHeightConnection;
37 
38  std::atomic<int> _width;
39  std::atomic<int> _height;
40 
41  std::atomic<bool> _enabled;
42  std::atomic<bool> _reset;
43 
44  std::atomic<int> _windowSize;
45  std::atomic<int> _numFilledBuffers;
46 
49  SameSizeBuffers<float, float> _outputDataBuffers;
50 
51  void Init();
52  bool ResizeBuffers ();
53  void ResetOutputDataBuffers ();
54 };
Interface of SameSizeBuffers class.
Class for calculating a moving average. The window size is configurable.
Definition: MovingAverage.h:17
Class that processes scans.
Definition: ScanProcessor.h:32