MeVisLabToolboxReference
|
00001 // **InsertLicense** code 00002 //---------------------------------------------------------------------------------- 00006 00011 // File caching with the ML Image Format. 00012 //---------------------------------------------------------------------------------- 00013 #ifndef __mlImageFormatFileCache_H 00014 #define __mlImageFormatFileCache_H 00015 00016 #ifndef __MLImageFormatSystem_H 00017 #include "MLImageFormatSystem.h" 00018 #endif 00019 #ifndef __mlModuleIncludes_H 00020 #include <mlModuleIncludes.h> 00021 #endif 00022 #ifndef __mlImageFormatTools_H 00023 #include <mlImageFormatTools.h> 00024 #endif 00025 #ifndef __mlImageFormatIOBase_H 00026 #include <mlImageFormatIOBase.h> 00027 #endif 00028 00029 ML_START_NAMESPACE 00030 00032 class MLImageFormat; 00033 class MLImageFormatCompressionParams; 00034 00035 //---------------------------------------------------------------------------------- 00039 //---------------------------------------------------------------------------------- 00040 class MLIMAGEFORMAT_EXPORT MLImageFormatFileCache : public MLImageFormatIOBase { 00041 00042 public: 00043 00045 enum UPDATE_MODE { 00046 UPDATE_OFF = 0, 00047 UPDATE_AUTOUPDATE, 00048 UPDATE_AUTOCLEAR, 00049 UPDATE_MODE_NUM 00050 }; 00051 00053 static const char* const UPDATE_MODE_NAMES[UPDATE_MODE_NUM]; 00054 00056 MLImageFormatFileCache(); 00057 00059 virtual ~MLImageFormatFileCache(); 00060 00062 00063 BoolField &getValidFld () const { return *_validFld ; } 00064 NotifyField &getLoadFld () const { return *_loadFld ; } 00065 NotifyField &getUpdateRegionFld () const { return *_updateRegionFld ; } 00066 NotifyField &getClearFld () const { return *_clearFld ; } 00067 EnumField &getAutoLoadFld () const { return *_autoLoadFld ; } 00068 StringField &getTmpFileNamePrefixFld() const { return *_tmpFileNamePrefixFld; } 00070 00071 protected: 00072 // ---------------------------------------------------------- 00074 00075 // ---------------------------------------------------------- 00077 virtual void activateAttachments(); 00078 00080 virtual void handleNotification (Field *field); 00082 00083 // ---------------------------------------------------------- 00085 00086 // ---------------------------------------------------------- 00088 virtual void calculateOutputImageProperties(int outIndex); 00089 00093 virtual Module::INPUT_HANDLE handleInput(int /*inIndex*/, Module::INPUT_STATE /*state*/) const; 00094 00096 virtual SubImageBox calculateInputSubImageBox(int /*inIndex*/, 00097 const SubImageBox& outSubImgBox, 00098 int /*outIndex*/); 00099 00105 virtual void calculateOutputSubImage(SubImage *outSubImg, int outIndex, SubImage *inSubImgs); 00106 00108 00109 private: 00110 00111 // ---------------------------------------------------------- 00113 00114 // ---------------------------------------------------------- 00115 00119 void _shutDownFileIO(bool forceRemove=false); 00120 00125 void _clearOutput(bool forceRemove=false); 00126 00143 MLErrorCode _setUpOrOpenCacheFile(bool *cacheWasLoaded=NULL); 00144 00152 MLErrorCode _overwriteWithInputInFile(); 00154 00155 00156 // ---------------------------------------------------------- 00158 00159 // ---------------------------------------------------------- 00162 MLImageFormat *_fileManager; 00163 00165 PagedImage _inImgProps; 00167 00168 00169 // ---------------------------------------------------------- 00171 00172 // ---------------------------------------------------------- 00173 00175 BoolField *_validFld; 00176 00178 BoolField *_preserveCacheFileFld; 00179 00180 00182 NotifyField *_loadFld; 00183 00186 NotifyField *_updateRegionFld; 00187 00190 NotifyField *_clearFld; 00191 00192 00195 EnumField *_autoLoadFld; 00196 00198 StringField *_tmpFileNamePrefixFld; 00200 00201 00203 ML_MODULE_CLASS_HEADER(MLImageFormatFileCache); 00204 }; 00205 00206 ML_END_NAMESPACE 00207 00208 #endif // of __mlImageFormatFileCache_H