MeVisLab Toolbox Reference
mlDirectDicomImportDPLTagValueProvider.h
Go to the documentation of this file.
1// Copyright (c) Fraunhofer MEVIS, Germany. All rights reserved.
2// **InsertLicense** code
3//----------------------------------------------------------------------------------
5
11
12//----------------------------------------------------------------------------------
13#pragma once
14
15// Local includes
17
18// ML includes
19#include <mlTypeDefs.h>
20#include <FMEThirdPartyWarningsDisable.h>
21#include <map>
22#include <string>
23#include <vector>
24#include <FMEThirdPartyWarningsRestore.h>
25#include <mlConstantString.h>
27
28// Needed DPL includes for the provider.
29#include "DPL_TagValueProvider.h"
30#include "DPL_TagValue.h"
31#include "DCMTree_TagId.h"
32
33namespace DPL {
34 class ErrorInfo;
35 class Logger;
36 class TagInfo;
37}
38
39ML_START_NAMESPACE
40
41// Forwards
42class DirectDicomImportImporterBase;
43
44//----------------------------------------------------------------------------------
46//----------------------------------------------------------------------------------
47typedef std::map< std::string, int> FileLoadStateLookUp;
48
49//----------------------------------------------------------------------------------
54//----------------------------------------------------------------------------------
56{
57public:
58
59 //----------------------------------------------------------------------------------
61 //----------------------------------------------------------------------------------
62 typedef struct {
65
67 std::string val;
68
70
77 const std::vector<HardOverwriteTag> &hardOverwriteTags);
78
81 void setAllowSortingAccordingToDimensionIndexValues(const std::string &allowMode);
82
85
89 void setWorkaroundImageOrientationPatientTag(const std::string &workaroundValue);
90
92 const std::string &getWorkaroundImageOrientationPatientTag() const;
93
96
105 DPL::TagValue getTagValue(const DPL::FrameId fullFilePath,
106 const DPL::TagInfo &tagInfo,
107 DPL::ErrorInfo *error = nullptr) const override;
108
109private:
110
113 void _setUpFrameName(const DPL::FrameId fullFilePath,
114 DPL::ErrorInfo *error) const;
115
128 bool _loadTagFromFrameId(const DPL::TagInfo &tagInfo,
129 DPL::ErrorInfo *error,
130 DCMTree::Const_TagPtr &loadedTagPtr,
131 ML_NAMESPACE::DicomMessageCollector &dcmMsgCollector) const;
132
136 void _calculateTagValueForNonFoundTags(const DPL::TagInfo &tagInfo,
137 std::string &tagValToReturn) const;
138
142 void _handleMissingSeriesInstanceUID(const std::string &modality,
143 std::string &tagValToReturn) const;
144
156 void _handleMissingImagePositionPatient(const std::string &modality,
157 std::string &tagValToReturn) const;
158
162 void _handleMissingImageOrientationPatient(const std::string &modality,
163 std::string &tagValToReturn) const;
164
168 bool _applyHardOverWriteTags(DCMTree::RawTagId rawTagId,
169 std::string &tagValueToReturn) const;
170
175 void _getTagValueFromTag(const DPL::TagInfo &tagInfo,
176 const DCMTree::Tag &tag,
177 DPL::ErrorInfo *error,
178 std::string &tagValueToReturn,
179 int &numValues) const;
180
182 DPL::Logger &_logger;
183
185 enum { DDI_FILE_PATH_NOT_IN_MAP = -1,
186 DDI_FILE_LOAD_FAILED = 0,
187 DDI_FILE_LOAD_SUCCESSFUL = 1} DDIFileLoadState;
188
190 std::vector<HardOverwriteTag> _hardOverwriteTags;
191
194
197
199 mutable ConstantString _frameName;
200
202 std::string _allowSortingAccordingToDimensionIndexValues;
203
205 std::string _workaroundImageOrientationPatientTag;
207
209 mutable DicomMessageCollector _dcmMsgCollector;
210
211 private:
213
218
222 typedef std::map<std::string, DCMTree::RawTagId> _LocalTagIdMap;
224 mutable _LocalTagIdMap _tagIdLookup;
225};
226
227
228ML_END_NAMESPACE
Project global and OS specific declarations.
#define MLDIRECTDICOMIMPORT_EXPORT
Only for diagnostic purposes.
Class to represent one DICOM tag.
Definition DCMTree_Tag.h:43
A ConstantString that contains a std::string and its hash.
Class to collect messages and errors related to a given frame handle.
An DPL::TagValueProvider class for the DirectDicomImport module.
DPL::TagValue getTagValue(const DPL::FrameId fullFilePath, const DPL::TagInfo &tagInfo, DPL::ErrorInfo *error=nullptr) const override
Retrieves the value for the tag in the specified DICOM file.
const ConstantString & getFrameName() const
The frame name from which the recent tag was retrieved.
void setAllowSortingAccordingToDimensionIndexValues(const std::string &allowMode)
Determines whether or how the DimensionIndexValue tag value can be used instead of a missing ImagePos...
void setWorkaroundImageOrientationPatientTag(const std::string &workaroundValue)
The default ImageOrientationPatient tag to be used instead of a non existing one for the case that an...
DirectDicomImportDPLTagValueProvider(DPL::Logger &logger, DirectDicomImportImporterBase &importer, const std::vector< HardOverwriteTag > &hardOverwriteTags)
Constructs a new TagValueProviderExample with the base directory.
const std::string & setAllowSortingAccordingToDimensionIndexValues() const
Returns the value set by setAllowSortingAccordingToDimensionIndexValues.
const std::string & getWorkaroundImageOrientationPatientTag() const
Returns the value set by setWorkaroundImageOrientationPatientTag.
Base importer class for the DirectDicomImport module.
Header file of class to collect messages and errors related to a given frame handle.
boost::shared_ptr< const Tag > Const_TagPtr
Definition DCMTree_Lib.h:57
unsigned int RawTagId
Forward and includes of internally used DPL classes.
std::map< std::string, int > FileLoadStateLookUp
Typedef for a map used for fast look up of file load states.
boost::log::sources::severity_channel_logger< SeverityLevel > Logger
Simple structure of a tag id and a string which overwrites this tag value.