MeVisLab Toolbox Reference
mlDICOMCachedIOTools.h
Go to the documentation of this file.
1 // Copyright (c) Fraunhofer MEVIS, Germany. All rights reserved.
2 // **InsertLicense** code
3 //----------------------------------------------------------------------------------
5 
10 //----------------------------------------------------------------------------------
11 #pragma once
12 
13 // Local includes
14 #include "MLDICOMCachedIOSystem.h"
15 #include "mlTypeDefs.h"
16 
17 #include <ThirdPartyWarningsDisable.h>
18 #include <string>
19 #include <sstream>
20 #include <ThirdPartyWarningsRestore.h>
21 
22 #include <DCMTree_Lib.h>
23 
24 ML_START_NAMESPACE
25 
26 class DicomMessageCollector;
27 
29 template<typename CT> class DICOMCachedIOFileHandleBase;
30 
32 
34 typedef DICOMCachedIOFileHandleBase<char> DICOMCachedIOFileHandle;
36 
37 namespace DICOMCachedIOTools {
38 
44 
54  const std::string &callersMessage,
55  size_t outStrMaxSize = std::string::npos,
56  bool addClampInfo = true);
57 
67 MLDICOMCachedIO_EXPORT void redirectStream(std::ostream &outputStream,
68  std::streambuf *&tempBuf,
69  std::stringbuf *&stringBuffer);
70 
86 MLDICOMCachedIO_EXPORT std::string unRedirectStream(std::ostream &outputStream,
87  std::streambuf *&tmpBuf,
88  std::stringbuf *&stringBuffer,
89  size_t outStrMaxSize = std::string::npos,
90  bool addClampInfo = true);
91 
92 
98 
111  DicomMessageCollector &dcmMsgCollector,
112  bool loadPixelData=false);
113 
116 
119 
122 
125 
129 
132 MLDICOMCachedIO_EXPORT DCMTree::Const_TagPtr getPrivateTag(const std::string &privateCreatorString,
133  unsigned short groupId,
134  DCMTree::RawTagId lowerEightBitOfElementId,
135  DCMTree::Const_TreePtr dcmTree);
136 
140  MLint *spatialExtent=nullptr);
141 
147  unsigned int *fromTagOnly=nullptr);
148 
159  size_t *valSizeInBytes,
160  DicomMessageCollector &dcmMsgCollector);
161 
164 
167 
168 } // namespace DICOMCachedIOTools
169 
170 ML_END_NAMESPACE
Project global and OS specific declarations.
#define MLDICOMCachedIO_EXPORT
If included by external modules, exported symbols are declared as import symbols.
Class to collect messages and errors related to a given frame handle.
MLint64 MLint
A signed ML integer type with at least 64 bits used for index calculations on very large images even ...
Definition: mlTypeDefs.h:578
boost::shared_ptr< const Tag > Const_TagPtr
Definition: DCMTree_Lib.h:63
boost::shared_ptr< const Tree > Const_TreePtr
Definition: DCMTree_Lib.h:73
TransferSyntax
DICOM transfer syntaxes.
Definition: DCMTree_Lib.h:238
boost::shared_ptr< Tree > TreePtr
shared pointer to a DCMTree::Tree
Definition: DCMTree_Lib.h:70
unsigned int RawTagId
Definition: DCMTree_Lib.h:147
MLDICOMCachedIO_EXPORT bool isPhilips3D(DCMTree::Const_TreePtr dcmTree, MLint *spatialExtent=nullptr)
Looks for Philips3D format and if there is an extra spatial extent then it is returned in spatialExte...
MLDICOMCachedIO_EXPORT unsigned int getNumberOfFrames(DCMTree::Const_TreePtr dcmTree, unsigned int *fromTagOnly=nullptr)
Returns the number of real frames in the data set from Number of Frames tag if possible including a p...
MLDICOMCachedIO_EXPORT DCMTree::PixelData getPixelDataPtrFromTree(DCMTree::Const_TreePtr treePtr, size_t *valSizeInBytes, DicomMessageCollector &dcmMsgCollector)
Returns the pointer to the pixel data tag value.
MLDICOMCachedIO_EXPORT DCMTree::TreePtr getDirectDCMTree(const std::string &fName, DicomMessageCollector &dcmMsgCollector, bool loadPixelData=false)
Tries to open a file directly by reading it with the DCMTree interfaces and returns a non constant Tr...
MLDICOMCachedIO_EXPORT void pushMessageCollecting()
Takes current message handles of DCMTree library and uses redirectStream() to push current handler an...
MLDICOMCachedIO_EXPORT void redirectStream(std::ostream &outputStream, std::streambuf *&tempBuf, std::stringbuf *&stringBuffer)
Redirect outputs to outputStream into the temporary buffer tmpBuf.
MLDICOMCachedIO_EXPORT DCMTree::TransferSyntax LosslessTransferSyntaxCodes[NumLosslessTransferSyntaxes]
DCMTree::TransferSyntax enums for supported lossless compression transfer syntax.
MLDICOMCachedIO_EXPORT const char *const LosslessTransferSyntaxNames[NumLosslessTransferSyntaxes]
Supported lossless compression transfer syntax names.
MLDICOMCachedIO_EXPORT void clearDICOMCaches()
Clears all cached DICOM date including tags, trees, pixel frames and decomposed multi-frame trees.
MLDICOMCachedIO_EXPORT DCMTree::TransferSyntax getLosslessStorageTransferSyntax(DCMTree::Const_TreePtr dcmTree)
If dcmTree has a TransferSyntaxUID tag matching one form LosslessTransferSyntaxUIDs then the correspo...
MLDICOMCachedIO_EXPORT void removeAssociatedCacheEntries(const DICOMCachedIOFileHandle &fileHandle)
Flush all cached entries related to the given file handle.
MLDICOMCachedIO_EXPORT void makeWarningsWarningsAndErrorsErrors(std::string &messageString)
Some messages for example from DCMTree(_OFFIS) are not marked with "error" or "warnings" and cannot b...
MLDICOMCachedIO_EXPORT DCMTree::Const_TagPtr getPrivateTag(const std::string &privateCreatorString, unsigned short groupId, DCMTree::RawTagId lowerEightBitOfElementId, DCMTree::Const_TreePtr dcmTree)
If a private creator tag with value privateCreatorString in a private slot with groupId and a tag wit...
MLDICOMCachedIO_EXPORT const char *const LosslessTransferSyntaxUIDs[NumLosslessTransferSyntaxes]
Supported lossless compression transfer syntax UIDs.
MLDICOMCachedIO_EXPORT void popMessageCollecting(DicomMessageCollector &dcmMsgCollector, const std::string &callersMessage, size_t outStrMaxSize=std::string::npos, bool addClampInfo=true)
Restores states which must have been saved before with pushMessageCollecting() and sends collected (a...
MLDICOMCachedIO_EXPORT std::string unRedirectStream(std::ostream &outputStream, std::streambuf *&tmpBuf, std::stringbuf *&stringBuffer, size_t outStrMaxSize=std::string::npos, bool addClampInfo=true)
Undo the redirected output of outputStream into the temporary buffer tmpBuf.
DICOMCachedIOFileHandleBase< char > DICOMCachedIOFileHandle
"Forward" to DICOMCachedIOFileHandle.
Contains pixel data which is either shared/ref counted or a direct pointer.
Definition: DCMTree_Lib.h:105