Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members

mitkOoCVolume.h

00001 /*=========================================================================
00002 
00003   Program:   3DMed
00004   Date:      $Date: 2014-02-25 18:30:00 +0800 $
00005   Version:   $Version: 4.6.0 $
00006   Copyright: MIPG, Institute of Automation, Chinese Academy of Sciences
00007 
00008 =========================================================================*/
00009 
00010 
00011 #ifndef __mitkOoCVolume_h
00012 #define __mitkOoCVolume_h
00013 
00014 #include "mitkVolume.h"
00015 
00016 class SliceHeapNode;
00017 class SliceHeap;
00018 class SliceBufferBlockNode;
00019 class SliceBufferFreeQueue;
00020 
00021 class mitkThreadDelegate;
00022 class mitkSemaphore;
00023 
00024 class mitkOoCVolume;
00025 template <class UserClass> class mitkOoCIODelegate;
00026 typedef mitkOoCIODelegate<mitkOoCVolume> mitkOoCVolumeIODelegate;
00027 
00032 class MITK_COMMON_API mitkOoCVolume : public mitkVolume
00033 {
00034 public:
00035     MITK_TYPE(mitkOoCVolume, mitkVolume)
00036 
00037     virtual void PrintSelf(ostream &os);
00038 
00042     mitkOoCVolume();
00043     
00048     virtual int GetDataObjectType() const { return MITK_OOC_VOLUME; }
00049 
00059     virtual void const* GetData() const { return NULL; }
00060 
00070     virtual void* GetData() { return NULL; }
00071 
00080     virtual void FreezeSlice(int sliceIdx);
00081 
00087     virtual void UnFreezeSlice(int sliceIdx);
00088 
00102     virtual void const* GetSliceForRead(int sliceIdx);
00103 
00121     virtual void* GetSliceForWrite(int sliceIdx);
00122 
00136     virtual void* GetSliceForReadWrite(int sliceIdx);
00137 
00146     virtual bool ReadSliceData(int sliceIdx, void *dst);
00147 
00156     virtual bool ReadYZSliceData(int xIdx, void *dst);
00157 
00166     virtual bool ReadXZSliceData(int yIdx, void *dst);
00167 
00183     virtual bool GetArbitrarySlice(int w, int h, double o[3], double ux[3], double uy[3], void *dst);
00184 
00193     virtual bool WriteSliceData(int sliceIdx, void const *src);
00194 
00215     virtual bool ReadSubVolume(int x, int y, int z, int w, int h, int d, int &tw, int &th, int &td, void *dst);
00216 
00217     virtual bool ReadSubVolume(int x, int y, int z, int w, int h, int d,
00218         int dstx, int dsty, int dstz, int dstw, int dsth, int dstd,
00219         void *dst, bool zeropad=true);
00220 
00221     virtual bool ReadSubVolume(int x, int y, int z, int w, int h, int d, void *dst, bool zeropad=true);
00222 
00243     virtual bool WriteSubVolume(int x, int y, int z, int w, int h, int d, int &tw, int &th, int &td, void const *src);
00244 
00251     virtual bool Allocate();
00252 
00257     virtual unsigned long long GetActualMemorySize() const;
00258 
00262     virtual void Initialize();
00263 
00267     virtual void ShallowCopy(mitkDataObject *src);
00268 
00272     virtual void DeepCopy(mitkDataObject *src);
00273 
00282     void SetSliceDataModified(int sliceIdx, bool modified = true);
00283 
00291     void SetMemoryBufferSize(size_type s);
00292 
00300     void SetBufferedSliceNum(unsigned int n);
00301 
00306     unsigned int GetBufferedSliceNum() { return m_BufferedSliceNum; }
00307 
00313     void SetPathOfDiskBuffer(char const *path);
00314 
00320     char const* GetPathOfDiskBuffer();
00321 
00327     void SetNamePrefix(char const *prefix);
00328 
00334     char const* GetNamePrefix();
00335 
00341     void SetKeepCacheFiles(bool keep=true) { m_KeepCacheFiles = keep; }
00342 
00343     virtual void PrepareSlicesForRead(int startSliceIdx,int sliceNum=1,bool freeze=false);
00344     virtual void PrepareSlicesForWrite(int startSliceIdx,int sliceNum=1,bool freeze=false);
00345 
00346 protected:
00347     virtual ~mitkOoCVolume();
00348 
00349     bool _loadSlice(int sliceIdx);
00350     bool _writeSliceBack(int sliceIdx);
00351     void _clearDiskCache();
00352     void _flush();
00353     SliceBufferBlockNode* _getFreeBufferBlock();
00354     SliceBufferBlockNode* _getSliceBufferBlock(int sliceIdx);
00355 
00356     void const* _getSliceForRead(int sliceIdx);
00357     void* _getSliceForWrite(int sliceIdx);
00358     
00359     bool _changeBufferSize(unsigned int bufSliceNum);
00360 
00361     void _freezeSlice(int sliceIdx);
00362     void _unFreezeSlice(int sliceIdx);
00363 
00364     void _prepareSlicesForRead();
00365     void _prepareSlicesForWrite();
00366 
00367     mitkString *m_DiskPath;
00368     mitkString *m_NamePrefix;
00369 
00370     size_type m_MemBufSize;
00371     
00372     unsigned int m_BufferedSliceNum;
00373 
00374     SliceHeap *m_BufferedSliceHeap;
00375     SliceHeapNode *m_SliceHeapNodes;
00376 
00377     SliceBufferFreeQueue *m_FreeQueue;
00378     SliceBufferBlockNode *m_BufferBlockNodes;
00379 
00380     void *m_SliceBuffer;
00381 
00382     bool m_KeepCacheFiles;
00383 
00384     mitkOoCVolumeIODelegate *m_IODelegate;
00385 
00386     int m_IOSliceStartIdx,m_IOSliceNumber;
00387     bool m_IOFreeze;
00388 
00389 private:
00390     mitkOoCVolume(const mitkOoCVolume&);
00391     void operator = (const mitkOoCVolume&);
00392 
00393 };
00394 
00395 
00396 //#define DEFINED_mitkOoCVolume
00397 
00398 
00399 
00400 #endif
00401 

Generated on Tue Feb 25 15:00:37 2014 for MITK (Medical Imaging ToolKit) by  doxygen 1.4.3