MeVisLabToolboxReference
MeVis/Foundation/Sources/MLImageFormatBase/mlImageFormat.h
Go to the documentation of this file.
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 
00076     MLImageFormatTagList       &getTagList();
00077 
00079     const MLImageFormatTagList &getConstTagList() const;
00080 
00082     const MLImageFormatTagList &getConstUserTagList() const;
00083 
00085     const MLImageFormatTagList &getConstPrivateTagList() const;
00086 
00088     const MLImageFormatTagList &getConstCompressionTagList() const;
00089     
00091     bool                        arePartialPagesEnabled() const;
00092     
00095     void                        enablePartialPages(bool enable);
00097 
00101     static std::string          buildFileNameWithExtension(std::string fileName);
00102 
00103 
00104     //----------------------------------------------------------------------
00106 
00107     //----------------------------------------------------------------------
00139     MLErrorCode open(bool                       truncate         = false,
00140                      const std::string          &compressorName  = "",
00141                      const MLImageFormatTagList &compressionArgs = MLImageFormatTagList::getDefaultEmptyTagList(), 
00142                      const MLImageFormatTagList &userTagList     = MLImageFormatTagList::getDefaultEmptyTagList(),
00143                      const MLImageFormatTagList &privateTagList  = MLImageFormatTagList::getDefaultEmptyTagList(),
00144                      const std::string          &defaultVoxelVal = "0",
00145                      bool                       rewritable       = true);
00146 
00152     MLErrorCode openForReading();
00153 
00171     MLErrorCode save(PagedImage           &inImg, 
00172                      const SubImageBox    &box = SubImageBox(),
00173                      const ScaleShiftData &scaleShiftData = ScaleShiftData());
00174 
00189     MLErrorCode overwrite(PagedImage           &inImg, 
00190                           const SubImageBox    &box = SubImageBox(),
00191                           const ScaleShiftData &scaleShiftData = ScaleShiftData());
00192 
00204     MLErrorCode overwrite(const SubImage       &inputSubImg,
00205                           const ScaleShiftData &scaleShiftData = ScaleShiftData());
00206 
00225     MLErrorCode updateMinMaxTagValuesInOpenFile(MLldouble    newMinVoxelValue, 
00226                                                 MLldouble    newMaxVoxelValue,
00227                                                 std::string *errorDescription = NULL);
00228 
00232     MLErrorCode close();
00233 
00234 
00238     MLErrorCode remove();
00239 
00240 
00269     MLErrorCode getTile(SubImage             &subImgToFill, 
00270                         bool                  useFileDataType = false, 
00271                         bool                  useFileRegion   = false,
00272                         const ScaleShiftData &scaleShiftData  = ScaleShiftData());
00273 
00274 
00284     void setCallback(MLImageFormatTools::MLImageFormatNotifyCB *callback = NULL,
00285                      void                                      *userData = NULL);
00286 
00288     MLImageFormatTools::MLImageFormatNotifyCB *getCallbackFunction() const;
00289 
00291     void *getCallbackFunctionData() const;
00292 
00294 
00295     //----------------------------------------------------------------------
00297 
00298     //----------------------------------------------------------------------
00302     MLdouble            getDataPreparationTime() const;
00303 
00306     MLdouble            getPureSaveTime() const;
00307 
00309     void                resetTimeMeasurements();
00311 
00312   protected:
00313 
00325     MLErrorCode _overwriteHeaderAndPageList();
00326     
00327   private:
00328 
00331     MLImageFormat(const MLImageFormat &){};
00332 
00335     MLImageFormat& operator=(const MLImageFormat &){ return *this; };
00336 
00337 
00339     std::string         _fileName;
00340 
00342     MLImageFormatInfos *_infos;
00343 
00345     MLImageFormatTools::MLImageFormatNotifyCB *_callback;
00346 
00348     void               *_userData;
00349 
00351     bool                _arePartialPagesEnabled;
00352     
00356     MLdouble            _dataPreparationTime;
00357 
00360     MLdouble            _pureSaveTime;
00361 
00362   };
00363 
00364 ML_END_NAMESPACE
00365 
00366 
00367 #endif // of __mlImageFormat_H