25 UINT PostProcessing::numPostProcessingInstances = 0;
29 StringPostProcessingMap::iterator iter = getMap()->find( postProcessingType );
30 if( iter == getMap()->end() ){
33 return iter->second();
37 postProcessingType =
"NOT_SET";
38 postProcessingInputMode = INPUT_MODE_NOT_SET;
39 postProcessingOutputMode = OUTPUT_MODE_NOT_SET;
41 numInputDimensions = 0;
42 numOutputDimensions = 0;
43 numPostProcessingInstances++;
47 if( --numPostProcessingInstances == 0 ){
48 delete stringPostProcessingMap;
49 stringPostProcessingMap = NULL;
55 if( postProcessingModule == NULL ){
56 errorLog <<
"copyBaseVariables(const PostProcessing *postProcessingModule) - postProcessingModule pointer is NULL!" << endl;
64 this->postProcessingType = postProcessingModule->postProcessingType;
65 this->postProcessingInputMode = postProcessingModule->postProcessingInputMode;
66 this->postProcessingOutputMode = postProcessingModule->postProcessingOutputMode;
67 this->initialized = postProcessingModule->initialized;
68 this->numInputDimensions = postProcessingModule->numInputDimensions;
69 this->numOutputDimensions = postProcessingModule->numOutputDimensions;
70 this->processedData = postProcessingModule->processedData;
71 this->debugLog = postProcessingModule->debugLog;
72 this->errorLog = postProcessingModule->errorLog;
73 this->warningLog = postProcessingModule->warningLog;
79 if( numOutputDimensions == 0 ){
80 errorLog <<
"init() - Failed to init module, the number of output dimensions is zero!" << endl;
86 processedData.resize( numOutputDimensions );
97 file.open(filename.c_str(), std::ios::out);
111 file.open(filename.c_str(), std::ios::in);
125 if( !file.is_open() ){
126 errorLog <<
"savePostProcessingSettingsToFile(fstream &file) - The file is not open!" << endl;
132 file <<
"Initialized: " << initialized << endl;
139 if( !file.is_open() ){
140 errorLog <<
"loadPostProcessingSettingsFromFile(fstream &file) - The file is not open!" << endl;
153 if( word !=
"Initialized:" ){
154 errorLog <<
"loadPostProcessingSettingsFromFile(fstream &file) - Failed to read Initialized header!" << endl;
173 return postProcessingType;
177 return postProcessingInputMode;
181 return postProcessingOutputMode;
185 return numInputDimensions;
189 return numOutputDimensions;
197 return postProcessingInputMode==INPUT_MODE_PREDICTED_CLASS_LABEL;
201 return postProcessingInputMode==INPUT_MODE_CLASS_LIKELIHOODS;
205 return postProcessingOutputMode==OUTPUT_MODE_PREDICTED_CLASS_LABEL;
209 return postProcessingOutputMode==OUTPUT_MODE_CLASS_LIKELIHOODS;
213 return processedData;
bool getInitialized() const
UINT getPostProcessingOutputMode() const
virtual bool loadModelFromFile(string filename)
string getPostProcessingType() const
bool loadBaseSettingsFromFile(fstream &file)
bool savePostProcessingSettingsToFile(fstream &file) const
bool saveBaseSettingsToFile(fstream &file) const
virtual ~PostProcessing(void)
bool getIsPostProcessingOutputModePredictedClassLabel() const
VectorDouble getProcessedData() const
bool getIsPostProcessingInputModePredictedClassLabel() const
bool getIsPostProcessingOutputModeClassLikelihoods() const
bool getIsPostProcessingInputModeClassLikelihoods() const
bool loadPostProcessingSettingsFromFile(fstream &file)
bool copyGRTBaseVariables(const GRTBase *GRTBase)
static PostProcessing * createInstanceFromString(string const &postProcessingType)
UINT getNumOutputDimensions() const
This is the main base class that all GRT PostProcessing algorithms should inherit from...
UINT getNumInputDimensions() const
PostProcessing * createNewInstance() const
virtual bool saveModelToFile(string filename) const
bool copyBaseVariables(const PostProcessing *postProcessingModule)
UINT getPostProcessingInputMode() const
std::map< string, PostProcessing *(*)() > StringPostProcessingMap