MeVisLabToolboxReference
|
00001 // **InsertLicense** code 00002 //---------------------------------------------------------------------------------- 00007 00012 // 00013 // ML Image Format IO 00014 //---------------------------------------------------------------------------------- 00015 00016 #ifndef __mlImageFormatIOBase_H 00017 #define __mlImageFormatIOBase_H 00018 00019 00020 // Local includes 00021 #ifndef __MLImageFormatSystem_H 00022 #include "MLImageFormatSystem.h" 00023 #endif 00024 00025 // ML includes 00026 #ifndef __mlModuleIncludes_H 00027 #include "mlModuleIncludes.h" 00028 #endif 00029 00030 #ifndef __mlImageFormatTools_H 00031 #include "mlImageFormatTools.h" 00032 #endif 00033 00034 00035 ML_START_NAMESPACE 00036 00037 // Forward declaration. 00038 class MLImageFormat; 00039 class MLImageFormatCompressionParams; 00040 00041 // ---------------------------------------------------------- 00044 // ---------------------------------------------------------- 00045 class MLIMAGEFORMAT_EXPORT MLImageFormatIOBase : public Module 00046 { 00047 public: 00048 00049 // Define number of user tags to support as fields and in GUI. 00050 enum { NumUserTags = 10 }; 00051 00053 MLImageFormatIOBase(int numIns=0, int numOuts=0); 00054 00056 virtual ~MLImageFormatIOBase(); 00057 00060 MLImageFormatTagList getUserTagList() const; 00061 00063 virtual void updateUserTagFieldsFromLoader(const MLImageFormat &loader); 00064 00066 virtual void updateTagListFieldFromLoader(const MLImageFormat &loader); 00067 00068 protected: 00069 00070 // ---------------------------------------------------------- 00072 00073 // ---------------------------------------------------------- 00075 virtual void activateAttachments(); 00076 00078 virtual void handleNotification (Field *field); 00080 00081 // ---------------------------------------------------------- 00083 00084 // ---------------------------------------------------------- 00087 virtual void _setStatus(std::string str = "", 00088 float progress = 0.0, 00089 MLErrorCode err = ML_RESULT_OK); 00090 00091 00093 virtual void _setProgress(float progressVal); 00094 00096 virtual void _resetTagFields(); 00097 00101 virtual void _remove(const std::string &fileName, bool updateStatus); 00102 00113 static void _saveCB(MLint id, 00114 MLint idNum, 00115 MLImageFormatTools::ProcessState state, 00116 void *usrData, 00117 bool &interrupt); 00118 00126 void _saveCBMethod(MLint id, 00127 MLint idNum, 00128 MLImageFormatTools::ProcessState state, 00129 bool &interrupt); 00130 00131 00146 MLErrorCode _overWriteWithInputImage(PagedImage &inImg, 00147 MLImageFormat &fileToUpdate, 00148 ImageVector voxelShift = ImageVector(0), 00149 PagedImage *imgPropsToUpdate = NULL, 00150 bool suppressWorldCoordinateUse = false); 00152 00153 // ---------------------------------------------------------- 00155 00156 // ---------------------------------------------------------- 00157 MLImageFormatCompressionParams &_getCompressorParams () { return *_compressorParams ; } 00158 TimeCounter &_getTimer () { return _timer ; } 00159 BoolField &_getIsSavingFld () { return *_isSavingFld ; } 00160 00161 const StringField &_getTrueFileNameFld () const { return *_trueFileNameFld ; } 00162 const EnumField &_getUpdateModeFld () const { return *_updateModeFld ; } 00163 const NotifyField &_getStopFld () const { return *_stopFld ; } 00164 const NotifyField &_getRemoveFld () const { return *_removeFld ; } 00165 const StringField &_getStatusFld () const { return *_statusFld ; } 00166 const ProgressField &_getProgressFld () const { return *_progressFld ; } 00167 const StringField &_getTagListFld () const { return *_tagListFld ; } 00168 const StringField* const* _getUserTagFlds () const { return _userTagFld ; } 00169 StringField &_getNonConstTagListFld () const { return *_tagListFld ; } 00170 StringField **_getNonConstUserTagFlds() { return _userTagFld ; } 00171 ImageVectorField &_getRegionOffsetFld () const { return *_regionOffsetFld ; } 00172 BoolField &_getSuppressWorldPosFld() const { return *_suppressWorldPosFld; } 00174 00175 private: 00176 00177 // ---------------------------------------------------------- 00179 00180 // ---------------------------------------------------------- 00181 00183 MLImageFormatCompressionParams *_compressorParams; 00184 00187 TimeCounter _timer; 00189 00190 // ---------------------------------------------------------- 00192 00193 // ---------------------------------------------------------- 00194 00196 StringField *_trueFileNameFld; 00197 00199 ProgressField *_progressFld; 00200 00202 EnumField *_updateModeFld; 00203 00205 NotifyField *_stopFld; 00206 00208 NotifyField *_removeFld; 00209 00211 StringField *_statusFld; 00212 00214 BoolField *_isSavingFld; 00215 00217 StringField *_tagListFld; 00218 00220 StringField *_userTagFld[NumUserTags]; 00221 00225 ImageVectorField *_regionOffsetFld; 00226 00234 BoolField *_suppressWorldPosFld; 00235 00237 00239 ML_MODULE_CLASS_HEADER(MLImageFormatIOBase) 00240 }; 00241 00242 00243 ML_END_NAMESPACE 00244 00245 #endif // __mlImageFormatIOBase_H 00246 00247