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
15#include "mlTypeDefs.h"
16
17#include <FMEThirdPartyWarningsDisable.h>
18#include <string>
19#include <sstream>
20#include <FMEThirdPartyWarningsRestore.h>
21
22#include <DCMTree_Lib.h>
23
25
26class DicomMessageCollector;
27
29template<typename CT> class DICOMCachedIOFileHandleBase;
30
32
34typedef DICOMCachedIOFileHandleBase<char> DICOMCachedIOFileHandle;
36
37namespace DICOMCachedIOTools {
38
44
54 const std::string &callersMessage,
55 size_t outStrMaxSize = std::string::npos,
56 bool addClampInfo = true);
57
68 std::streambuf *&tempBuf,
69 std::stringbuf *&stringBuffer);
70
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
118MLDICOMCachedIO_EXPORT extern const char * const LosslessTransferSyntaxUIDs[NumLosslessTransferSyntaxes];
119
121MLDICOMCachedIO_EXPORT extern const char * const LosslessTransferSyntaxNames[NumLosslessTransferSyntaxes];
122
124MLDICOMCachedIO_EXPORT extern DCMTree::TransferSyntax LosslessTransferSyntaxCodes[NumLosslessTransferSyntaxes];
125
129
133 unsigned short groupId,
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
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.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
MLint64 MLint
A signed ML integer type with at least 64 bits used for index calculations on very large images even ...
Definition mlTypeDefs.h:490
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.
boost::shared_ptr< Tree > TreePtr
shared pointer to a DCMTree::Tree
Definition DCMTree_Lib.h:72
unsigned int RawTagId
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 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 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.