33 #pragma warning(disable: 4996)
37 #include <gdcmGlobal.h>
38 #include <gdcmDictSet.h>
41 #if defined(USE_GDCM2)
42 #include <gdcmGlobal.h>
43 #include <gdcmDicts.h>
47 #include <boost/algorithm/string/replace.hpp>
60 boost::algorithm::replace_all(str,
"'",
"''");
62 int i,size=(int)str.size();
67 str = str.substr(0,i);
77 const std::string& name,
79 : mKey(key), mName(name), mGroup(0), mElement(0), mFlags(flags)
84 <<
"' ["<<flags<<
"]"<<std::endl);
95 unsigned short element,
97 : mGroup(group), mElement(element), mFlags(flags)
102 sprintf(ctag,
"D%04x_%04x",group,element);
106 <<
"' ["<<flags<<
"]"<<std::endl);
108 #if defined(USE_GDCM)
110 GDCM_NAME_SPACE::DictEntry* entry =
111 GDCM_NAME_SPACE::Global::GetDicts()
116 mName = entry->GetName();
123 <<
"' is not in DICOM dictionnary ! "
124 <<
"Considering it as a user attribute"
134 #if defined(USE_GDCM2)
136 const gdcm::Global& g = gdcm::Global::GetInstance();
137 const gdcm::Dicts &dicts = g.GetDicts();
138 const gdcm::Dict &dict = dicts.GetPublicDict();
139 gdcm::DictEntry dictentry = dict.GetDictEntry(gdcm::Tag(
mGroup,
mElement));
141 mName = dictentry.GetName();
150 <<
"' is not in DICOM dictionnary ! "
151 <<
"Considering it as a user attribute"
165 unsigned short& group,
166 unsigned short& elem)
169 if ( (key.size()==10) &&
173 sscanf(key.c_str(),
"D%04hx_%04hx ",&group,&elem);
174 GimmickDebugMessage(3,
"GetDicomGroupElementFromKey '"<<key<<
"' : " <<group<<
"|"<<elem<<std::endl);
179 <<
" not a DICOM key format"<<std::endl);
191 #if defined(USE_GDCM)
192 GDCM_NAME_SPACE::DictEntry* entry = GDCM_NAME_SPACE::Global::GetDicts()->GetDefaultPubDict()->GetEntry(
GetGroup(),
GetElement());
195 if( entry->GetVR().str() ==
"DA" )
201 #if defined(USE_GDCM2)
202 const gdcm::Global& g = gdcm::Global::GetInstance();
203 const gdcm::Dicts &dicts = g.GetDicts();
204 const gdcm::Dict &dict = dicts.GetPublicDict();
208 if( gdcm::VR::GetVRString(dictentry.GetVR()) ==
"DA")
223 #if defined(USE_GDCM)
225 GDCM_NAME_SPACE::DictEntry* entry = GDCM_NAME_SPACE::Global::GetDicts()->GetDefaultPubDict()->GetEntry(
GetGroup(),
GetElement());
228 if( entry->GetVR().str() ==
"TM" )
235 #if defined(USE_GDCM2)
236 const gdcm::Global& g = gdcm::Global::GetInstance();
237 const gdcm::Dicts &dicts = g.GetDicts();
238 const gdcm::Dict &dict = dicts.GetPublicDict();
241 gdcm::DictEntry dictentry = dict.GetDictEntry(gdcm::Tag(
mGroup,
mElement));
242 if(gdcm::VR::GetVRString(dictentry.GetVR()) ==
"TM")
258 #if defined(USE_GDCM)
260 GDCM_NAME_SPACE::DictEntry* entry =
261 GDCM_NAME_SPACE::Global::GetDicts()
269 type = entry->GetVR().str();
271 #if defined(USE_GDCM2)
272 const gdcm::Global& g = gdcm::Global::GetInstance();
273 const gdcm::Dicts &dicts = g.GetDicts();
274 const gdcm::Dict &dict = dicts.GetPublicDict();
275 gdcm::DictEntry dictentry = dict.GetDictEntry(gdcm::Tag(
mGroup,
mElement));
276 type = gdcm::VR::GetVRString(dictentry.GetVR());