changeset 2256:de1ba22fd28a

simplification wrt. modality manufacturers
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 01 Feb 2017 16:26:57 +0100
parents 1442da6a03dd
children b8e07269da72
files OrthancServer/DicomProtocol/IFindRequestHandler.h OrthancServer/DicomProtocol/IWorklistRequestHandler.h OrthancServer/Internals/FindScp.cpp OrthancServer/OrthancFindRequestHandler.cpp OrthancServer/OrthancFindRequestHandler.h OrthancServer/Search/HierarchicalMatcher.cpp OrthancServer/Search/HierarchicalMatcher.h Plugins/Engine/OrthancPlugins.cpp
diffstat 8 files changed, 37 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/DicomProtocol/IFindRequestHandler.h	Wed Feb 01 14:04:24 2017 +0000
+++ b/OrthancServer/DicomProtocol/IFindRequestHandler.h	Wed Feb 01 16:26:57 2017 +0100
@@ -49,6 +49,7 @@
                         const std::list<DicomTag>& sequencesToReturn,
                         const std::string& remoteIp,
                         const std::string& remoteAet,
-                        const std::string& calledAet) = 0;
+                        const std::string& calledAet,
+                        ModalityManufacturer manufacturer) = 0;
   };
 }
--- a/OrthancServer/DicomProtocol/IWorklistRequestHandler.h	Wed Feb 01 14:04:24 2017 +0000
+++ b/OrthancServer/DicomProtocol/IWorklistRequestHandler.h	Wed Feb 01 16:26:57 2017 +0100
@@ -48,6 +48,7 @@
                         ParsedDicomFile& query,
                         const std::string& remoteIp,
                         const std::string& remoteAet,
-                        const std::string& calledAet) = 0;
+                        const std::string& calledAet,
+                        ModalityManufacturer manufacturer) = 0;
   };
 }
--- a/OrthancServer/Internals/FindScp.cpp	Wed Feb 01 14:04:24 2017 +0000
+++ b/OrthancServer/Internals/FindScp.cpp	Wed Feb 01 16:26:57 2017 +0100
@@ -191,6 +191,20 @@
 
         try
         {
+          RemoteModalityParameters modality;
+
+          /**
+           * Ensure that the remote modality is known to Orthanc for C-FIND requests.
+           **/
+
+          if (!Configuration::LookupDicomModalityUsingAETitle(modality, *data.remoteAet_))
+          {
+            LOG(ERROR) << "Modality with AET \"" << *data.remoteAet_
+                       << "\" is not defined in the \"DicomModalities\" configuration option";
+            throw OrthancException(ErrorCode_UnknownModality);
+          }
+
+          
           if (sopClassUid == UID_FINDModalityWorklistInformationModel)
           {
             data.answers_.SetWorklist(true);
@@ -202,7 +216,7 @@
 
               data.worklistHandler_->Handle(data.answers_, query,
                                             *data.remoteIp_, *data.remoteAet_,
-                                            *data.calledAet_);
+                                            *data.calledAet_, modality.GetManufacturer());
               ok = true;
             }
             else
@@ -242,7 +256,7 @@
 
               data.findHandler_->Handle(data.answers_, input, sequencesToReturn,
                                         *data.remoteIp_, *data.remoteAet_,
-                                        *data.calledAet_);
+                                        *data.calledAet_, modality.GetManufacturer());
               ok = true;
             }
             else
--- a/OrthancServer/OrthancFindRequestHandler.cpp	Wed Feb 01 14:04:24 2017 +0000
+++ b/OrthancServer/OrthancFindRequestHandler.cpp	Wed Feb 01 16:26:57 2017 +0100
@@ -516,23 +516,10 @@
                                          const std::list<DicomTag>& sequencesToReturn,
                                          const std::string& remoteIp,
                                          const std::string& remoteAet,
