+ //=====================================================================
+
+
+ //=====================================================================
+ /// Extracts group and element from a key of the form "Dgroup_elem"
+ void AttributeDescriptor::GetDicomGroupElementFromKey(const std::string& key,
+ unsigned short& group,
+ unsigned short& elem)
+ {
+ group = elem = 0;
+ if ( (key.size()==10) &&
+ (key[0] == 'D') &&
+ (key[5] == '_') )
+ {
+ std::string g = key.substr(1,4);
+ sscanf(key.c_str(),"D %04x _ %04x ",&group,&elem);
+ sscanf(g.c_str(),"%04x",&group);
+ GimmickDebugMessage(3,"GetDicomGroupElementFromKey '"<<g<<"' : "
+ <<group<<"|"<<elem<<std::endl);
+ }
+ else
+ {
+ GimmickMessage(5,"GetDicomGroupElementFromKey '"<<key<<"' : "
+ <<" not a DICOM key format"<<std::endl);
+ }
+ return;
+ }
+
+ //=====================================================================
+ /// test if the type is a date
+ bool AttributeDescriptor::isDateEntry() const
+ {
+
+ bool btest = false;
+ // Retrieve the name from gdcm dict
+ GDCM_NAME_SPACE::DictEntry* entry = GDCM_NAME_SPACE::Global::GetDicts()->GetDefaultPubDict()->GetEntry(GetGroup(),GetElement());
+ if( entry != 0)
+ {
+ if( entry->GetVR().str() == "DA" )
+ {
+ btest = true;
+ }
+ }
+ return btest;
+ }
+
+ //=====================================================================
+ /// test if the type is a time
+ bool AttributeDescriptor::isTimeEntry() const
+ {
+
+ bool btest = false;
+ // Retrieve the name from gdcm dict
+ GDCM_NAME_SPACE::DictEntry* entry = GDCM_NAME_SPACE::Global::GetDicts()->GetDefaultPubDict()->GetEntry(GetGroup(),GetElement());
+ if( entry != 0)
+ {
+ if( entry->GetVR().str() == "TM" )
+ {
+ btest = true;
+ }
+ }
+ return btest;
+ }
+