MeVisLab Toolbox Reference
MLDICOMCachedIOTreeCacheMap Class Reference

Class containing the DCMTree look up map and the list of most recently used DICOM files as names. More...

#include <mlDICOMCachedIOTreeCacheMap.h>

Public Member Functions

 MLDICOMCachedIOTreeCacheMap ()
 Constructor; it is initialized with 250 MB of cache for DICOM tree tag data. More...
 
 ~MLDICOMCachedIOTreeCacheMap ()
 Destructor; clears and deletes the MLDICOMCachedIODCMTreeLoaderPlugins and MLDICOMCachedIODCMTreeWriterPlugin. 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...
 
void flushSingleFrameCache ()
 Clears all cached singleFrameTrees, because they are normally excluded from normal flushing. More...
 
MLint getNumFlushedBytes () const
 Returns the number of flushed bytes since most recent recent resetNumFlushedBytes(). More...
 
void resetNumFlushedBytes ()
 Sets counter of flushed bytes to 0. More...
 
MLint getMaxNumBytes () const
 Return maximum number of bytes used for tag data. 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::IntFieldgetMaxNumMegaBytesFld ()
 Returns field that specifies the maximum number of mega bytes for tag data. More...
 
MLint getTotalNumberOfBytes () const
 Return currently number of cached tree data in bytes. More...
 
void storeSingleFrameTree (DCMTree::TreePtr singleFrameTree, const ml::DICOMCachedIOFileHandle &origFileHandle, size_t frameIndex)
 See DICOMCachedIOTreeCache::storeSingleFrameTree(). More...
 
MLErrorCode addDCMTree (const ml::DICOMCachedIOFileHandle &fileHandle, DCMTree::TreePtr &treePtr)
 See DICOMCachedIOTreeCache::addDCMTree(). More...
 
MLErrorCode getCachedDCMTree (const ml::DICOMCachedIOFileHandle &fileHandle, DCMTree::TreePtr &treePtr)
 See DICOMCachedIOTreeCache::getCachedDCMTree(). More...
 
MLErrorCode loadDCMTree (const ml::DICOMCachedIOFileHandle &fileHandle, DCMTree::TreePtr &treePtr, ml::DicomMessageCollector &dcmMsgCollector)
 See DICOMCachedIOTreeCache::loadDCMTree(). More...
 
MLErrorCode saveDCMTree (DCMTree::Const_TreePtr dcmTree, const ml::DICOMCachedIOFileHandle &fileHandle)
 See DICOMCachedIOTreeCache::saveDCMTree(). More...
 
void removeAssociatedEntries (const ml::DICOMCachedIOFileHandle &fileHandle)
 Removes cached multi-frame data and/or tree related to fileHandle. More...
 
std::vector< MLDICOMCachedIODCMTreeLoaderPlugin * > & getTreeLoaderPlugins ()
 Return modifiable vector of DICOM tree loader plugins. More...
 
const std::vector< MLDICOMCachedIODCMTreeLoaderPlugin * > & getConstTreeLoaderPlugins () const
 Return constant vector of DICOM tree loader plugins. More...
 
std::vector< MLDICOMCachedIODCMTreeWriterPlugin * > & getTreeWriterPlugins ()
 Return modifiable vector of DICOM tree writer plugins. More...
 
const std::vector< MLDICOMCachedIODCMTreeWriterPlugin * > & getConstTreeWriterPlugins () const
 Return constant vector of DICOM tree writer plugins. More...
 
void clear ()
 Clears the DICOM trees cache singleton and resets all counters. More...
 

Protected Member Functions

MLErrorCode _addDCMTree (const ml::DICOMCachedIOFileHandle &fileHandle, DCMTree::TreePtr &treePtr)
 Internal method that adds the given DICOM tree to the cache map with the specified fileHandle as key. More...
 

Protected Attributes

std::map< ml::DICOMCachedIOFileHandle, MLDICOMCachedIOTreeCacheMapEntry_cache
 The tree map. More...
 
std::map< ml::DICOMCachedIOFileHandle, MLDICOMCachedIOTreeCacheSingleMFMapEntry_singleFrameCache
 The map of SingleMultiFrame Frames extracted from multi-frame files. More...
 
std::list< ml::DICOMCachedIOFileHandle_recentlyCached
 Stores the file names of DCMTrees added to cache in the order of caching. More...
 
MLint _totalNumBytes
 Total number of bytes in all DICOM trees. More...
 
MLint _numFlushedBytes
 Counter for number of flushed bytes since most recent resetNumFlushedBytes(). More...
 
ml::IntField_limitInMegaBytesFld
 IntField specifying the maximum number of value mega bytes allowed in all DICOM trees. More...
 
std::vector< MLDICOMCachedIODCMTreeLoaderPlugin * > _treeLoaderPlugins
 Vector of loader plugins. More...
 
