]> Creatis software - gdcm.git/blobdiff - src/gdcmDictEntry.cxx
* python/testSuite.py unittest test suite added (uses Data)
[gdcm.git] / src / gdcmDictEntry.cxx
index ddfd3e00ec7d45d626835bcab614bbde805558fe..0294d7b56a57a166f97fec85f7c89c57978c983d 100644 (file)
@@ -1,4 +1,5 @@
 #include "gdcm.h"
+#include "gdcmUtil.h"
 
 gdcmDictEntry::gdcmDictEntry(guint16 InGroup, guint16 InElement,
                              string  InVr, string InFourth, string InName) 
@@ -21,3 +22,23 @@ TagKey gdcmDictEntry::TranslateToKey(guint16 group, guint16 element) {
        key = trash;  // Convertion through assignement
        return key;
 }
+
+/**
+ * \ingroup     gdcmDictEntry
+ * \brief       If-and only if-the vr is unset then overwrite it.
+ * @param NewVr New vr to be set.
+ */
+void gdcmDictEntry::SetVR(string NewVr) {
+       if ( IsVrUnknown() )
+               vr = NewVr;
+       else {
+               dbg.Error(true, "gdcmDictEntry::SetVR",
+                         "Overwriting vr might compromise a dictionary");
+       }
+}
+
+bool gdcmDictEntry::IsVrUnknown() {
+       if ( vr == "Unknown" )
+               return true;
+       return false;
+}