26 UINT PostProcessing::numPostProcessingInstances = 0;
30 StringPostProcessingMap::iterator iter = getMap()->find( postProcessingType );
31 if( iter == getMap()->end() ){
34 return iter->second();
38 postProcessingType =
"NOT_SET";
39 postProcessingInputMode = INPUT_MODE_NOT_SET;
40 postProcessingOutputMode = OUTPUT_MODE_NOT_SET;
42 numInputDimensions = 0;
43 numOutputDimensions = 0;
44 numPostProcessingInstances++;
48 if( --numPostProcessingInstances == 0 ){
49 delete stringPostProcessingMap;
50 stringPostProcessingMap = NULL;
56 if( postProcessingModule == NULL ){
57 errorLog <<
"copyBaseVariables(const PostProcessing *postProcessingModule) - postProcessingModule pointer is NULL!" << std::endl;
65 this->postProcessingType = postProcessingModule->postProcessingType;
66 this->postProcessingInputMode = postProcessingModule->postProcessingInputMode;
67 this->postProcessingOutputMode = postProcessingModule->postProcessingOutputMode;
68 this->initialized = postProcessingModule->initialized;
69 this->numInputDimensions = postProcessingModule->numInputDimensions;
70 this->numOutputDimensions = postProcessingModule->numOutputDimensions;
71 this->processedData = postProcessingModule->processedData;
72 this->debugLog = postProcessingModule->debugLog;
73 this->errorLog = postProcessingModule->errorLog;
74 this->warningLog = postProcessingModule->warningLog;
80 if( numOutputDimensions == 0 ){
81 errorLog <<
"init() - Failed to init module, the number of output dimensions is zero!" << std::endl;
87 processedData.
resize( numOutputDimensions );
98 file.open(filename.c_str(), std::ios::out);
112 file.open(filename.c_str(), std::ios::in);
126 if( !file.is_open() ){
127 errorLog <<
"savePostProcessingSettingsToFile(fstream &file) - The file is not open!" << std::endl;
133 file <<
"Initialized: " << initialized << std::endl;
140 if( !file.is_open() ){
141 errorLog <<
"loadPostProcessingSettingsFromFile(fstream &file) - The file is not open!" << std::endl;
154 if( word !=
"Initialized:" ){
155 errorLog <<
"loadPostProcessingSettingsFromFile(fstream &file) - Failed to read Initialized header!" << std::endl;
174 return postProcessingType;
178 return postProcessingInputMode;
182 return postProcessingOutputMode;
186 return numInputDimensions;
190 return numOutputDimensions;
198 return postProcessingInputMode==INPUT_MODE_PREDICTED_CLASS_LABEL;
202 return postProcessingInputMode==INPUT_MODE_CLASS_LIKELIHOODS;
206 return postProcessingOutputMode==OUTPUT_MODE_PREDICTED_CLASS_LABEL;
210 return postProcessingOutputMode==OUTPUT_MODE_CLASS_LIKELIHOODS;
214 return processedData;
bool saveBaseSettingsToFile(std::fstream &file) const
virtual ~PostProcessing(void)
std::string getPostProcessingType() const
bool getIsPostProcessingInputModeClassLikelihoods() const
bool savePostProcessingSettingsToFile(std::fstream &file) const
bool getInitialized() const
virtual bool resize(const unsigned int size)
bool copyMLBaseVariables(const MLBase *mlBase)
UINT getPostProcessingInputMode() const
bool getIsPostProcessingOutputModePredictedClassLabel() const
virtual bool loadModelFromFile(std::string filename)
UINT getPostProcessingOutputMode() const
bool getIsPostProcessingInputModePredictedClassLabel() const
bool copyBaseVariables(const PostProcessing *postProcessingModule)
bool loadBaseSettingsFromFile(std::fstream &file)
VectorFloat getProcessedData() const
UINT getNumOutputDimensions() const
This is the main base class that all GRT PostProcessing algorithms should inherit from...
bool getIsPostProcessingOutputModeClassLikelihoods() const
static PostProcessing * createInstanceFromString(std::string const &postProcessingType)
UINT getNumInputDimensions() const
bool loadPostProcessingSettingsFromFile(std::fstream &file)
std::map< std::string, PostProcessing *(*)() > StringPostProcessingMap
virtual bool saveModelToFile(std::string filename) const
PostProcessing * createNewInstance() const