changeset 4750:56ed4c11fc2a openssl-3.x

integration mainline->openssl-3.x
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 08 Jul 2021 14:58:18 +0200
parents 336571b8952f (current diff) 1a061bc2d6ca (diff)
children b2417ac5055a
files NEWS OrthancFramework/Resources/CMake/OrthancFrameworkParameters.cmake OrthancServer/OrthancExplorer/explorer.js
diffstat 8 files changed, 112 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Tue Jul 06 09:54:14 2021 +0200
+++ b/NEWS	Thu Jul 08 14:58:18 2021 +0200
@@ -15,10 +15,19 @@
 * Upgraded dependencies for static builds (notably on Windows and LSB):
   - openssl 3.0.0-beta1
 
+Orthanc Explorer
+----------------
+
+* Clicking on "Send to remote modality" displays the job information to monitor progress
+
+
+Version 1.9.5 (2021-07-08)
+==========================
+
 General
 -------
 
-* Anonymization is now also applied recursively to nested tags
+* Anonymization is applied recursively to nested tags
 
 REST API
 --------
--- a/OrthancFramework/Resources/CMake/Compiler.cmake	Tue Jul 06 09:54:14 2021 +0200
+++ b/OrthancFramework/Resources/CMake/Compiler.cmake	Thu Jul 08 14:58:18 2021 +0200
@@ -42,6 +42,14 @@
   # use by "ExternalProject" in CMake
   SET(CMAKE_LSB_CC $ENV{LSB_CC} CACHE STRING "")
   SET(CMAKE_LSB_CXX $ENV{LSB_CXX} CACHE STRING "")
+
+  # Explicitly adding "-lstdc++ -lm" during linking for LSB had to be
+  # introduced on the BuildBot server for LSB Release builds between
+  # "OrthancMySQL-4.0" and "OrthancMySQL-4.1" and after
+  # "Orthanc-1.9.5", for unclear reasons. Without this option, many
+  # symbols are left undefined while linking. Similar to:
+  # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=14001
+  link_libraries(stdc++ m)
 endif()
 
 
--- a/OrthancFramework/Resources/CMake/DownloadOrthancFramework.cmake	Tue Jul 06 09:54:14 2021 +0200
+++ b/OrthancFramework/Resources/CMake/DownloadOrthancFramework.cmake	Thu Jul 08 14:58:18 2021 +0200
@@ -132,6 +132,8 @@
         set(ORTHANC_FRAMEWORK_MD5 "9b86e6f00e03278293cd15643cc0233f")
       elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.9.4")
         set(ORTHANC_FRAMEWORK_MD5 "6d5ca4a73ac7d42445041ca79de1624d")
+      elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.9.5")
+        set(ORTHANC_FRAMEWORK_MD5 "10fc64de1254a095e5d3ed3931f0cfbb")
 
       # Below this point are development snapshots that were used to
       # release some plugin, before an official release of the Orthanc
--- a/OrthancFramework/UnitTestsSources/FromDcmtkTests.cpp	Tue Jul 06 09:54:14 2021 +0200
+++ b/OrthancFramework/UnitTestsSources/FromDcmtkTests.cpp	Thu Jul 08 14:58:18 2021 +0200
@@ -2474,7 +2474,6 @@
   static const char* CODE_VALUE = "0008,0100";
   static const char* PATIENT_ID = "0010,0020";
   static const char* PATIENT_NAME = "0010,0010";
-  static const char* SERIES_DESCRIPTION = "0008,103e";
   static const char* PURPOSE_CODE_SEQ = "0040,a170";
   static const char* REF_IM_SEQ = "0008,1140";
   static const char* REF_SOP_CLASS = "0008,1150";
@@ -2554,6 +2553,8 @@
     Json::Value vv;
     dicom->DatasetToJson(vv, DicomToJsonFormat_Short, DicomToJsonFlags_None, 0);
 
+    static const char* SERIES_DESCRIPTION = "0008,103e";
+
     ASSERT_EQ("WORLD", vv[REL_SERIES_SEQ][0][PURPOSE_CODE_SEQ][0][SERIES_DESCRIPTION].asString());
     ASSERT_FALSE(vv[REL_SERIES_SEQ][0][PURPOSE_CODE_SEQ][0].isMember(CODE_VALUE));
   }
