changeset 4167:8517c47eedd2

merge
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 27 Aug 2020 14:59:53 +0200
parents ad64038bcbc5 (current diff) e34c89e89aac (diff)
children 88d704264d64
files
diffstat 3 files changed, 37 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Thu Aug 27 14:59:15 2020 +0200
+++ b/NEWS	Thu Aug 27 14:59:53 2020 +0200
@@ -1,6 +1,12 @@
 Pending changes in the mainline
 ===============================
 
+Maintenance
+-----------
+
+* Underscores are now allowed in peers/modalities symbolic names
+* Fix compatibility with C-MOVE SCU requests issued by Ambra
+
 
 Version 1.7.3 (2020-08-24)
 ==========================
--- a/OrthancServer/Sources/OrthancConfiguration.cpp	Thu Aug 27 14:59:15 2020 +0200
+++ b/OrthancServer/Sources/OrthancConfiguration.cpp	Thu Aug 27 14:59:53 2020 +0200
@@ -181,10 +181,10 @@
     for (size_t j = 0; j < s.size(); j++)
     {
       if (!isalnum(s[j]) && 
-          s[j] != '-')
+          s[j] != '-' && s[j] != '_')
       {
         throw OrthancException(ErrorCode_BadFileFormat,
-                               "Only alphanumeric and dash characters are allowed "
+                               "Only alphanumeric, dash characters and underscores are allowed "
                                "in the names of modalities/peers, but found: " + s);
       }
     }
--- a/OrthancServer/Sources/OrthancMoveRequestHandler.cpp	Thu Aug 27 14:59:15 2020 +0200
+++ b/OrthancServer/Sources/OrthancMoveRequestHandler.cpp	Thu Aug 27 14:59:53 2020 +0200
@@ -205,6 +205,23 @@
   }
 
 
+  static bool IsNonEmptyTag(const DicomMap& dicom,
+                            const DicomTag& tag)
+  {
+    const DicomValue* value = dicom.TestAndGetValue(tag);
+    if (value == NULL ||
+        value->IsNull() ||
+        value->IsBinary())
+    {
+      return false;
+    }
+    else
+    {
+      return !value->GetContent().empty();
+    }
+  }
+
+
   bool OrthancMoveRequestHandler::LookupIdentifiers(std::vector<std::string>& publicIds,
                                                     ResourceType level,
                                                     const DicomMap& input)
@@ -218,8 +235,17 @@
         break;
 
       case ResourceType_Study:
-        tag = (input.HasTag(DICOM_TAG_ACCESSION_NUMBER) ? 
-               DICOM_TAG_ACCESSION_NUMBER : DICOM_TAG_STUDY_INSTANCE_UID);
+        // The test below using "IsNonEmptyTag()" fixes compatibility
+        // with Ambra C-FIND SCU:
+        // https://groups.google.com/g/orthanc-users/c/yIUnZ9v9-Zs/m/GQPXiAOiCQAJ
+        if (IsNonEmptyTag(input, DICOM_TAG_ACCESSION_NUMBER))
+        {
+          tag = DICOM_TAG_ACCESSION_NUMBER;
+        }
+        else
+        {
+          tag = DICOM_TAG_STUDY_INSTANCE_UID;
+        }
         break;
         
       case ResourceType_Series:
@@ -373,7 +399,7 @@
     }
     else
     {
-      throw OrthancException(ErrorCode_BadRequest, "Invalid fields in a C-MOVE request");
+      throw OrthancException(ErrorCode_BadRequest, "No DICOM identifier provided in the C-MOVE request for this query retrieve level");
     }
   }
 }