diff OrthancServer/FromDcmtkBridge.cpp @ 308:fbf2b2282086

inplace modification of series and studies
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 21 Dec 2012 10:44:26 +0100
parents 326d5a4a5af3
children 26efccdff583
line wrap: on
line diff
--- a/OrthancServer/FromDcmtkBridge.cpp	Thu Dec 20 16:45:30 2012 +0100
+++ b/OrthancServer/FromDcmtkBridge.cpp	Fri Dec 21 10:44:26 2012 +0100
@@ -661,6 +661,34 @@
   }
 
 
+
+  bool ParsedDicomFile::GetTagValue(std::string& value,
+                                    const DicomTag& tag)
+  {
+    DcmTagKey k(tag.GetGroup(), tag.GetElement());
+    DcmDataset& dataset = *file_->getDataset();
+    DcmElement* element = NULL;
+    if (!dataset.findAndGetElement(k, element).good() ||
+        element == NULL)
+    {
+      return false;
+    }
+
+    std::auto_ptr<DicomValue> v(FromDcmtkBridge::ConvertLeafElement(*element));
+
+    if (v.get() == NULL)
+    {
+      value = "";
+    }
+    else
+    {
+      value = v->AsString();
+    }
+
+    return true;
+  }
+
+
   void FromDcmtkBridge::Convert(DicomMap& target, DcmDataset& dataset)
   {
     target.Clear();