MeVisLabToolboxReference
|
00001 // **InsertLicense** code 00002 //---------------------------------------------------------------------------------- 00006 00011 //---------------------------------------------------------------------------------- 00012 #ifndef __mlImageFormat_H 00013 #define __mlImageFormat_H 00014 00015 // Resolve platform independencies. 00016 #ifndef __MLImageFormatBaseSystem_H 00017 #include "MLImageFormatBaseSystem.h" 00018 #endif 00019 00020 #ifndef __mlModuleIncludes_H 00021 #include "mlModuleIncludes.h" 00022 #endif 00023 00024 #ifndef __mlImageFormatTools_H 00025 #include "mlImageFormatTools.h" 00026 #endif 00027 00028 // Implement everything in ML namespace. 00029 ML_START_NAMESPACE 00030 00032 class MLImageFormatTagList; 00033 00034 //---------------------------------------------------------------------- 00036 //---------------------------------------------------------------------- 00037 class MLIMAGEFORMATBASE_EXPORT MLImageFormat { 00038 00039 public: 00040 00041 //---------------------------------------------------------------------- 00043 00044 //---------------------------------------------------------------------- 00045 00048 MLImageFormat(const std::string &fileName = ""); 00049 00051 virtual ~MLImageFormat(); 00053 00054 00055 //---------------------------------------------------------------------- 00057 00058 //---------------------------------------------------------------------- 00059 00061 const std::string &getFileName() const; 00062 00064 bool isOpen() const; 00065 00067 const PagedImage *getImageProperties() const; 00068 00071 const MLImageFormatInfos *getInternalInfos() const; 00072 00075 const MLImageFormatTagList &getConstTagList() const; 00076 00078 const MLImageFormatTagList &getConstUserTagList() const; 00079 00081 const MLImageFormatTagList &getConstCompressionTagList() const; 00082 00084 bool arePartialPagesEnabled() const; 00085 00088 void enablePartialPages(bool enable); 00090 00094 static std::string buildFileNameWithExtension(std::string fileName); 00095 00096 00097 //---------------------------------------------------------------------- 00099 00100 //---------------------------------------------------------------------- 00130 MLErrorCode open(bool truncate = false, 00131 const std::string &compressorName = "", 00132 const MLImageFormatTagList &compressionArgs = MLImageFormatTagList::getDefaultEmptyTagList(), 00133 const MLImageFormatTagList &userTagList = MLImageFormatTagList::getDefaultEmptyTagList(), 00134 const std::string &defaultVoxelVal = "0", 00135 bool rewritable = true); 00136 00142 MLErrorCode openForReading(); 00143 00161 MLErrorCode save(PagedImage &inImg, 00162 const SubImageBox &box = SubImageBox(), 00163 const ScaleShiftData &scaleShiftData = ScaleShiftData()); 00164 00179 MLErrorCode overwrite(PagedImage &inImg, 00180 const SubImageBox &box = SubImageBox(), 00181 const ScaleShiftData &scaleShiftData = ScaleShiftData()); 00182 00194 MLErrorCode overwrite(const SubImage &inputSubImg, 00195 const ScaleShiftData &scaleShiftData = ScaleShiftData()); 00196 00200 MLErrorCode close(); 00201 00202 00206 MLErrorCode remove(); 00207 00208 00237 MLErrorCode getTile(SubImage &subImgToFill, 00238 bool useFileDataType = false, 00239 bool useFileRegion = false, 00240 const ScaleShiftData &scaleShiftData = ScaleShiftData()); 00241 00242 00252 void setCallback(MLImageFormatTools::MLImageFormatNotifyCB *callback = NULL, 00253 void *userData = NULL); 00254 00256 MLImageFormatTools::MLImageFormatNotifyCB *getCallbackFunction() const; 00257 00259 void *getCallbackFunctionData() const; 00260 00262 00263 //---------------------------------------------------------------------- 00265 00266 //---------------------------------------------------------------------- 00270 MLdouble getDataPreparationTime() const; 00271 00274 MLdouble getPureSaveTime() const; 00275 00277 void resetTimeMeasurements(); 00279 00280 private: 00281 00284 MLImageFormat(const MLImageFormat &){}; 00285 00288 MLImageFormat& operator=(const MLImageFormat &){ return *this; }; 00289 00290 private: 00292 std::string _fileName; 00293 00295 MLImageFormatInfos *_infos; 00296 00298 MLImageFormatTools::MLImageFormatNotifyCB *_callback; 00299 00301 void *_userData; 00302 00304 bool _arePartialPagesEnabled; 00305 00309 MLdouble _dataPreparationTime; 00310 00313 MLdouble _pureSaveTime; 00314 00315 }; 00316 00317 ML_END_NAMESPACE 00318 00319 00320 #endif // of __mlImageFormat_H 00321