-                                         const std::string& calledAet)
+                                         const std::string& calledAet,
+                                         ModalityManufacturer manufacturer)
   {
     /**
-     * Ensure that the remote modality is known to Orthanc.
-     **/
-
-    RemoteModalityParameters modality;
-
-    if (!Configuration::LookupDicomModalityUsingAETitle(modality, remoteAet))
-    {
-      throw OrthancException(ErrorCode_UnknownModality);
-    }
-
-    bool caseSensitivePN = Configuration::GetGlobalBoolParameter("CaseSensitivePN", false);
-
-
-    /**
      * Possibly apply the user-supplied Lua filter.
      **/
 
@@ -598,6 +585,8 @@
 
     LookupResource finder(level);
 
+    const bool caseSensitivePN = Configuration::GetGlobalBoolParameter("CaseSensitivePN", false);
+
     for (size_t i = 0; i < query.GetSize(); i++)
     {
       const DicomElement& element = query.GetElement(i);
@@ -617,7 +606,7 @@
         continue;
       }
 
-      if (FilterQueryTag(value, level, tag, modality.GetManufacturer()))
+      if (FilterQueryTag(value, level, tag, manufacturer))
       {
         ValueRepresentation vr = FromDcmtkBridge::LookupValueRepresentation(tag);
 
--- a/OrthancServer/OrthancFindRequestHandler.h	Wed Feb 01 14:04:24 2017 +0000
+++ b/OrthancServer/OrthancFindRequestHandler.h	Wed Feb 01 16:26:57 2017 +0100
@@ -72,7 +72,8 @@
                         const std::list<DicomTag>& sequencesToReturn,
                         const std::string& remoteIp,
                         const std::string& remoteAet,
-                        const std::string& calledAet);
+                        const std::string& calledAet,
+                        ModalityManufacturer manufacturer);
 
     unsigned int GetMaxResults() const
     {
--- a/OrthancServer/Search/HierarchicalMatcher.cpp	Wed Feb 01 14:04:24 2017 +0000
+++ b/OrthancServer/Search/HierarchicalMatcher.cpp	Wed Feb 01 16:26:57 2017 +0100
@@ -38,16 +38,16 @@
 #include "../../Core/OrthancException.h"
 #include "../FromDcmtkBridge.h"
 #include "../ToDcmtkBridge.h"
+#include "../OrthancInitialization.h"
 
 #include <dcmtk/dcmdata/dcfilefo.h>
 
 namespace Orthanc
 {
-  HierarchicalMatcher::HierarchicalMatcher(ParsedDicomFile& query,
-                                           bool caseSensitivePN)
+  HierarchicalMatcher::HierarchicalMatcher(ParsedDicomFile& query)
   {
     Setup(*query.GetDcmtkObject().getDataset(), 
-          caseSensitivePN,
+          Configuration::GetGlobalBoolParameter("CaseSensitivePN", false),
           query.GetEncoding());
   }
 
--- a/OrthancServer/Search/HierarchicalMatcher.h	Wed Feb 01 14:04:24 2017 +0000
+++ b/OrthancServer/Search/HierarchicalMatcher.h	Wed Feb 01 16:26:57 2017 +0100
@@ -68,8 +68,7 @@
                                 Encoding encoding) const;
 
   public:
-    HierarchicalMatcher(ParsedDicomFile& query,
-                        bool caseSensitivePN);
+    HierarchicalMatcher(ParsedDicomFile& query);
 
     ~HierarchicalMatcher();
 
--- a/Plugins/Engine/OrthancPlugins.cpp	Wed Feb 01 14:04:24 2017 +0000
+++ b/Plugins/Engine/OrthancPlugins.cpp	Wed Feb 01 16:26:57 2017 +0100
@@ -410,14 +410,13 @@
                         ParsedDicomFile& query,
                         const std::string& remoteIp,
                         const std::string& remoteAet,
-                        const std::string& calledAet)
+                        const std::string& calledAet,
+                        ModalityManufacturer manufacturer)
     {
-      bool caseSensitivePN = Configuration::GetGlobalBoolParameter("CaseSensitivePN", false);
-
       {
         boost::mutex::scoped_lock lock(that_.pimpl_->worklistCallbackMutex_);
 
-        matcher_.reset(new HierarchicalMatcher(query, caseSensitivePN));
+        matcher_.reset(new HierarchicalMatcher(query));
         currentQuery_ = &query;
 
         if (that_.pimpl_->worklistCallback_)
@@ -502,7 +501,8 @@
                         const std::list<DicomTag>& sequencesToReturn,
                         const std::string& remoteIp,
                         const std::string& remoteAet,
-                        const std::string& calledAet)
+                        const std::string& calledAet,
+                        ModalityManufacturer manufacturer)
     {
       DicomMap tmp;
       tmp.Assign(input);
@@ -2598,8 +2598,7 @@
         const _OrthancPluginCreateFindMatcher& p =
           *reinterpret_cast<const _OrthancPluginCreateFindMatcher*>(parameters);
         ParsedDicomFile query(p.query, p.size);
-        *(p.target) = reinterpret_cast<OrthancPluginFindMatcher*>
-          (new HierarchicalMatcher(query, Configuration::GetGlobalBoolParameter("CaseSensitivePN", false)));
+        *(p.target) = reinterpret_cast<OrthancPluginFindMatcher*>(new HierarchicalMatcher(query));
         return true;
       }