MeVisLab Toolbox Reference
mlZTUFileNameSet.h
Go to the documentation of this file.
1// Copyright (c) Fraunhofer MEVIS, Germany. All rights reserved.
2// **InsertLicense** code
3//----------------------------------------------------------------------------------
6
11//----------------------------------------------------------------------------------
12
13#pragma once
14
18#include <mlZTUIndex.h>
19#include <mlTypeDefs.h>
20#include <DCMTree_Tree.h>
21
22#include <FMEThirdPartyWarningsDisable.h>
23#include <map>
24#include <string>
25#include <vector>
26#include <FMEThirdPartyWarningsRestore.h>
27
28ML_START_NAMESPACE
29
30class DicomMessageCollector;
31
35 public:
38
40 ZTUFileNameSet(const ZTUFileNameSet &otherObject);
41
44
48 typedef std::vector< std::vector< std::vector<DICOMCachedIOFileHandle > > > FileNameSet;
49
51 inline ZTUFileNameSet &operator=(const ZTUFileNameSet &otherObj)
52 {
53 if (&otherObj != this){
54 // Do not/cannot assign cacheProxies!
55 _pageFileNames = otherObj._pageFileNames;
56 }
57 return *this;
58 }
59
61 inline bool operator==(const ZTUFileNameSet &otherObj) const
62 {
63 return _pageFileNames == otherObj._pageFileNames;
64 }
65
67 inline bool operator!=(const ZTUFileNameSet &otherObj) const
68 {
69 return !operator==(otherObj);
70 }
71
74
76 bool hasMultiFrameHandle() const;
77
81
87 bool allHandlesExistAsFile(bool allowEmpty) const;
88
92
96 void resizePageFileNamesToVolumeSize(size_t newZExt, size_t newTExt, size_t newUExt);
97
99 inline void clearPageFileNames() {
100 _pageFileNames.clear();
101 }
102
104 inline const FileNameSet &getConstPageFileNameSet() const {
105 return _pageFileNames;
106 };
107
110 return _pageFileNames;
111 };
112
114 inline void setPageFileNames(const FileNameSet& pFNames) {
115 _pageFileNames = pFNames;
116 }
117
119 size_t getZExtent() const;
120
123 size_t getTExtentAt(size_t z = 0) const;
124
126 size_t getTExtent() const;
127
130 size_t getUExtentAt(size_t z = 0, size_t t = 0) const;
131
133 size_t getUExtent() const;
134
136 size_t getNumFrames() const;
137
140 bool isValidPosition(size_t z, size_t t, size_t u) const;
141
144 const DICOMCachedIOFileHandle &getPageFileName(size_t z, size_t t, size_t u=0) const;
145
149 void setPageFileName(size_t z, size_t t, size_t u, const std::string fName);
150
154 void appendFileName(const std::string& fileName, bool appendToZ);
155
157 void appendFileNameToZ(const std::string& fileName);
158
160 void appendFileNameToT(const std::string& fileName);
161
163 void appendFileNameToU(const std::string& fileName);
164
170 std::string getFileNameSetAsInfoString(bool fileNamesOnly = false) const;
171
175
179
183 std::vector<DICOMCachedIOFileHandle> getAllFileHandles(const DICOMTagTools::ZTUVector &suppressedHandles =
185
195 std::string getStateAsString(const std::string& lineEndStr,
196 const std::string& cacheFileRootDirPath,
197 bool useRelativePaths) const;
198
210 MLErrorCode setStateFromString(const std::string & state,
211 size_t tExt,
212 size_t uExt,
213 const std::string& cacheDirPath,
214 size_t& readPos);
215
228 bool searchFrameWithSOPInstanceUID(const std::string &sopInstanceUID,
229 DICOMCachedIOFileHandle &foundHandle,
230 DICOMTagTools::ZTUIndex &ztuPosition,
231 bool forceSearchInEnhancedHandles,
232 DicomMessageCollector &dcmMsgCollector) const;
233
247 bool searchFrameWithValueInTag(unsigned int tagId,
248 const std::string &tagValue,
249 DICOMCachedIOFileHandle &foundHandle,
250 DICOMTagTools::ZTUIndex &ztuPosition,
251 bool forceSearchInEnhancedHandles,
252 DicomMessageCollector &dcmMsgCollector) const;
253
255 typedef std::map<DICOMTagTools::ZTUIndex, DCMTree::Const_TagPtr> TagsWithPositionMap;
256
275 bool forceSearchInEnhancedHandles,
276 bool doStringToValue,
277 DicomMessageCollector &dcmMsgCollector,
278 bool createNullTagEntries=false,
279 const std::string &nullEntryTagValue="",
280 bool createNotConvertibleTagEntries=false,
281 const std::string &nonConvertibleTagValue="") const;
282
293 bool needsNewSOPInstanceUID(bool allowOneToOneEnhancedFrameRecomposition,
294 DicomMessageCollector &dcmMsgCollector) const;
295
296 private:
305 DCMTree::Const_TagPtr _getTagFromHandle(const DICOMCachedIOFileHandle &frameHandle,
306 unsigned int tagId,
307 bool forceSearchInEnhancedHandles,
308 DicomMessageCollector &dcmMsgCollector) const;
309
311 MLDICOMCachedIOProxies _cacheProxies;
312
315 FileNameSet _pageFileNames;
316};
317
320
321ML_END_NAMESPACE
Project global and OS specific declarations.
#define ML_MLToDicomTools_EXPORT
Only for diagnostic purposes.
Class managing a multi-frame Z, T, and U-dimension plus a string value.
Definition mlZTUIndex.h:26
Class to collect messages and errors related to a given frame handle.
bool hasMultiFrameHandle() const
Returns true if any page file name is an enhanced multi-frame handle, otherwise false.
MLErrorCode setStateFromString(const std::string &state, size_t tExt, size_t uExt, const std::string &cacheDirPath, size_t &readPos)
void clearPageFileNames()
Resets the file name set to extent 0 in all dimensions.
~ZTUFileNameSet()
Destructor.
void setPageFileNames(const FileNameSet &pFNames)
Set entire set of file names at once.
DICOMCachedIOFileHandle getOriginalFrameHandle() const
size_t getUExtentAt(size_t z=0, size_t t=0) const
bool searchFrameWithSOPInstanceUID(const std::string &sopInstanceUID, DICOMCachedIOFileHandle &foundHandle, DICOMTagTools::ZTUIndex &ztuPosition, bool forceSearchInEnhancedHandles, DicomMessageCollector &dcmMsgCollector) const
std::map< DICOMTagTools::ZTUIndex, DCMTree::Const_TagPtr > TagsWithPositionMap
Map of pairs of ZTU frame position with associated tag pointer.
ZTUFileNameSet(const ZTUFileNameSet &otherObject)
Copy constructor.
FileNameSet & getModifiablePageFileNameSet()
Returns the entire set of file names as modifiable object.
TagsWithPositionMap getTagFromAllFrames(unsigned int tagId, bool forceSearchInEnhancedHandles, bool doStringToValue, DicomMessageCollector &dcmMsgCollector, bool createNullTagEntries=false, const std::string &nullEntryTagValue="", bool createNotConvertibleTagEntries=false, const std::string &nonConvertibleTagValue="") const
bool areAllEntriesIdentical() const
bool allHandlesExistAsFile(bool allowEmpty) const
bool operator!=(const ZTUFileNameSet &otherObj) const
Returns false if the passed FileNameSets equals this, otherwise true.
std::vector< std::vector< std::vector< DICOMCachedIOFileHandle > > > FileNameSet
size_t getNumFrames() const
Returns the entire number of file names in set.
bool operator==(const ZTUFileNameSet &otherObj) const
Returns true if the passed FileNameSets equals this, otherwise false.
size_t getTExtent() const
Returns the maximum extent of the file set in T-dimension in all z entries.
size_t getZExtent() const
Returns the extent of the file set in Z-dimension.
void appendFileName(const std::string &fileName, bool appendToZ)
void appendFileNameToU(const std::string &fileName)
Append a file name to the u-dimension at z/t-position 0.
void appendFileNameToT(const std::string &fileName)
Append the file name to the t dimension at z-position 0.
bool searchFrameWithValueInTag(unsigned int tagId, const std::string &tagValue, DICOMCachedIOFileHandle &foundHandle, DICOMTagTools::ZTUIndex &ztuPosition, bool forceSearchInEnhancedHandles, DicomMessageCollector &dcmMsgCollector) const
std::vector< DICOMCachedIOFileHandle > getAllFileHandles(const DICOMTagTools::ZTUVector &suppressedHandles=DICOMTagTools::ZTUVector()) const
DICOMCachedIOFileHandle getFirstNonEmptyFileName() const
bool needsNewSOPInstanceUID(bool allowOneToOneEnhancedFrameRecomposition, DicomMessageCollector &dcmMsgCollector) const
size_t getUExtent() const
Returns the maximum extent of the file set in U-dimension in all z and u entries.
ZTUFileNameSet & operator=(const ZTUFileNameSet &otherObj)
Assign members without cacheProxies.
void appendFileNameToZ(const std::string &fileName)
Append a file name to the z-dimension (there the extents in t and u are set to 1).
void setPageFileName(size_t z, size_t t, size_t u, const std::string fName)
const DICOMCachedIOFileHandle & getPageFileName(size_t z, size_t t, size_t u=0) const
bool isValidPosition(size_t z, size_t t, size_t u) const
const FileNameSet & getConstPageFileNameSet() const
Returns the entire set of file names as constant.
ZTUFileNameSet()
Constructor.
bool hasEmptyPagesFileName() const
Returns true if any page file name is an empty string, otherwise false..
size_t getTExtentAt(size_t z=0) const
bool hasNormalFrameHandle() const
std::string getStateAsString(const std::string &lineEndStr, const std::string &cacheFileRootDirPath, bool useRelativePaths) const
std::string getFileNameSetAsInfoString(bool fileNamesOnly=false) const
void resizePageFileNamesToVolumeSize(size_t newZExt, size_t newTExt, size_t newUExt)
MLint32 MLErrorCode
Type of an ML Error code.
Definition mlTypeDefs.h:715
Header file of class ZTUIndex managing a multi-frame Z, T, and U-dimension plus a string value.
boost::shared_ptr< const Tag > Const_TagPtr
Definition DCMTree_Lib.h:57
std::vector< ZTUIndex > ZTUVector
Definition mlZTUIndex.h:70
ZTUFileNameSet DirectDicomImportPageFileNameSet
For backward compatibility to DirectDicomImport applications:
DICOMCachedIOFileHandleBase< char > DICOMCachedIOFileHandle
"Forward" to DICOMCachedIOFileHandle.