MeVisLab Toolbox Reference
mlDICOMCachedIOTreeCache.h
Go to the documentation of this file.
1// Copyright (c) Fraunhofer MEVIS, Germany. All rights reserved.
2// **InsertLicense** code
3//----------------------------------------------------------------------------------
5
9//----------------------------------------------------------------------------------
10#pragma once
11
12// Local includes
14#include "mlTypeDefs.h"
15#include "mlFields.h"
16
17// Include for FME_ML_DELETE
18#include "mlErrorMacros.h"
19
20ML_START_NAMESPACE
22template<typename CT> class DICOMCachedIOFileHandleBase;
23
25
27typedef DICOMCachedIOFileHandleBase<char> DICOMCachedIOFileHandle;
28class DicomMessageCollector;
30ML_END_NAMESPACE
31
32// DICOM
33#include <DCMTree_Lib.h>
34
35// Forwards.
37
38//----------------------------------------------------------------------------------
40//----------------------------------------------------------------------------------
42
43 public:
44
52 ~ MLDICOMCachedIOTreeCache();
53
54
55 //----------------------------------------------------------------------------------
57 //----------------------------------------------------------------------------------
58
67 MLint flush(const MLint maxBytes, const bool flushAll=false);
68
71
74
76 void setMaxNumBytes(MLint maxNumBytes);
78 void setMaxNumMegaBytes(MLint maxNumMegaBytes);
79
82
85
88
91
93 void clear();
94
97
100
101 //----------------------------------------------------------------------------------
103 //----------------------------------------------------------------------------------
104
108
109 //----------------------------------------------------------------------------------
111 //----------------------------------------------------------------------------------
112
120 const ML_NAMESPACE::DICOMCachedIOFileHandle &origFileHandle,
121 size_t frameIndex);
122
123 //----------------------------------------------------------------------------------
125 //----------------------------------------------------------------------------------
126
130 const ML_NAMESPACE::DICOMCachedIOFileHandle &fileHandle);
131
135 MLErrorCode getCachedDCMTree(const ML_NAMESPACE::DICOMCachedIOFileHandle &fileHandle,
136 DCMTree::TreePtr &treePtr);
137
140 void removeAssociatedEntries(const ML_NAMESPACE::DICOMCachedIOFileHandle &fileHandle);
141
148 MLErrorCode loadDCMTree(const ML_NAMESPACE::DICOMCachedIOFileHandle &fileHandle,
149 DCMTree::TreePtr &treePtr,
150 ML_NAMESPACE::DicomMessageCollector &dcmMsgCollector);
151
158 MLErrorCode loadConstantDCMTree(const ML_NAMESPACE::DICOMCachedIOFileHandle &fileHandle,
159 DCMTree::Const_TreePtr &treePtr,
160 ML_NAMESPACE::DicomMessageCollector &dcmMsgCollector);
161
167 MLErrorCode loadSMFTree(const ML_NAMESPACE::DICOMCachedIOFileHandle &fileHandle,
169 ML_NAMESPACE::DicomMessageCollector &dcmMsgCollector);
170
176 MLErrorCode addDCMTree(const ML_NAMESPACE::DICOMCachedIOFileHandle &fileHandle,
177 DCMTree::TreePtr &treePtr);
178
179private:
181 static MLDICOMCachedIOTreeCacheMap *_treeCachePtr;
182
184 static MLuint _instanceCounter;
185};
Project global and OS specific declarations.
#define MLDICOMCachedIO_EXPORT
If included by external modules, exported symbols are declared as import symbols.
Class containing the DCMTree look up map and the list of most recently used DICOM files as names.
Class for DICOM tree accesses and caching of them for DICOM importing modules.
void storeSingleFrameTree(DCMTree::TreePtr singleFrameTree, const ml::DICOMCachedIOFileHandle &origFileHandle, size_t frameIndex)
Single frame management of multi-frame files.
void setMaxNumBytes(MLint maxNumBytes)
Set maximum number of bytes used for tree data. Values < 0 are clamped to 0.
void flushSingleFrameCache()
Clears all cached singleFrameTrees, because they are normally excluded from normal flushing.
MLint getMaxNumMegaBytes() const
Return maximum number of bytes used for tree data.
static MLDICOMCachedIOTreeCache singletonProxy()
Singleton and cache management.
MLint getNumFlushedBytes() const
Returns the number of flushed bytes since most recent recent resetNumFlushedBytes().
MLErrorCode loadSMFTree(const ml::DICOMCachedIOFileHandle &fileHandle, DCMTree::StructuredMFPtr &smfPtr, ml::DicomMessageCollector &dcmMsgCollector)
Loads the given DICOM tree specified by fileName into smfPtr.
MLint flush(const MLint maxBytes, const bool flushAll=false)
Singleton and cache management.
MLDICOMCachedIOTreeCache(const MLDICOMCachedIOTreeCache &)=delete
Delete copy constructor to prevent usage.
void removeAssociatedEntries(const ml::DICOMCachedIOFileHandle &fileHandle)
Removed cached multi-frame data and/or tree related to fileHandle.
MLint getTotalNumberOfBytes() const
Returns the approximate number of cached bytes in trees.
void setMaxNumMegaBytes(MLint maxNumMegaBytes)
Set maximum number of mega bytes used for tree data. Values < 0 are clamped to 0.
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 fileHan...
ml::IntField & getMaxNumMegaBytesFld() const
Return field that holds the maximum number of mega bytes used for tree data.
MLDICOMCachedIOTreeCache & operator=(const MLDICOMCachedIOTreeCache &)=delete
Delete assignment operator to prevent usage.
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 saveDCMTree(DCMTree::Const_TreePtr dcmTree, const ml::DICOMCachedIOFileHandle &fileHandle)
DCMTree IO Support.
MLErrorCode loadConstantDCMTree(const ml::DICOMCachedIOFileHandle &fileHandle, DCMTree::Const_TreePtr &treePtr, ml::DicomMessageCollector &dcmMsgCollector)
Loads the given constant DICOM tree specified by fileHandle into treePtr.
void resetNumFlushedBytes()
Sets counter of flushed bytes to 0.
MLDICOMCachedIOTreeCache()
Constructor. Increments the reference counting and creates a cache if the count is 0.
void clear()
Clears the DICOM trees cache map.
MLint flush()
Same as flush(getMaxNumBytes(), false).
MLint getMaxNumBytes() const
Return maximum number of bytes used for tree data.
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 t...
Field to encapsulate an integer value.
Definition mlFields.h:117
MLint32 MLErrorCode
Type of an ML Error code.
Definition mlTypeDefs.h:715
MLuint64 MLuint
An unsigned ML integer type with at least 64 bits used for index calculations on very large images ev...
Definition mlTypeDefs.h:505
MLint64 MLint
A signed ML integer type with at least 64 bits used for index calculations on very large images even ...
Definition mlTypeDefs.h:489
boost::shared_ptr< StructuredMF > StructuredMFPtr
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
DICOMCachedIOFileHandleBase< char > DICOMCachedIOFileHandle
"Forward" to DICOMCachedIOFileHandle.