/
HMMStateUpdator.h
73 lines (52 loc) · 1.75 KB
/
HMMStateUpdator.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
* HMMStateUpdatorThread
*
* reclassifies dataset<> classification field using K-Means and HMM model
*/
#ifndef HMMStateUpdator_h
#define HMMStateUpdator_h
//#include <dinrhiw/dinrhiw.h>
#include <dinrhiw.h>
#include <thread>
#include <mutex>
namespace whiteice {
namespace resonanz {
class HMMStateUpdatorThread
{
public:
HMMStateUpdatorThread(whiteice::KMeans<>* kmeans,
whiteice::HMM* hmm,
whiteice::dataset<>* eegData,
std::vector< whiteice::dataset<> >* pictureData,
std::vector< whiteice::dataset<> >* keywordData,
whiteice::dataset<>* synthData,
whiteice::dataset<>* picsynthData);
~HMMStateUpdatorThread();
bool start();
bool isRunning();
unsigned int getProcessedElements(){
return (processingPicIndex + processingKeyIndex +
processingSynthIndex + processingPicSynthIndex);
}
bool stop();
private:
// does binary search of strictly increasing sequences of eeg_index numbers in
// eegData and returns EEG DATA INDEX value for given eeg_index value
unsigned int find_eegData_index(unsigned int eeg_index);
void updator_loop();
std::mutex thread_mutex;
bool thread_running = false;
std::thread* updator_thread = nullptr;
whiteice::KMeans<>* kmeans;
whiteice::HMM* hmm;
whiteice::dataset<>* eegData;
std::vector< whiteice::dataset<> >* pictureData;
std::vector< whiteice::dataset<> >* keywordData;
whiteice::dataset<>* synthData;
whiteice::dataset<>* picsynthData;
unsigned int processingPicIndex = 0, processingKeyIndex = 0, processingSynthIndex = 0;
unsigned int processingPicSynthIndex = 0;
};
};
};
#endif