changeset 4143:1ec3e1e18f50

Add missing tag "Retrieve AE Title (0008,0054)" in C-FIND SCP responses
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 14 Aug 2020 08:19:02 +0200
parents 0ea450e1f0ea
children be88fe7e4670
files NEWS OrthancFramework/Sources/DicomFormat/DicomTag.h OrthancServer/Sources/OrthancConfiguration.h OrthancServer/Sources/OrthancFindRequestHandler.cpp OrthancServer/Sources/OrthancRestApi/OrthancRestSystem.cpp OrthancServer/Sources/ServerContext.cpp OrthancServer/Sources/main.cpp
diffstat 7 files changed, 23 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Thu Aug 13 17:44:39 2020 +0200
+++ b/NEWS	Fri Aug 14 08:19:02 2020 +0200
@@ -1,6 +1,7 @@
 Pending changes in the mainline
 ===============================
 
+* Add missing tag "Retrieve AE Title (0008,0054)" in C-FIND SCP responses
 * Fix DICOM SCP filters if some query tag has more than 256 characters
 * "/series/.../ordered-slices" supports spaces in Image Position/Orientation Patient tags
 
--- a/OrthancFramework/Sources/DicomFormat/DicomTag.h	Thu Aug 13 17:44:39 2020 +0200
+++ b/OrthancFramework/Sources/DicomFormat/DicomTag.h	Fri Aug 14 08:19:02 2020 +0200
@@ -125,6 +125,7 @@
   static const DicomTag DICOM_TAG_SPECIFIC_CHARACTER_SET(0x0008, 0x0005);
   static const DicomTag DICOM_TAG_QUERY_RETRIEVE_LEVEL(0x0008, 0x0052);
   static const DicomTag DICOM_TAG_MODALITIES_IN_STUDY(0x0008, 0x0061);
+  static const DicomTag DICOM_TAG_RETRIEVE_AE_TITLE(0x0008, 0x0054);
 
   // Tags for images
   static const DicomTag DICOM_TAG_COLUMNS(0x0028, 0x0011);
--- a/OrthancServer/Sources/OrthancConfiguration.h	Thu Aug 13 17:44:39 2020 +0200
+++ b/OrthancServer/Sources/OrthancConfiguration.h	Fri Aug 14 08:19:02 2020 +0200
@@ -237,6 +237,11 @@
 
     std::string GetDefaultPrivateCreator() const;
 
+    std::string GetOrthancAET() const
+    {
+      return GetStringParameter("DicomAet", "ORTHANC");
+    }
+
     static void DefaultExtractDicomSummary(DicomMap& target,
                                            ParsedDicomFile& dicom);
     
--- a/OrthancServer/Sources/OrthancFindRequestHandler.cpp	Thu Aug 13 17:44:39 2020 +0200
+++ b/OrthancServer/Sources/OrthancFindRequestHandler.cpp	Fri Aug 14 08:19:02 2020 +0200
@@ -304,7 +304,8 @@
                         const std::list<DicomTag>& sequencesToReturn,
                         const DicomMap* counters,
                         const std::string& defaultPrivateCreator,
