MeVisLab Toolbox Reference
|
Class for DICOM tree accesses and caching of them for DICOM importing modules. More...
#include <mlDICOMCachedIOTreeCache.h>
Public Member Functions | |
MLDICOMCachedIOTreeCache () | |
Constructor. Increments the reference counting and creates a cache if the count is 0. | |
~MLDICOMCachedIOTreeCache () | |
Destructor. Decrements the reference counting and deletes the cache if the new count is 0. | |
MLint | flush (const MLint maxBytes, const bool flushAll=false) |
Singleton and cache management. | |
MLint | flush () |
Same as flush(getMaxNumBytes(), false). | |
void | flushSingleFrameCache () |
Clears all cached singleFrameTrees, because they are normally excluded from normal flushing. | |
void | setMaxNumBytes (MLint maxNumBytes) |
Set maximum number of bytes used for tree data. Values < 0 are clamped to 0. | |
void | setMaxNumMegaBytes (MLint maxNumMegaBytes) |
Set maximum number of mega bytes used for tree data. Values < 0 are clamped to 0. | |
MLint | getMaxNumBytes () const |
Return maximum number of bytes used for tree data. | |
MLint | getMaxNumMegaBytes () const |
Return maximum number of bytes used for tree data. | |
MLint | getTotalNumberOfBytes () const |
Returns the approximate number of cached bytes in trees. | |
ml::IntField & | getMaxNumMegaBytesFld () const |
Return field that holds the maximum number of mega bytes used for tree data. | |
void | clear () |
Clears the DICOM trees cache map. | |
MLint | getNumFlushedBytes () const |
Returns the number of flushed bytes since most recent recent resetNumFlushedBytes(). | |
void | resetNumFlushedBytes () |
Sets counter of flushed bytes to 0. | |
void | storeSingleFrameTree (DCMTree::TreePtr singleFrameTree, const ml::DICOMCachedIOFileHandle &origFileHandle, size_t frameIndex) |
Single frame management of multi-frame files. | |
MLErrorCode | saveDCMTree (DCMTree::Const_TreePtr dcmTree, const ml::DICOMCachedIOFileHandle &fileHandle) |
DCMTree IO Support. | |
MLErrorCode | getCachedDCMTree (const ml::DICOMCachedIOFileHandle &fileHandle, DCMTree::TreePtr &treePtr) |
Returns ML_RESULT_OK if the DICOM file given by fileName is already cached and then treePtr returns the related DCMTree, otherwise treePtr is reset to a nullptr pointer and an error code describing the cause is returned. | |
void | removeAssociatedEntries (const ml::DICOMCachedIOFileHandle &fileHandle) |
Removed cached multi-frame data and/or tree related to fileHandle. | |
MLErrorCode | loadDCMTree (const ml::DICOMCachedIOFileHandle &fileHandle, DCMTree::TreePtr &treePtr, ml::DicomMessageCollector &dcmMsgCollector) |
Loads the given non-constant DICOM tree specified by fileHandle into treePtr. | |
MLErrorCode | loadConstantDCMTree (const ml::DICOMCachedIOFileHandle &fileHandle, DCMTree::Const_TreePtr &treePtr, ml::DicomMessageCollector &dcmMsgCollector) |
Loads the given constant DICOM tree specified by fileHandle into treePtr. | |
MLErrorCode | loadSMFTree (const ml::DICOMCachedIOFileHandle &fileHandle, DCMTree::StructuredMFPtr &smfPtr, ml::DicomMessageCollector &dcmMsgCollector) |
Loads the given DICOM tree specified by fileName into smfPtr. | |
MLErrorCode | addDCMTree (const ml::DICOMCachedIOFileHandle &fileHandle, DCMTree::TreePtr &treePtr) |
If no entry with the file handle exists, then it adds treePtr to the cache with the specified fileHandle as key; if the entry exists ML_OBJECT_OR_FILE_EXISTS is returned. | |
Static Public Member Functions | |
static MLDICOMCachedIOTreeCache | singletonProxy () |
Singleton and cache management. | |
Class for DICOM tree accesses and caching of them for DICOM importing modules.
Definition at line 41 of file mlDICOMCachedIOTreeCache.h.
MLDICOMCachedIOTreeCache::MLDICOMCachedIOTreeCache | ( | ) |
Constructor. Increments the reference counting and creates a cache if the count is 0.
MLDICOMCachedIOTreeCache::~MLDICOMCachedIOTreeCache | ( | ) |
Destructor. Decrements the reference counting and deletes the cache if the new count is 0.
MLErrorCode MLDICOMCachedIOTreeCache::addDCMTree | ( | const ml::DICOMCachedIOFileHandle & | fileHandle, |
DCMTree::TreePtr & | treePtr ) |
If no entry with the file handle exists, then it adds treePtr to the cache with the specified fileHandle as key; if the entry exists ML_OBJECT_OR_FILE_EXISTS is returned.
fileHandle | Key by which the DICOM tree is added to the cache map. |
treePtr | The DICOM tree that shall be stored in the cache map. |
void MLDICOMCachedIOTreeCache::clear | ( | ) |
Clears the DICOM trees cache map.
MLint MLDICOMCachedIOTreeCache::flush | ( | ) |
Same as flush(getMaxNumBytes(), false).
Singleton and cache management.
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.
void MLDICOMCachedIOTreeCache::flushSingleFrameCache | ( | ) |
Clears all cached singleFrameTrees, because they are normally excluded from normal flushing.
MLErrorCode MLDICOMCachedIOTreeCache::getCachedDCMTree | ( | const ml::DICOMCachedIOFileHandle & | fileHandle, |
DCMTree::TreePtr & | treePtr ) |
Returns ML_RESULT_OK if the DICOM file given by fileName is already cached and then treePtr returns the related DCMTree, otherwise treePtr is reset to a nullptr pointer and an error code describing the cause is returned.
MLint MLDICOMCachedIOTreeCache::getMaxNumBytes | ( | ) | const |
Return maximum number of bytes used for tree data.
MLint MLDICOMCachedIOTreeCache::getMaxNumMegaBytes | ( | ) | const |
Return maximum number of bytes used for tree data.
ml::IntField & MLDICOMCachedIOTreeCache::getMaxNumMegaBytesFld | ( | ) | const |
Return field that holds the maximum number of mega bytes used for tree data.
MLint MLDICOMCachedIOTreeCache::getNumFlushedBytes | ( | ) | const |
Returns the number of flushed bytes since most recent recent resetNumFlushedBytes().
MLint MLDICOMCachedIOTreeCache::getTotalNumberOfBytes | ( | ) | const |
Returns the approximate number of cached bytes in trees.
MLErrorCode MLDICOMCachedIOTreeCache::loadConstantDCMTree | ( | const ml::DICOMCachedIOFileHandle & | fileHandle, |
DCMTree::Const_TreePtr & | treePtr, | ||
ml::DicomMessageCollector & | dcmMsgCollector ) |
Loads the given constant DICOM tree specified by fileHandle into treePtr.
fileHandle | Full path to DICOM tree file to be loaded. |
treePtr | The loaded DICOM tree. |
dcmMsgCollector | Collects error, info and issue messages (typically related to a handle). |
MLErrorCode MLDICOMCachedIOTreeCache::loadDCMTree | ( | const ml::DICOMCachedIOFileHandle & | fileHandle, |
DCMTree::TreePtr & | treePtr, | ||
ml::DicomMessageCollector & | dcmMsgCollector ) |
Loads the given non-constant DICOM tree specified by fileHandle into treePtr.
fileHandle | Full path to DICOM tree file to be loaded. |
treePtr | The loaded DICOM tree. |
dcmMsgCollector | Collects error, info and issue messages (typically related to a handle). |
MLErrorCode MLDICOMCachedIOTreeCache::loadSMFTree | ( | const ml::DICOMCachedIOFileHandle & | fileHandle, |
DCMTree::StructuredMFPtr & | smfPtr, | ||
ml::DicomMessageCollector & | dcmMsgCollector ) |
Loads the given DICOM tree specified by fileName into smfPtr.
fileHandle | Full path to SMF DICOM tree file to be loaded. |
smfPtr | The structured MF used to wrap the loaded tree. |
dcmMsgCollector | Collects error, info and issue messages (typically related to a handle). |
void MLDICOMCachedIOTreeCache::removeAssociatedEntries | ( | const ml::DICOMCachedIOFileHandle & | fileHandle | ) |
Removed 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.
void MLDICOMCachedIOTreeCache::resetNumFlushedBytes | ( | ) |
Sets counter of flushed bytes to 0.
MLErrorCode MLDICOMCachedIOTreeCache::saveDCMTree | ( | DCMTree::Const_TreePtr | dcmTree, |
const ml::DICOMCachedIOFileHandle & | fileHandle ) |
DCMTree IO Support.
Saves the given DICOM tree in the file specified by fileHandle. Returns ML_RESULT_OK on success, otherwise a code describing the error.
Set maximum number of bytes used for tree data. Values < 0 are clamped to 0.
Set maximum number of mega bytes used for tree data. Values < 0 are clamped to 0.
|
static |
Singleton and cache management.
Singleton returning the global DCMTree cache map. The instance will be created automatically if still not existent.
void MLDICOMCachedIOTreeCache::storeSingleFrameTree | ( | DCMTree::TreePtr | singleFrameTree, |
const ml::DICOMCachedIOFileHandle & | origFileHandle, | ||
size_t | frameIndex ) |
Single frame management of multi-frame files.
Adds a new handle and tree to the cache of single frames. Note that single frame trees are excluded from flushing. They must be cleared explicitly cache with the flushSingleFrameCache() command.