MeVisLab Toolbox Reference
|
Structure containing the DCMTag look up map and the list of most recently used DICOM files as names. More...
#include <mlDICOMCachedIOTagCacheMap.h>
Classes | |
struct | TagHashFunction |
This is a self defined hash function for the boost::unordered map used as cache for tags. More... | |
struct | TagKey |
TagKey for the tag cache. More... | |
Public Types | |
typedef boost::unordered_map< TagKey, DCMTree::Const_TagPtr, TagHashFunction > | CacheMapType |
Defines the map type to be used for tag caching. More... | |
Public Member Functions | |
MLDICOMCachedIOTagCacheMap () | |
Constructor; it is initialized with 25 MB of cache for DICOM tree tag data. More... | |
~MLDICOMCachedIOTagCacheMap () | |
Destructor, cleaning up internal objects. More... | |
MLint | getMaxNumBytes () const |
Return maximum number of bytes used for tag data (rounded down to MB limits). More... | |
void | setMaxNumMegaBytes (MLint maxNumMegaBytes) |
Set maximum number of mega bytes used for tag data. Values < 0 are clamped to 0. More... | |
MLint | getMaxNumMegaBytes () const |
Return maximum number of bytes used for tag data. More... | |
ml::IntField & | getMaxNumMegaBytesFld () |
Returns field that specifies the maximum number of bytes for tag data. More... | |
MLint | getTotalNumberOfBytes () const |
Returns the approximate number of cached bytes. More... | |
MLint | flush (const MLint maxBytes, const bool flushAll=false) |
Flushes entries which have no other references than those ones from the cache until the given maxBytes is undergone; values < 0 for maxBytes means unlimited cache size, which means that the call is ignored; returns the number of flushed bytes; if flushAll is true and flushing unreferenced entries did not undergo maxBytes then an additional loop is performed to flush entries which have references from outside the cache if not enough can be flushed to reach maxBytes - doing this, however, may lead to duplicate entries in memory after reloading them. More... | |
MLint | flush () |
Same as flush(getMaxNumBytes(), false). More... | |
MLint | getNumFlushedBytes () const |
Returns the number of flushed bytes since most recent resetNumFlushedBytes(). More... | |
void | resetNumFlushedBytes () |
Sets counter of flushed bytes to 0. More... | |
void | removeAssociatedEntries (const ml::DICOMCachedIOFileHandle &fileHandle) |
Searches all tags with the given fileHandle in the cache and removes them; note that this function has complexity O(n) since it has to check all cache entries. More... | |
void | clear () |
Clears the MLDICOMCachedIOTagCacheMap, and resets all counters. More... | |
DCMTree::Const_TagPtr | getCachedDCMTag (const ml::DICOMCachedIOFileHandle &fileHandle, DCMTree::RawTagId rawTagId) const |
Returns a valid tag pointer if the fileName with the rawTagId is cached, otherwise a null tag is returned. More... | |
void | insertTag (MLDICOMCachedIOTagCacheMap::TagKey &key, DCMTree::Const_TagPtr tagPtr, const MLint tagValSize) |
Helper to insert a tag and to update all related structures. More... | |
DCMTree::Const_TagPtr | loadDCMTag (const ml::ConstantString &fileHandle, DCMTree::RawTagId rawTagId, MLint maxTagValueSizeToCache, bool *treeLoadFailed, bool *cacheMiss, ml::DicomMessageCollector &dcmMsgCollector) |
See DICOMCachedIOTagCache::loadDCMTag() for details. More... | |
void | prefetchDCMTags (const ml::ConstantString &fileHandle, const std::set< MLuint32 > &tagIds, MLint maxTagValueSizeToCache, bool *treeLoadFailed, ml::DicomMessageCollector &dcmMsgCollector) |
See DICOMCachedIOTagCache::prefetchDCMTags() for details. More... | |
Protected Attributes | |
CacheMapType | _cache |
The tag map for caching. More... | |
std::list< TagKey > | _recentlyCached |
Stores the file names of DCMTags added to cache in the order of caching. More... | |
MLint | _totalNumBytes |
Total number of value bytes in all DICOM tags. More... | |
MLint | _numFlushedBytes |
Counter for number of flushed bytes since most recent resetNumFlushedBytes(). More... | |
ml::IntField * | _limitInMegaBytesFld |
IntField specifying the maximum number of value bytes allowed in all DICOM tags. More... | |
Friends | |
class | MLDICOMCachedIOTagCache |
Allow direct access from MLDICOMCachedIOTagCache. More... | |
Structure containing the DCMTag look up map and the list of most recently used DICOM files as names.
Definition at line 40 of file mlDICOMCachedIOTagCacheMap.h.
typedef boost::unordered_map< TagKey, DCMTree::Const_TagPtr, TagHashFunction > MLDICOMCachedIOTagCacheMap::CacheMapType |
Defines the map type to be used for tag caching.
Definition at line 145 of file mlDICOMCachedIOTagCacheMap.h.
MLDICOMCachedIOTagCacheMap::MLDICOMCachedIOTagCacheMap | ( | ) |
Constructor; it is initialized with 25 MB of cache for DICOM tree tag data.
MLDICOMCachedIOTagCacheMap::~MLDICOMCachedIOTagCacheMap | ( | ) |
Destructor, cleaning up internal objects.
void MLDICOMCachedIOTagCacheMap::clear | ( | ) |
Clears the MLDICOMCachedIOTagCacheMap, and resets all counters.
MLint MLDICOMCachedIOTagCacheMap::flush | ( | ) |
Same as flush(getMaxNumBytes(), false).
Flushes entries which have no other references than those ones from the cache until the given maxBytes is undergone; values < 0 for maxBytes means unlimited cache size, which means that the call is ignored; returns the number of flushed bytes; if flushAll is true and flushing unreferenced entries did not undergo maxBytes then an additional loop is performed to flush entries which have references from outside the cache if not enough can be flushed to reach maxBytes - doing this, however, may lead to duplicate entries in memory after reloading them.
Currently the cache is organized as a FIFO list where oldest trees are flushed first.
DCMTree::Const_TagPtr MLDICOMCachedIOTagCacheMap::getCachedDCMTag | ( | const ml::DICOMCachedIOFileHandle & | fileHandle, |
DCMTree::RawTagId | rawTagId | ||
) | const |
Returns a valid tag pointer if the fileName with the rawTagId is cached, otherwise a null tag is returned.
No cache entry is created.
MLint MLDICOMCachedIOTagCacheMap::getMaxNumBytes | ( | ) | const |
Return maximum number of bytes used for tag data (rounded down to MB limits).
MLint MLDICOMCachedIOTagCacheMap::getMaxNumMegaBytes | ( | ) | const |
Return maximum number of bytes used for tag data.
ml::IntField& MLDICOMCachedIOTagCacheMap::getMaxNumMegaBytesFld | ( | ) |
Returns field that specifies the maximum number of bytes for tag data.
MLint MLDICOMCachedIOTagCacheMap::getNumFlushedBytes | ( | ) | const |
Returns the number of flushed bytes since most recent resetNumFlushedBytes().
MLint MLDICOMCachedIOTagCacheMap::getTotalNumberOfBytes | ( | ) | const |
Returns the approximate number of cached bytes.
void MLDICOMCachedIOTagCacheMap::insertTag | ( | MLDICOMCachedIOTagCacheMap::TagKey & | key, |
DCMTree::Const_TagPtr | tagPtr, | ||
const MLint | tagValSize | ||
) |
Helper to insert a tag and to update all related structures.
DCMTree::Const_TagPtr MLDICOMCachedIOTagCacheMap::loadDCMTag | ( | const ml::ConstantString & | fileHandle, |
DCMTree::RawTagId | rawTagId, | ||
MLint | maxTagValueSizeToCache, | ||
bool * | treeLoadFailed, | ||
bool * | cacheMiss, | ||
ml::DicomMessageCollector & | dcmMsgCollector | ||
) |
See DICOMCachedIOTagCache::loadDCMTag() for details.
void MLDICOMCachedIOTagCacheMap::prefetchDCMTags | ( | const ml::ConstantString & | fileHandle, |
const std::set< MLuint32 > & | tagIds, | ||
MLint | maxTagValueSizeToCache, | ||
bool * | treeLoadFailed, | ||
ml::DicomMessageCollector & | dcmMsgCollector | ||
) |
See DICOMCachedIOTagCache::prefetchDCMTags() for details.
void MLDICOMCachedIOTagCacheMap::removeAssociatedEntries | ( | const ml::DICOMCachedIOFileHandle & | fileHandle | ) |
Searches all tags with the given fileHandle in the cache and removes them; note that this function has complexity O(n) since it has to check all cache entries.
If the incoming handle is not an enhanced handle then also tags are cleared which have multi-frame handles built from fileHandle.
Removed tags update getTotalNumberOfBytes(), but not getNumFlushedBytes();.
void MLDICOMCachedIOTagCacheMap::resetNumFlushedBytes | ( | ) |
Sets counter of flushed bytes to 0.
void MLDICOMCachedIOTagCacheMap::setMaxNumMegaBytes | ( | MLint | maxNumMegaBytes | ) |
Set maximum number of mega bytes used for tag data. Values < 0 are clamped to 0.
|
friend |
Allow direct access from MLDICOMCachedIOTagCache.
Definition at line 175 of file mlDICOMCachedIOTagCacheMap.h.
|
protected |
The tag map for caching.
Definition at line 178 of file mlDICOMCachedIOTagCacheMap.h.
|
protected |
IntField specifying the maximum number of value bytes allowed in all DICOM tags.
Definition at line 191 of file mlDICOMCachedIOTagCacheMap.h.
|
protected |
Counter for number of flushed bytes since most recent resetNumFlushedBytes().
Definition at line 187 of file mlDICOMCachedIOTagCacheMap.h.
|
protected |
Stores the file names of DCMTags added to cache in the order of caching.
Definition at line 181 of file mlDICOMCachedIOTagCacheMap.h.
|
protected |
Total number of value bytes in all DICOM tags.
Definition at line 184 of file mlDICOMCachedIOTagCacheMap.h.