-                        const std::map<uint16_t, std::string>& privateCreators)
+                        const std::map<uint16_t, std::string>& privateCreators,
+                        const std::string& retrieveAet)
   {
     DicomMap match;
 
@@ -319,6 +320,13 @@
     
     DicomMap result;
 
+    /**
+     * Add the mandatory "Retrieve AE Title (0008,0054)" tag, which was missing in Orthanc <= 1.7.2.
+     * http://dicom.nema.org/medical/dicom/current/output/html/part04.html#sect_C.4.1.1.3.2
+     * https://groups.google.com/g/orthanc-users/c/-7zNTKR_PMU/m/kfjwzEVNAgAJ
+     **/
+    result.SetValue(DICOM_TAG_RETRIEVE_AE_TITLE, retrieveAet, false /* not binary */);
+
     for (size_t i = 0; i < query.GetSize(); i++)
     {
       if (query.GetElement(i).GetTag() == DICOM_TAG_QUERY_RETRIEVE_LEVEL)
@@ -504,6 +512,7 @@
     const std::list<DicomTag>&  sequencesToReturn_;
     std::string                 defaultPrivateCreator_;       // the private creator to use if the group is not defined in the query itself
     const std::map<uint16_t, std::string>& privateCreators_;  // the private creators defined in the query itself
+    std::string                 retrieveAet_;
 
   public:
     LookupVisitor(DicomFindAnswers&  answers,
@@ -525,6 +534,7 @@
       {
         OrthancConfiguration::ReaderLock lock;
         defaultPrivateCreator_ = lock.GetConfiguration().GetDefaultPrivateCreator();
+        retrieveAet_ = lock.GetConfiguration().GetOrthancAET();
       }
     }
 
@@ -566,8 +576,8 @@
     {
       std::unique_ptr<DicomMap> counters(ComputeCounters(context_, instanceId, level_, query_));
 
-      AddAnswer(answers_, mainDicomTags, dicomAsJson,
-                queryAsArray_, sequencesToReturn_, counters.get(), defaultPrivateCreator_, privateCreators_);
+      AddAnswer(answers_, mainDicomTags, dicomAsJson, queryAsArray_, sequencesToReturn_,
+                counters.get(), defaultPrivateCreator_, privateCreators_, retrieveAet_);
     }
   };
 
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestSystem.cpp	Thu Aug 13 17:44:39 2020 +0200
+++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestSystem.cpp	Fri Aug 14 08:19:02 2020 +0200
@@ -69,7 +69,7 @@
 
     {
       OrthancConfiguration::ReaderLock lock;
-      result["DicomAet"] = lock.GetConfiguration().GetStringParameter("DicomAet", "ORTHANC");
+      result["DicomAet"] = lock.GetConfiguration().GetOrthancAET();
       result["DicomPort"] = lock.GetConfiguration().GetUnsignedIntegerParameter("DicomPort", 4242);
       result["HttpPort"] = lock.GetConfiguration().GetUnsignedIntegerParameter("HttpPort", 8042);
       result["Name"] = lock.GetConfiguration().GetStringParameter("Name", "");
--- a/OrthancServer/Sources/ServerContext.cpp	Thu Aug 13 17:44:39 2020 +0200
+++ b/OrthancServer/Sources/ServerContext.cpp	Fri Aug 14 08:19:02 2020 +0200
@@ -280,7 +280,7 @@
           new SharedArchive(lock.GetConfiguration().GetUnsignedIntegerParameter("QueryRetrieveSize", 100)));
         mediaArchive_.reset(
           new SharedArchive(lock.GetConfiguration().GetUnsignedIntegerParameter("MediaArchiveSize", 1)));
-        defaultLocalAet_ = lock.GetConfiguration().GetStringParameter("DicomAet", "ORTHANC");
+        defaultLocalAet_ = lock.GetConfiguration().GetOrthancAET();
         jobsEngine_.SetWorkersCount(lock.GetConfiguration().GetUnsignedIntegerParameter("ConcurrentJobs", 2));
         saveJobs_ = lock.GetConfiguration().GetBooleanParameter("SaveJobs", true);
         metricsRegistry_->SetEnabled(lock.GetConfiguration().GetBooleanParameter("MetricsEnabled", true));
--- a/OrthancServer/Sources/main.cpp	Thu Aug 13 17:44:39 2020 +0200
+++ b/OrthancServer/Sources/main.cpp	Fri Aug 14 08:19:02 2020 +0200
@@ -1073,7 +1073,7 @@
       dicomServer.SetCalledApplicationEntityTitleCheck(lock.GetConfiguration().GetBooleanParameter("DicomCheckCalledAet", false));
       dicomServer.SetAssociationTimeout(lock.GetConfiguration().GetUnsignedIntegerParameter("DicomScpTimeout", 30));
       dicomServer.SetPortNumber(lock.GetConfiguration().GetUnsignedIntegerParameter("DicomPort", 4242));
-      dicomServer.SetApplicationEntityTitle(lock.GetConfiguration().GetStringParameter("DicomAet", "ORTHANC"));
+      dicomServer.SetApplicationEntityTitle(lock.GetConfiguration().GetOrthancAET());
     }
 
 #if ORTHANC_ENABLE_PLUGINS == 1