21 #define GRT_DLL_EXPORTS
27 UINT PostProcessing::numPostProcessingInstances = 0;
31 StringPostProcessingMap::iterator iter = getMap()->find( postProcessingType );
32 if( iter == getMap()->end() ){
35 return iter->second();
39 postProcessingType =
"NOT_SET";
40 postProcessingInputMode = INPUT_MODE_NOT_SET;
41 postProcessingOutputMode = OUTPUT_MODE_NOT_SET;
43 numInputDimensions = 0;
44 numOutputDimensions = 0;
45 numPostProcessingInstances++;
49 if( --numPostProcessingInstances == 0 ){
50 delete stringPostProcessingMap;
51 stringPostProcessingMap = NULL;
57 if( postProcessingModule == NULL ){
58 errorLog <<
"copyBaseVariables(const PostProcessing *postProcessingModule) - postProcessingModule pointer is NULL!" << std::endl;
66 this->postProcessingType = postProcessingModule->postProcessingType;
67 this->postProcessingInputMode = postProcessingModule->postProcessingInputMode;
68 this->postProcessingOutputMode = postProcessingModule->postProcessingOutputMode;
69 this->initialized = postProcessingModule->initialized;
70 this->numInputDimensions = postProcessingModule->numInputDimensions;
71 this->numOutputDimensions = postProcessingModule->numOutputDimensions;
72 this->processedData = postProcessingModule->processedData;
73 this->debugLog = postProcessingModule->debugLog;
74 this->errorLog = postProcessingModule->errorLog;
75 this->warningLog = postProcessingModule->warningLog;
81 if( numOutputDimensions == 0 ){
82 errorLog <<
"init() - Failed to init module, the number of output dimensions is zero!" << std::endl;
88 processedData.
resize( numOutputDimensions );
99 file.open(filename.c_str(), std::ios::out);
113 file.open(filename.c_str(), std::ios::in);
127 if( !file.is_open() ){
128 errorLog <<
"savePostProcessingSettingsToFile(fstream &file) - The file is not open!" << std::endl;
134 file <<
"Initialized: " << initialized << std::endl;
141 if( !file.is_open() ){
142 errorLog <<
"loadPostProcessingSettingsFromFile(fstream &file) - The file is not open!" << std::endl;
155 if( word !=
"Initialized:" ){
156 errorLog <<
"loadPostProcessingSettingsFromFile(fstream &file) - Failed to read Initialized header!" << std::endl;
175 return postProcessingType;
179 return postProcessingInputMode;
183 return postProcessingOutputMode;
187 return numInputDimensions;
191 return numOutputDimensions;
199 return postProcessingInputMode==INPUT_MODE_PREDICTED_CLASS_LABEL;
203 return postProcessingInputMode==INPUT_MODE_CLASS_LIKELIHOODS;
207 return postProcessingOutputMode==OUTPUT_MODE_PREDICTED_CLASS_LABEL;
211 return postProcessingOutputMode==OUTPUT_MODE_CLASS_LIKELIHOODS;
215 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