NIREP
|
00001 /*============================================================================ 00002 00003 Program: Non-Rigid Image Registration Evalution Project 00004 Module: $RCSfile: NIREPDataManager.h,v $ 00005 Language: C++ 00006 Date: $Date: 2011/01/12 22:41:33 $ 00007 Version: $Revision: 1.43 $ 00008 00009 This software is distributed WITHOUT ANY WARRANTY; without even 00010 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00011 PURPOSE. See the above copyright notices for more information. 00012 00013 ============================================================================*/ 00014 #pragma once 00015 #ifndef __NIREPDataManager_h 00016 #define __NIREPDataManager_h 00017 00049 #include "gecSpatialData.h" 00050 #include "gecImage.h" 00051 #include "gecObjectMap.h" 00052 #include "gecTransformation.h" 00053 #include "NIREPGenericXMLParser.h" 00054 #include <string> 00055 #include <map> 00056 #include <vector> 00057 #include "ResourceListTree.h" 00058 #include "DisplayDescription.h" 00059 00060 class Interface; 00061 00062 class NIREPDataManager 00063 { 00064 public: 00065 typedef std::map<std::string, LoadedSpatialData> LoadedSpatialDataList; 00068 typedef std::map<std::string, TransformationSet> TransformationResourceList; 00069 00071 NIREPDataManager(void); 00072 00074 ~NIREPDataManager(void); 00075 00078 void SetLoadedSpatialDataListEntry(const std::string& dmid, 00079 gec::SpatialData* data); 00080 00085 gec::SpatialData* GetLoadedSpatialDataListEntry(const std::string& dmid, DisplayDescription * displayDescription); 00086 00088 bool ReleaseLoadedSpatialDataListEntry(const std::string& dmid); 00089 00091 bool LoadSpatialData(const std::string& datasetID, 00092 const std::string& dataID, 00093 DisplayDescription * displayDescription); 00095 bool LoadSpatialData(const std::string& dmid, 00096 DisplayDescription * displayDescription); 00097 00099 bool LoadTransformation(const std::string& source, 00100 const std::string& target, 00101 const std::string& algorithmID, 00102 DisplayDescription * displayDescription); 00104 bool LoadTransformation(const std::string& dmid, 00105 DisplayDescription * displayDescription); 00106 00108 bool ReadSpatialDataResourceFile(const std::string& filename); 00109 00111 bool ReadTransformationResourceFile(const std::string& filename); 00112 00113 unsigned long GetMemoryUsage(); 00114 00115 void SetInterface(Interface *I){mainPage=I;}; 00116 00117 private: 00118 /* The active database (loaded resource & computed data) */ 00119 // Format: <Entry ID, Loaded spatial data entry> 00120 LoadedSpatialDataList loadedSpatialDataList; 00121 00122 /* List of loadable spatial data resource */ 00123 SpatialDataResourceList spatialDataResourceListTree; 00124 00125 00126 00127 /* List of loadable transformation resource */ 00128 TransformationResourceList transformationResourceList; 00129 00130 /* Function for parsing transformation resource database */ 00131 bool ParseTransformationDatabase(NIREPGenericXMLParser::XMLNode*, 00132 TransformationSet&); 00133 00134 Interface *mainPage; 00135 00136 class spatialDataResourceList{ 00137 public: 00138 std::string file; 00139 int dataType; 00140 }; 00141 00142 std::map<std::string, spatialDataResourceList> spatialDataResourceListFullPath; 00143 00144 /* LRU queue of un-needed data to be flushed out of memory */ 00145 // Format: <dataID> 00146 //std::vector<std::string> flushMe; 00147 00148 /* Memory usage monitor */ 00149 //unsigned long long memoryUsage; 00150 00151 // Flush unused data out of memory 00152 //bool FlushData(void); 00153 00154 }; 00155 00156 #endif // __NIREPDataManager_h