-string ElValSet::GetElValueByNumber(guint32 group, guint32 element) {
- TagKey key = gdcmDictEntry::TranslateToKey(group, element);
- if ( ! tagHt.count(key))
- return "gdcm::Unfound";
- if (tagHt.count(key) > 1)
- dbg.Verbose(0, "ElValSet::GetElValueByNumber",
- "multiple entries for this key (FIXME) !");
- return tagHt.find(key)->second->GetValue();
+/**
+ * \ingroup gdcmElValSet
+ * \brief
+ * @param group
+ * @param element
+ * @return
+ */
+string gdcmElValSet::GetElValueByNumber(guint16 group, guint16 element) {
+ TagKey key = gdcmDictEntry::TranslateToKey(group, element);
+ if ( ! tagHt.count(key))
+ return "gdcm::Unfound";
+ return tagHt.find(key)->second->GetValue();
+}
+
+/**
+ * \ingroup gdcmElValSet
+ * \brief
+ * @return
+ */
+string gdcmElValSet::GetElValueByName(string TagName) {
+ if ( ! NameHt.count(TagName))
+ return "gdcm::Unfound";
+ return NameHt.find(TagName)->second->GetValue();
+}
+
+/**
+ * \ingroup gdcmElValSet
+ * \brief
+ * @param content
+ * @param group
+ * @param element
+ * @return
+ */
+int gdcmElValSet::SetElValueByNumber(string content,
+ guint16 group, guint16 element) {
+ TagKey key = gdcmDictEntry::TranslateToKey(group, element);
+ if ( ! tagHt.count(key))
+ return 0;
+ tagHt[key]->SetValue(content);
+ string vr = tagHt[key]->GetVR();
+ guint32 lgr;
+
+ if( (vr == "US") || (vr == "SS") )
+ lgr = 2;
+ else if( (vr == "UL") || (vr == "SL") )
+ lgr = 4;
+ else
+ lgr = content.length();
+ tagHt[key]->SetLength(lgr);
+ return 1;
+}
+
+/**
+ * \ingroup gdcmElValSet
+ * \brief
+ * @param content
+ * @param TagName
+ * @return
+ */
+int gdcmElValSet::SetElValueByName(string content, string TagName) {
+ if ( ! NameHt.count(TagName))
+ return 0;
+ NameHt[TagName]->SetValue(content);
+ string vr = NameHt[TagName]->GetVR();
+ guint32 lgr;
+
+ if( (vr == "US") || (vr == "SS") )
+ lgr = 2;
+ else if( (vr == "UL") || (vr == "SL") )
+ lgr = 4;
+ else
+ lgr = content.length();
+
+// TODO : WARNING: le cas de l'element des pixels (7fe0,0010) n'est pas traite
+// par SetElValueByName
+// il faudra utiliser SetElValueByNumber
+
+ NameHt[TagName]->SetLength(lgr);
+ return 1;
+}
+
+/**
+ * \ingroup gdcmElValSet
+ * \brief Generate a free TagKey i.e. a TagKey that is not present
+ * in the TagHt dictionary.
+ * @param group The generated tag must belong to this group.
+ * @return The element of tag with given group which is fee.
+ */
+guint32 gdcmElValSet::GenerateFreeTagKeyInGroup(guint16 group) {
+ for (guint32 elem = 0; elem < UINT32_MAX; elem++) {
+ TagKey key = gdcmDictEntry::TranslateToKey(group, elem);
+ if (tagHt.count(key) == 0)
+ return elem;
+ }
+ return UINT32_MAX;
+}
+
+/**
+ * \ingroup gdcmElValSet
+ * \brief
+ * @param length
+ * @param group
+ * @param element
+ * @return
+ */
+int gdcmElValSet::SetElValueLengthByNumber(guint32 length,
+ guint16 group, guint16 element) {
+ TagKey key = gdcmDictEntry::TranslateToKey(group, element);
+ if ( ! tagHt.count(key))
+ return 0;
+ tagHt[key]->SetLength(length);
+ return 1 ;