changeset 511:f478b78e58f3

merge
author Alain Mazy <am@osimis.io>
date Thu, 02 Dec 2021 13:03:45 +0100
parents b83d2fc2fce1 (current diff) 9154d738f5bf (diff)
children fe0671a4c145
files NEWS
diffstat 4 files changed, 76 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Thu Dec 02 13:03:04 2021 +0100
+++ b/CMakeLists.txt	Thu Dec 02 13:03:45 2021 +0100
@@ -27,7 +27,7 @@
   set(ORTHANC_FRAMEWORK_DEFAULT_VERSION "mainline")
   set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "hg")
 else()
-  set(ORTHANC_FRAMEWORK_DEFAULT_VERSION "1.9.3")
+  set(ORTHANC_FRAMEWORK_DEFAULT_VERSION "1.9.7")
   set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "web")
 endif()
 
--- a/NEWS	Thu Dec 02 13:03:04 2021 +0100
+++ b/NEWS	Thu Dec 02 13:03:45 2021 +0100
@@ -1,8 +1,12 @@
 Pending changes in the mainline
 ===============================
 
+* Show an error message when trying to send studies > 4GB via STOW-RS
+
+Version 1.7 (2021-08-31)
+========================
+
 * Detection of windowing and rescale in ".../rendered" for Philips multiframe images
-* Show an error message when trying to send studies > 4GB via STOW-RS
 
 
 Version 1.6 (2021-05-07)
--- a/Plugin/WadoRsRetrieveRendered.cpp	Thu Dec 02 13:03:04 2021 +0100
+++ b/Plugin/WadoRsRetrieveRendered.cpp	Thu Dec 02 13:03:45 2021 +0100
@@ -26,13 +26,70 @@
 #include <Images/ImageProcessing.h>
 #include <Images/ImageTraits.h>
 #include <Logging.h>
-#include <SerializationToolbox.h>
 #include <Toolbox.h>
 
+#if ORTHANC_FRAMEWORK_VERSION_IS_ABOVE(1, 9, 7)
+#  include <SerializationToolbox.h>
+#else
+#  include <boost/lexical_cast.hpp>
+#endif
+
 #include <boost/algorithm/string/predicate.hpp>
 #include <boost/math/special_functions/round.hpp>
 
 
+static bool ParseFloat(float& target,
+                       const std::string& source)
+{
+#if ORTHANC_FRAMEWORK_VERSION_IS_ABOVE(1, 9, 7)
+  return Orthanc::SerializationToolbox::ParseFloat(target, source);
+
+#else
+  // Emulation for older versions of the Orthanc framework
+  std::string s = Orthanc::Toolbox::StripSpaces(source);
+  
+  if (s.empty())
+  {
+    return false;
+  }
+  else
+  {
+    try
+    {
+      target = boost::lexical_cast<float>(s);
+      return true;
+    }
+    catch (boost::bad_lexical_cast&)
+    {
+      return false;
+    }
+  }
+#endif
+}
+
+
+static bool ParseFirstFloat(float& target,
+                            const std::string& source)
+{
+#if ORTHANC_FRAMEWORK_VERSION_IS_ABOVE(1, 9, 7)
+  return Orthanc::SerializationToolbox::ParseFirstFloat(target, source);
+
+#else
+  // Emulation for older versions of the Orthanc framework
+  std::vector<std::string> tokens;
+  Orthanc::Toolbox::TokenizeString(tokens, source, '\\');
+  if (tokens.empty())
+  {
+    return false;
+  }
+  else
+  {
+    return ParseFloat(target, tokens[0]);
+  }
+#endif
+}
+
+
 namespace
 {
   enum WindowingMode
@@ -722,8 +779,8 @@
   {
     float s, i;
 
-    if (Orthanc::SerializationToolbox::ParseFloat(s, tags[RESCALE_SLOPE].asString()) &&
-        Orthanc::SerializationToolbox::ParseFloat(i, tags[RESCALE_INTERCEPT].asString()))
+    if (ParseFloat(s, tags[RESCALE_SLOPE].asString()) &&
+        ParseFloat(i, tags[RESCALE_INTERCEPT].asString()))
     {
       parameters.SetRescaleSlope(s);
       parameters.SetRescaleIntercept(i);
@@ -749,8 +806,8 @@
   {
     float wc, ww;
 
-    if (Orthanc::SerializationToolbox::ParseFirstFloat(wc, tags[WINDOW_CENTER].asString()) &&
-        Orthanc::SerializationToolbox::ParseFirstFloat(ww, tags[WINDOW_WIDTH].asString()))
+    if (ParseFirstFloat(wc, tags[WINDOW_CENTER].asString()) &&
+        ParseFirstFloat(ww, tags[WINDOW_WIDTH].asString()))
     {
       parameters.SetWindow(wc, ww);
       return true;
--- a/Resources/Orthanc/CMake/DownloadOrthancFramework.cmake	Thu Dec 02 13:03:04 2021 +0100
+++ b/Resources/Orthanc/CMake/DownloadOrthancFramework.cmake	Thu Dec 02 13:03:45 2021 +0100
@@ -130,6 +130,14 @@
         set(ORTHANC_FRAMEWORK_MD5 "3ea66c09f64aca990016683b6375734e")
       elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.9.3")
         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")
+      elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.9.6")
+        set(ORTHANC_FRAMEWORK_MD5 "4b5d05683d747c29b2860ad79d11e62e")
+      elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.9.7")
+        set(ORTHANC_FRAMEWORK_MD5 "c912bbb860d640d3ae3003b5c9698205")
 
       # Below this point are development snapshots that were used to
       # release some plugin, before an official release of the Orthanc