std::vector< MLDICOMCachedIODCMTreeWriterPlugin * > _treeWriterPlugins
 Vector of writer plugins. More...
 

Detailed Description

Class containing the DCMTree look up map and the list of most recently used DICOM files as names.

Definition at line 37 of file mlDICOMCachedIOTreeCacheMap.h.

Constructor & Destructor Documentation

◆ MLDICOMCachedIOTreeCacheMap()

MLDICOMCachedIOTreeCacheMap::MLDICOMCachedIOTreeCacheMap ( )

Constructor; it is initialized with 250 MB of cache for DICOM tree tag data.

◆ ~MLDICOMCachedIOTreeCacheMap()

MLDICOMCachedIOTreeCacheMap::~MLDICOMCachedIOTreeCacheMap ( )

Destructor; clears and deletes the MLDICOMCachedIODCMTreeLoaderPlugins and MLDICOMCachedIODCMTreeWriterPlugin.

Member Function Documentation

◆ _addDCMTree()

MLErrorCode MLDICOMCachedIOTreeCacheMap::_addDCMTree ( const ml::DICOMCachedIOFileHandle fileHandle,
DCMTree::TreePtr treePtr 
)
protected

Internal method that adds the given DICOM tree to the cache map with the specified fileHandle as key.

Does not check, if fileHandle is already present in the cache.

Parameters
fileHandleKey by which the DICOM tree is added to the cache map.
treePtrThe DICOM tree that shall be stored in the cache map.
Returns
ML_RESULT_OK on success, otherwise a code describing the error.

◆ addDCMTree()

MLErrorCode MLDICOMCachedIOTreeCacheMap::addDCMTree ( const ml::DICOMCachedIOFileHandle fileHandle,
DCMTree::TreePtr treePtr 
)

See DICOMCachedIOTreeCache::addDCMTree().

◆ clear()

void MLDICOMCachedIOTreeCacheMap::clear ( )

Clears the DICOM trees cache singleton and resets all counters.

◆ flush() [1/2]

MLint MLDICOMCachedIOTreeCacheMap::flush ( )

Same as flush(getMaxNumBytes(), false).

◆ flush() [2/2]

MLint MLDICOMCachedIOTreeCacheMap::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.

Currently the cache is organized as a FIFO list where oldest trees are flushed first.

◆ flushSingleFrameCache()

void MLDICOMCachedIOTreeCacheMap::flushSingleFrameCache ( )

Clears all cached singleFrameTrees, because they are normally excluded from normal flushing.

◆ getCachedDCMTree()

MLErrorCode MLDICOMCachedIOTreeCacheMap::getCachedDCMTree ( const ml::DICOMCachedIOFileHandle fileHandle,
DCMTree::TreePtr treePtr 
)

See DICOMCachedIOTreeCache::getCachedDCMTree().

◆ getConstTreeLoaderPlugins()

const std::vector< MLDICOMCachedIODCMTreeLoaderPlugin* >& MLDICOMCachedIOTreeCacheMap::getConstTreeLoaderPlugins ( ) const
inline

Return constant vector of DICOM tree loader plugins.

Definition at line 113 of file mlDICOMCachedIOTreeCacheMap.h.

◆ getConstTreeWriterPlugins()

const std::vector< MLDICOMCachedIODCMTreeWriterPlugin*>& MLDICOMCachedIOTreeCacheMap::getConstTreeWriterPlugins ( ) const
inline

Return constant vector of DICOM tree writer plugins.

Definition at line 119 of file mlDICOMCachedIOTreeCacheMap.h.

◆ getMaxNumBytes()

MLint MLDICOMCachedIOTreeCacheMap::getMaxNumBytes ( ) const

Return maximum number of bytes used for tag data.

◆ getMaxNumMegaBytes()

MLint MLDICOMCachedIOTreeCacheMap::getMaxNumMegaBytes ( ) const

Return maximum number of bytes used for tag data.

◆ getMaxNumMegaBytesFld()

ml::IntField& MLDICOMCachedIOTreeCacheMap::getMaxNumMegaBytesFld ( )

Returns field that specifies the maximum number of mega bytes for tag data.

◆ getNumFlushedBytes()

MLint MLDICOMCachedIOTreeCacheMap::getNumFlushedBytes ( ) const

Returns the number of flushed bytes since most recent recent resetNumFlushedBytes().

◆ getTotalNumberOfBytes()

MLint MLDICOMCachedIOTreeCacheMap::getTotalNumberOfBytes ( ) const

Return currently number of cached tree data in bytes.

◆ getTreeLoaderPlugins()

std::vector< MLDICOMCachedIODCMTreeLoaderPlugin *>& MLDICOMCachedIOTreeCacheMap::getTreeLoaderPlugins ( )
inline

Return modifiable vector of DICOM tree loader plugins.

