26 UINT PreProcessing::numPreProcessingInstances = 0;
30 StringPreProcessingMap::iterator iter = getMap()->find( preProcessingType );
31 if( iter == getMap()->end() ){
34 return iter->second();
38 preProcessingType =
"NOT_SET";
40 numInputDimensions = 0;
41 numOutputDimensions = 0;
42 numPreProcessingInstances++;
46 if( --numPreProcessingInstances == 0 ){
47 delete stringPreProcessingMap;
48 stringPreProcessingMap = NULL;
54 if( preProcessingModule == NULL ){
55 errorLog <<
"copyBaseVariables(const PreProcessing *preProcessingModule) - preProcessingModule pointer is NULL!" << std::endl;
63 this->preProcessingType = preProcessingModule->preProcessingType;
64 this->initialized = preProcessingModule->initialized;
65 this->numInputDimensions = preProcessingModule->numInputDimensions;
66 this->numOutputDimensions = preProcessingModule->numOutputDimensions;
67 this->processedData = preProcessingModule->processedData;
68 this->debugLog = preProcessingModule->debugLog;
69 this->errorLog = preProcessingModule->errorLog;
70 this->warningLog = preProcessingModule->warningLog;
78 if( processedData.size() > 0 )
79 fill(processedData.begin(),processedData.end(),0);
86 numInputDimensions = 0;
87 numOutputDimensions = 0;
88 processedData.clear();
94 if( numOutputDimensions == 0 ){
95 errorLog <<
"init() - Failed to init module, the number of output dimensions is zero!" << std::endl;
101 processedData.
resize( numOutputDimensions );
112 file.open(filename.c_str(), std::ios::out);
126 file.open(filename.c_str(), std::ios::in);
140 if( !file.is_open() ){
141 errorLog <<
"savePreProcessingSettingsToFile(fstream &file) - The file is not open!" << std::endl;
146 errorLog <<
"savePreProcessingSettingsToFile(fstream &file) - Failed to save base settings to file!" << std::endl;
150 file <<
"Initialized: " << initialized << std::endl;
157 if( !file.is_open() ){
158 errorLog <<
"loadPreProcessingSettingsFromFile(fstream &file) - The file is not open!" << std::endl;
164 errorLog <<
"loadPreProcessingSettingsFromFile(fstream &file) - Failed to load base settings from file!" << std::endl;
172 if( word !=
"Initialized:" ){
173 errorLog <<
"loadPreProcessingSettingsFromFile(fstream &file) - Failed to read Initialized header!" << std::endl;
192 return preProcessingType;
196 return numInputDimensions;
200 return numOutputDimensions;
208 return processedData;
bool saveBaseSettingsToFile(std::fstream &file) const
virtual ~PreProcessing(void)
UINT getNumInputDimensions() const
UINT getNumOutputDimensions() const
bool savePreProcessingSettingsToFile(std::fstream &file) const
bool loadPreProcessingSettingsFromFile(std::fstream &file)
PreProcessing * createNewInstance() const
virtual bool resize(const unsigned int size)
static PreProcessing * createInstanceFromString(std::string const &preProcessingType)
virtual bool loadModelFromFile(std::string filename)
std::string getPreProcessingType() const
bool copyMLBaseVariables(const MLBase *mlBase)
bool loadBaseSettingsFromFile(std::fstream &file)
virtual bool saveModelToFile(std::string filename) const
VectorFloat getProcessedData() const
bool copyBaseVariables(const PreProcessing *preProcessingModule)
This is the main base class that all GRT PreProcessing algorithms should inherit from.
std::map< std::string, PreProcessing *(*)() > StringPreProcessingMap
bool getInitialized() const