X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src2%2FcreaImageIOTreeAttributeDescriptor.cpp;h=08fd784d9e26960199d35fc69585051121022305;hb=b029354f54449e058d14c671e7155e65b4086de6;hp=f01e26000b1b1c6a6cf9b0946c54b04facc77a28;hpb=cbf693fa62cd51f4ca5c881838bbb609edc447b0;p=creaImageIO.git diff --git a/src2/creaImageIOTreeAttributeDescriptor.cpp b/src2/creaImageIOTreeAttributeDescriptor.cpp index f01e260..08fd784 100644 --- a/src2/creaImageIOTreeAttributeDescriptor.cpp +++ b/src2/creaImageIOTreeAttributeDescriptor.cpp @@ -1,42 +1,201 @@ #include +#include #include #include +#include + namespace creaImageIO { namespace tree { + //======================================================================== + void AttributeDescriptor::CleanName(std::string& str) const + { + // quote must be doubled for SQL + // crea::Utils::Replace( str, "'", "''" ); + boost::algorithm::replace_all(str,"'","''"); + // Found strange strings which contained NULL char INSIDE string + int i,size=str.size(); + for (i=0;iGetDefaultPubDict()->GetEntry(mGroup,mElement); + + if (entry) { - // Decode group & elem - sscanf(key.c_str(),"%04x|%04x",&mGroup,&mElement); - // Retrieve the name from gdcm dict - GDCM_NAME_SPACE::DictEntry* entry = - GDCM_NAME_SPACE::Global::GetDicts() - ->GetDefaultPubDict()->GetEntry(mGroup,mElement); mName = entry->GetName(); + CleanName(mName); + GimmickDebugMessage(3,"='"<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; + } + + //===================================================================== + /// Decodes the type of the attribute + void AttributeDescriptor::DecodeType(unsigned int& typ) const + { + + + // Retrieve the name from gdcm dict + GDCM_NAME_SPACE::DictEntry* entry = + GDCM_NAME_SPACE::Global::GetDicts() + ->GetDefaultPubDict()->GetEntry(GetGroup(),GetElement()); + if (entry==0) + { + typ = 2; + return; + } + std::string type = entry->GetVR().str(); + GimmickDebugMessage(3,"VR Value is "<