MeVisLab Toolbox Reference
mlDICOMCachedIOTreeCacheMap.h
Go to the documentation of this file.
1// Copyright (c) Fraunhofer MEVIS, Germany. All rights reserved.
2// **InsertLicense** code
3//----------------------------------------------------------------------------------
6
11//----------------------------------------------------------------------------------
12#pragma once
13
15#include <mlTypeDefs.h>
16
17#include <FMEThirdPartyWarningsDisable.h>
18#include <list>
19#include <map>
20#include <vector>
21#include <FMEThirdPartyWarningsRestore.h>
22
26
27// Forwards
30namespace ML_NAMESPACE {
31 class IntField;
32 class DicomMessageCollector;
33};
34
38{
39public:
42
45
54 MLint flush(const MLint maxBytes, const bool flushAll=false);
55
58
61
64
67
70
72 void setMaxNumMegaBytes(MLint maxNumMegaBytes);
73
76
78 ML_NAMESPACE::IntField& getMaxNumMegaBytesFld();
79
82
85 const ML_NAMESPACE::DICOMCachedIOFileHandle &origFileHandle,
86 size_t frameIndex);
87
89 MLErrorCode addDCMTree(const ML_NAMESPACE::DICOMCachedIOFileHandle &fileHandle,
90 DCMTree::TreePtr &treePtr);
91
93 MLErrorCode getCachedDCMTree(const ML_NAMESPACE::DICOMCachedIOFileHandle &fileHandle,
94 DCMTree::TreePtr &treePtr);
95
97 MLErrorCode loadDCMTree(const ML_NAMESPACE::DICOMCachedIOFileHandle &fileHandle,
98 DCMTree::TreePtr &treePtr,
99 ML_NAMESPACE::DicomMessageCollector &dcmMsgCollector);
100
103 const ML_NAMESPACE::DICOMCachedIOFileHandle &fileHandle);
104
107 void removeAssociatedEntries(const ML_NAMESPACE::DICOMCachedIOFileHandle &fileHandle);
108
110 inline std::vector< MLDICOMCachedIODCMTreeLoaderPlugin *>& getTreeLoaderPlugins() { return _treeLoaderPlugins; }
111
113 inline const std::vector< MLDICOMCachedIODCMTreeLoaderPlugin* >& getConstTreeLoaderPlugins() const { return _treeLoaderPlugins; }
114
116 inline std::vector< MLDICOMCachedIODCMTreeWriterPlugin* >& getTreeWriterPlugins() { return _treeWriterPlugins; }
117
119 inline const std::vector< MLDICOMCachedIODCMTreeWriterPlugin*>& getConstTreeWriterPlugins() const { return _treeWriterPlugins; }
120
122 void clear();
123
124protected:
129 MLErrorCode _addDCMTree(const ML_NAMESPACE::DICOMCachedIOFileHandle &fileHandle,
130 DCMTree::TreePtr &treePtr);
131
132
134 std::map< ML_NAMESPACE::DICOMCachedIOFileHandle,
136
140 std::map< ML_NAMESPACE::DICOMCachedIOFileHandle,
142
144 std::list<ML_NAMESPACE::DICOMCachedIOFileHandle> _recentlyCached;
145
148
151
154
156 std::vector< MLDICOMCachedIODCMTreeLoaderPlugin *> _treeLoaderPlugins;
157
159 std::vector< MLDICOMCachedIODCMTreeWriterPlugin *> _treeWriterPlugins;
160};
Project global and OS specific declarations.
#define MLDICOMCachedIO_EXPORT
If included by external modules, exported symbols are declared as import symbols.
Class describing one entry in the MLDICOMCachedIOTreeCache of cached DICOM trees.
std::map< ml::DICOMCachedIOFileHandle, MLDICOMCachedIOTreeCacheSingleMFMapEntry > _singleFrameCache
MLint flush(const MLint maxBytes, const bool flushAll=false)
MLint getMaxNumMegaBytes() const
Return maximum number of bytes used for tag data.
MLint getNumFlushedBytes() const
Returns the number of flushed bytes since most recent recent resetNumFlushedBytes().
std::vector< MLDICOMCachedIODCMTreeLoaderPlugin * > _treeLoaderPlugins
Vector of loader plugins.
MLint _totalNumBytes
Total number of bytes in all DICOM trees.
std::map< ml::DICOMCachedIOFileHandle, MLDICOMCachedIOTreeCacheMapEntry > _cache
The tree map.
void resetNumFlushedBytes()
Sets counter of flushed bytes to 0.
~MLDICOMCachedIOTreeCacheMap()
Destructor; clears and deletes the MLDICOMCachedIODCMTreeLoaderPlugins and MLDICOMCachedIODCMTreeWrit...
void flushSingleFrameCache()
Clears all cached singleFrameTrees, because they are normally excluded from normal flushing.
MLint getTotalNumberOfBytes() const
Return currently number of cached tree data in bytes.
ml::IntField & getMaxNumMegaBytesFld()
Returns field that specifies the maximum number of mega bytes for tag data.
MLint _numFlushedBytes
Counter for number of flushed bytes since most recent resetNumFlushedBytes().
std::vector< MLDICOMCachedIODCMTreeLoaderPlugin * > & getTreeLoaderPlugins()
Return modifiable vector of DICOM tree loader plugins.
MLErrorCode addDCMTree(const ml::DICOMCachedIOFileHandle &fileHandle, DCMTree::TreePtr &treePtr)
See DICOMCachedIOTreeCache::addDCMTree().
MLint flush()
Same as flush(getMaxNumBytes(), false).
std::vector< MLDICOMCachedIODCMTreeWriterPlugin * > & getTreeWriterPlugins()
Return modifiable vector of DICOM tree writer plugins.
const std::vector< MLDICOMCachedIODCMTreeWriterPlugin * > & getConstTreeWriterPlugins() const
Return constant vector of DICOM tree writer plugins.
MLDICOMCachedIOTreeCacheMap()
Constructor; it is initialized with 250 MB of cache for DICOM tree tag data.
const std::vector< MLDICOMCachedIODCMTreeLoaderPlugin * > & getConstTreeLoaderPlugins() const
Return constant vector of DICOM tree loader plugins.
MLErrorCode saveDCMTree(DCMTree::Const_TreePtr dcmTree, const ml::DICOMCachedIOFileHandle &fileHandle)
See DICOMCachedIOTreeCache::saveDCMTree().
MLErrorCode loadDCMTree(const ml::DICOMCachedIOFileHandle &fileHandle, DCMTree::TreePtr &treePtr, ml::DicomMessageCollector &dcmMsgCollector)
See DICOMCachedIOTreeCache::loadDCMTree().
void storeSingleFrameTree(DCMTree::TreePtr singleFrameTree, const ml::DICOMCachedIOFileHandle &origFileHandle, size_t frameIndex)
See DICOMCachedIOTreeCache::storeSingleFrameTree().
void clear()
Clears the DICOM trees cache singleton and resets all counters.
void removeAssociatedEntries(const ml::DICOMCachedIOFileHandle &fileHandle)
MLErrorCode _addDCMTree(const ml::DICOMCachedIOFileHandle &fileHandle, DCMTree::TreePtr &treePtr)
MLint getMaxNumBytes() const
Return maximum number of bytes used for tag data.
ml::IntField * _limitInMegaBytesFld
IntField specifying the maximum number of value mega bytes allowed in all DICOM trees.
std::list< ml::DICOMCachedIOFileHandle > _recentlyCached
Stores the file names of DCMTrees added to cache in the order of caching.
MLErrorCode getCachedDCMTree(const ml::DICOMCachedIOFileHandle &fileHandle, DCMTree::TreePtr &treePtr)
See DICOMCachedIOTreeCache::getCachedDCMTree().
void setMaxNumMegaBytes(MLint maxNumMegaBytes)
Set maximum number of mega bytes used for tag data. Values < 0 are clamped to 0.
std::vector< MLDICOMCachedIODCMTreeWriterPlugin * > _treeWriterPlugins
Vector of writer plugins.
MLint32 MLErrorCode
Type of an ML Error code.
Definition mlTypeDefs.h:715
Header file of class describing one entry in the MLDICOMCachedIOTreeCache of cached DICOM trees.
MLint64 MLint
Definition mlTypeDefs.h:489
boost::shared_ptr< const Tree > Const_TreePtr
Definition DCMTree_Lib.h:67
boost::shared_ptr< Tree > TreePtr
Shared pointer to a DCMTree::Tree.
Definition DCMTree_Lib.h:66