changeset 357:8d3a0db39967

fix of standalone builds
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 31 Jan 2013 14:06:34 +0100
parents d1f82cf3ae35
children 3e604c6f0a74
files OrthancServer/DicomProtocol/DicomServer.cpp OrthancServer/OrthancRestApi.cpp
diffstat 2 files changed, 25 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/DicomProtocol/DicomServer.cpp	Thu Jan 31 11:32:00 2013 +0100
+++ b/OrthancServer/DicomProtocol/DicomServer.cpp	Thu Jan 31 14:06:34 2013 +0100
@@ -80,19 +80,36 @@
     LOG(WARNING) << "Loading the embedded dictionaries";
     dcmDataDict.clear();
     DcmDataDictionary& d = dcmDataDict.wrlock();
+
+    /**
+     * Do not load DICONDE dictionary, it breaks the other tags. The
+     * command "strace storescu 2>&1 |grep dic" shows that DICONDE
+     * dictionary is not loaded by storescu.
+     **/
+    //LoadEmbeddedDictionary(d, EmbeddedResources::DICTIONARY_DICONDE);
+
     LoadEmbeddedDictionary(d, EmbeddedResources::DICTIONARY_DICOM);
     LoadEmbeddedDictionary(d, EmbeddedResources::DICTIONARY_PRIVATE);
-    LoadEmbeddedDictionary(d, EmbeddedResources::DICTIONARY_DICONDE);
     dcmDataDict.unlock();
 #endif
 
     /* make sure data dictionary is loaded */
     if (!dcmDataDict.isDictionaryLoaded())
     {
-      LOG(ERROR) << "no data dictionary loaded, check environment variable: " << DCM_DICT_ENVIRONMENT_VARIABLE;
+      LOG(ERROR) << "No DICOM dictionary loaded, check environment variable: " << DCM_DICT_ENVIRONMENT_VARIABLE;
       throw OrthancException(ErrorCode_InternalError);
     }
 
+    {
+      // Test the dictionary with a simple DICOM tag
+      DcmTag key(0x0010, 0x1030); // This is PatientWeight
+      if (key.getEVR() != EVR_DS)
+      {
+        LOG(ERROR) << "The DICOM dictionary has not been correctly read";
+        throw OrthancException(ErrorCode_InternalError);
+      }
+    }
+
     /* initialize network, i.e. create an instance of T_ASC_Network*. */
     T_ASC_Network *net;
     OFCondition cond = ASC_initializeNetwork
--- a/OrthancServer/OrthancRestApi.cpp	Thu Jan 31 11:32:00 2013 +0100
+++ b/OrthancServer/OrthancRestApi.cpp	Thu Jan 31 14:06:34 2013 +0100
@@ -913,8 +913,11 @@
 
     for (Json::Value::ArrayIndex i = 0; i < removals.size(); i++)
     {
-      DicomTag tag = FromDcmtkBridge::ParseTag(removals[i].asString());
+      std::string name = removals[i].asString();
+      DicomTag tag = FromDcmtkBridge::ParseTag(name);
       target.insert(tag);
+
+      VLOG(1) << "Removal: " << name << " " << tag << std::endl;
     }
   }
 
@@ -937,6 +940,8 @@
 
       DicomTag tag = FromDcmtkBridge::ParseTag(name);      
       target[tag] = value;
+
+      VLOG(1) << "Replacement: " << name << " " << tag << " == " << value << std::endl;
     }
   }
 
@@ -1148,7 +1153,6 @@
                                         RestApi::PostCall& call)
   {
     boost::mutex::scoped_lock lock(cacheMutex_);
-
     RETRIEVE_CONTEXT(call);
     
     std::string id = call.GetUriComponent("id", "");