Definition at line 110 of file mlDICOMCachedIOTreeCacheMap.h.

◆ getTreeWriterPlugins()

std::vector< MLDICOMCachedIODCMTreeWriterPlugin* >& MLDICOMCachedIOTreeCacheMap::getTreeWriterPlugins ( )
inline

Return modifiable vector of DICOM tree writer plugins.

Definition at line 116 of file mlDICOMCachedIOTreeCacheMap.h.

◆ loadDCMTree()

MLErrorCode MLDICOMCachedIOTreeCacheMap::loadDCMTree ( const ml::DICOMCachedIOFileHandle fileHandle,
DCMTree::TreePtr treePtr,
ml::DicomMessageCollector dcmMsgCollector 
)

See DICOMCachedIOTreeCache::loadDCMTree().

◆ removeAssociatedEntries()

void MLDICOMCachedIOTreeCacheMap::removeAssociatedEntries ( const ml::DICOMCachedIOFileHandle fileHandle)

Removes cached multi-frame data and/or tree related to fileHandle.

In case of a removed tree also the associated value size stored in the key is returned, otherwise in all cases 0 is returned.

◆ resetNumFlushedBytes()

void MLDICOMCachedIOTreeCacheMap::resetNumFlushedBytes ( )

Sets counter of flushed bytes to 0.

◆ saveDCMTree()

MLErrorCode MLDICOMCachedIOTreeCacheMap::saveDCMTree ( DCMTree::Const_TreePtr  dcmTree,
const ml::DICOMCachedIOFileHandle fileHandle 
)

See DICOMCachedIOTreeCache::saveDCMTree().

◆ setMaxNumMegaBytes()

void MLDICOMCachedIOTreeCacheMap::setMaxNumMegaBytes ( MLint  maxNumMegaBytes)

Set maximum number of mega bytes used for tag data. Values < 0 are clamped to 0.

◆ storeSingleFrameTree()

void MLDICOMCachedIOTreeCacheMap::storeSingleFrameTree ( DCMTree::TreePtr  singleFrameTree,
const ml::DICOMCachedIOFileHandle origFileHandle,
size_t  frameIndex 
)

See DICOMCachedIOTreeCache::storeSingleFrameTree().

Member Data Documentation

◆ _cache

std::map< ml::DICOMCachedIOFileHandle, MLDICOMCachedIOTreeCacheMapEntry> MLDICOMCachedIOTreeCacheMap::_cache
protected

The tree map.

Definition at line 135 of file mlDICOMCachedIOTreeCacheMap.h.

◆ _limitInMegaBytesFld

ml::IntField* MLDICOMCachedIOTreeCacheMap::_limitInMegaBytesFld
protected

IntField specifying the maximum number of value mega bytes allowed in all DICOM trees.

Definition at line 153 of file mlDICOMCachedIOTreeCacheMap.h.

◆ _numFlushedBytes

MLint MLDICOMCachedIOTreeCacheMap::_numFlushedBytes
protected

Counter for number of flushed bytes since most recent resetNumFlushedBytes().

Definition at line 150 of file mlDICOMCachedIOTreeCacheMap.h.

◆ _recentlyCached

std::list<ml::DICOMCachedIOFileHandle> MLDICOMCachedIOTreeCacheMap::_recentlyCached
protected

Stores the file names of DCMTrees added to cache in the order of caching.

Definition at line 144 of file mlDICOMCachedIOTreeCacheMap.h.

◆ _singleFrameCache

std::map< ml::DICOMCachedIOFileHandle, MLDICOMCachedIOTreeCacheSingleMFMapEntry> MLDICOMCachedIOTreeCacheMap::_singleFrameCache
protected

The map of SingleMultiFrame Frames extracted from multi-frame files.

These files are excluded from flushing, because they normally cannot be reconstructed. They have to be cleared manually.

Definition at line 141 of file mlDICOMCachedIOTreeCacheMap.h.

◆ _totalNumBytes

MLint MLDICOMCachedIOTreeCacheMap::_totalNumBytes
protected

Total number of bytes in all DICOM trees.

Definition at line 147 of file mlDICOMCachedIOTreeCacheMap.h.

◆ _treeLoaderPlugins

std::vector< MLDICOMCachedIODCMTreeLoaderPlugin *> MLDICOMCachedIOTreeCacheMap::_treeLoaderPlugins
protected

Vector of loader plugins.

Definition at line 156 of file mlDICOMCachedIOTreeCacheMap.h.

◆ _treeWriterPlugins

std::vector< MLDICOMCachedIODCMTreeWriterPlugin *> MLDICOMCachedIOTreeCacheMap::_treeWriterPlugins
protected

Vector of writer plugins.

Definition at line 159 of file mlDICOMCachedIOTreeCacheMap.h.


The documentation for this class was generated from the following file: