diff OrthancServer/OrthancFindRequestHandler.cpp @ 2039:e33e0ae51d7b

new configuration option AllowFindSopClassesInStudy
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 21 Jun 2016 15:17:49 +0200
parents 655489d9165d
children b9428d5f7eaf
line wrap: on
line diff
--- a/OrthancServer/OrthancFindRequestHandler.cpp	Tue Jun 21 14:29:45 2016 +0200
+++ b/OrthancServer/OrthancFindRequestHandler.cpp	Tue Jun 21 15:17:49 2016 +0200
@@ -112,6 +112,9 @@
                                       const DicomTag& tag,
                                       const std::list<std::string>& instances)
   {
+    // WARNING: This function is slow, as it reads the JSON file
+    // summarizing each instance of interest from the hard drive.
+
     std::string formatted = tag.Format();
 
     for (std::list<std::string>::const_iterator
@@ -223,9 +226,18 @@
 
     if (query.HasTag(DICOM_TAG_SOP_CLASSES_IN_STUDY))
     {
-      std::set<std::string> values;
-      ExtractTagFromInstances(values, context, DICOM_TAG_SOP_CLASS_UID, instances);
-      StoreSetOfStrings(result, DICOM_TAG_SOP_CLASSES_IN_STUDY, values);
+      if (Configuration::GetGlobalBoolParameter("AllowFindSopClassesInStudy", false))
+      {
+        std::set<std::string> values;
+        ExtractTagFromInstances(values, context, DICOM_TAG_SOP_CLASS_UID, instances);
+        StoreSetOfStrings(result, DICOM_TAG_SOP_CLASSES_IN_STUDY, values);
+      }
+      else
+      {
+        result.SetValue(DICOM_TAG_SOP_CLASSES_IN_STUDY, "", false);
+        LOG(WARNING) << "The handling of \"SOP Classes in Study\" (0008,0062) "
+                     << "in C-FIND requests is disabled";
+      }
     }
   }