--- a/OrthancServer/OrthancExplorer/explorer.js	Tue Jul 06 09:54:14 2021 +0200
+++ b/OrthancServer/OrthancExplorer/explorer.js	Thu Jul 08 14:58:18 2021 +0200
@@ -1248,19 +1248,23 @@
     }
 
     if (url != '') {
+      /**
+       * In Orthanc <= 1.9.5, synchronous job was used, which caused a
+       * non-intuitive behavior because of AJAX timeouts on large
+       * studies. We now use an asynchronous call.
+       * https://groups.google.com/g/orthanc-users/c/r2LoAp72AWI/m/cVaFXopUBAAJ
+       **/
       $.ajax({
         url: url,
         type: 'POST',
-        dataType: 'text',
-        data: pageData.uuid,
-        async: true,  // Necessary to block UI
-        beforeSend: function() {
-          $.blockUI({ message: $(loading) });
-        },
-        complete: function(s) {
-          $.unblockUI();
-        },
-        success: function(s) {
+        data: JSON.stringify({
+          'Synchronous' : false,
+          'Resources' : [ pageData.uuid ]
+        }),
+        dataType: 'json',
+        async: false,
+        success: function(job) {
+          window.location.assign('explorer.html#job?uuid=' + job.ID);
         },
         error: function() {
           alert('Error during store');
--- a/OrthancServer/Resources/RunCppCheck.sh	Tue Jul 06 09:54:14 2021 +0200
+++ b/OrthancServer/Resources/RunCppCheck.sh	Thu Jul 08 14:58:18 2021 +0200
@@ -26,7 +26,7 @@
 syntaxError:../../OrthancServer/UnitTestsSources/UnitTestsMain.cpp:321
 uninitMemberVar:../../OrthancServer/Sources/ServerJobs/StorageCommitmentScpJob.cpp:427
 unreadVariable:../../OrthancFramework/Sources/FileStorage/StorageAccessor.cpp
-unreadVariable:../../OrthancServer/Sources/OrthancRestApi/OrthancRestModalities.cpp:1123
+unreadVariable:../../OrthancServer/Sources/OrthancRestApi/OrthancRestModalities.cpp:1124
 unusedFunction
 useInitializationList:../../OrthancFramework/Sources/Images/PngReader.cpp:89
 useInitializationList:../../OrthancFramework/Sources/Images/PngWriter.cpp:97
--- a/OrthancServer/Resources/Samples/ImportDicomFiles/ImportDicomFiles.py	Tue Jul 06 09:54:14 2021 +0200
+++ b/OrthancServer/Resources/Samples/ImportDicomFiles/ImportDicomFiles.py	Thu Jul 08 14:58:18 2021 +0200
@@ -19,11 +19,12 @@
 # along with this program. If not, see <http://www.gnu.org/licenses/>.
 
 
+import base64
+import httplib2
+import json
 import os
-import sys
 import os.path
-import httplib2
-import base64
+import sys
 
 if len(sys.argv) != 4 and len(sys.argv) != 6:
     print("""
@@ -40,23 +41,42 @@
 
 URL = 'http://%s:%d/instances' % (sys.argv[1], int(sys.argv[2]))
 
-success_count = 0
+dicom_count = 0
+json_count = 0
 total_file_count = 0
 
 
+def IsJson(content):
+    try:
+        if (sys.version_info >= (3, 0)):
+            json.loads(content.decode())
+            return True
+        else:
+            json.loads(content)
+            return True
+    except:
+        return False
+
+
 # This function will upload a single file to Orthanc through the REST API
 def UploadFile(path):
-    global success_count
+    global dicom_count
+    global json_count
     global total_file_count
 
-    f = open(path, "rb")
+    f = open(path, 'rb')
     content = f.read()
     f.close()
     total_file_count += 1
 
+    sys.stdout.write('Importing %s' % path)
+
+    if IsJson(content):
+        sys.stdout.write(' => ignored JSON file\n')
+        json_count += 1
+        return
+
     try:
-        sys.stdout.write("Importing %s" % path)
-
         h = httplib2.Http()
 
         headers = { 'content-type' : 'application/dicom' }
@@ -73,24 +93,24 @@
             # not always work)
             # http://en.wikipedia.org/wiki/Basic_access_authentication
             creds_str = username + ':' + password
-            creds_str_bytes = creds_str.encode("ascii")
+            creds_str_bytes = creds_str.encode('ascii')
             creds_str_bytes_b64 = b'Basic ' + base64.b64encode(creds_str_bytes)
-            headers['authorization'] = creds_str_bytes_b64.decode("ascii")
+            headers['authorization'] = creds_str_bytes_b64.decode('ascii')
 
         resp, content = h.request(URL, 'POST', 
                                   body = content,
                                   headers = headers)
 
         if resp.status == 200:
-            sys.stdout.write(" => success\n")
-            success_count += 1
+            sys.stdout.write(' => success\n')
+            dicom_count += 1
         else:
-            sys.stdout.write(" => failure (Is it a DICOM file? Is there a password?)\n")
+            sys.stdout.write(' => failure (Is it a DICOM file? Is there a password?)\n')
 
     except:
         type, value, traceback = sys.exc_info()
         sys.stderr.write(str(value))
-        sys.stdout.write(" => unable to connect (Is Orthanc running? Is there a password?)\n")
+        sys.stdout.write(' => unable to connect (Is Orthanc running? Is there a password?)\n')
 
 
 if os.path.isfile(sys.argv[3]):
@@ -102,7 +122,13 @@
         for f in files:
             UploadFile(os.path.join(root, f))
 
-if success_count == total_file_count:
-    print("\nSummary: all %d DICOM file(s) have been imported successfully" % success_count)
+
+if dicom_count + json_count == total_file_count:
+    print('\nSUCCESS: %d DICOM file(s) have been successfully imported' % dicom_count)
 else:
-    print("\nSummary: %d out of %d files have been imported successfully as DICOM instances" % (success_count, total_file_count))
+    print('\nWARNING: Only %d out of %d file(s) have been successfully imported as DICOM instance(s)' % (dicom_count, total_file_count - json_count))
+
+if json_count != 0:
+    print('NB: %d JSON file(s) have been ignored' % json_count)
+
+print('')
--- a/OrthancServer/Resources/Samples/ImportDicomFiles/OrthancImport.py	Tue Jul 06 09:54:14 2021 +0200
+++ b/OrthancServer/Resources/Samples/ImportDicomFiles/OrthancImport.py	Thu Jul 08 14:58:18 2021 +0200
@@ -22,6 +22,7 @@
 import argparse
 import bz2
 import gzip
+import json
 import os
 import requests
 import sys
@@ -71,12 +72,31 @@
 
 IMPORTED_STUDIES = set()
 COUNT_ERROR = 0
-COUNT_SUCCESS = 0
-        
+COUNT_DICOM = 0
+COUNT_JSON = 0
+
+
+def IsJson(content):
+    try:
+        if (sys.version_info >= (3, 0)):
+            json.loads(content.decode())
+            return True
+        else:
+            json.loads(content)
+            return True
+    except:
+        return False
+
+
 def UploadBuffer(dicom):
     global IMPORTED_STUDIES
     global COUNT_ERROR
-    global COUNT_SUCCESS
+    global COUNT_DICOM
+    global COUNT_JSON
+
+    if IsJson(dicom):
+        COUNT_JSON += 1
+        return
     
     auth = HTTPBasicAuth(args.username, args.password)
     r = requests.post('%s/instances' % args.url, auth = auth, data = dicom)
@@ -93,7 +113,7 @@
             raise
         
     info = r.json()
-    COUNT_SUCCESS += 1
+    COUNT_DICOM += 1
 
     if not info['ParentStudy'] in IMPORTED_STUDIES:
         IMPORTED_STUDIES.add(info['ParentStudy'])
@@ -219,8 +239,14 @@
         
 
 print('')
-print('Status:')
-print('  %d DICOM instances properly imported' % COUNT_SUCCESS)
+
+if COUNT_ERROR == 0:
+    print('SUCCESS:')
+else:
+    print('WARNING:')
+    
+print('  %d DICOM instances properly imported' % COUNT_DICOM)
 print('  %d DICOM studies properly imported' % len(IMPORTED_STUDIES))
+print('  %d JSON files ignored' % COUNT_JSON)
 print('  Error in %d files' % COUNT_ERROR)
 print('')