changeset 756:f24b8e529ea3

fix compatibility with orthanc framework <= 1.12.10
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 14 Apr 2026 18:16:54 +0200
parents 161293383661
children 99493d452c72 e8201b420d04
files CMakeLists.txt Plugin/WadoRsRetrieveRendered.cpp
diffstat 2 files changed, 38 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Tue Apr 14 15:48:07 2026 +0200
+++ b/CMakeLists.txt	Tue Apr 14 18:16:54 2026 +0200
@@ -29,7 +29,9 @@
   set(ORTHANC_FRAMEWORK_DEFAULT_VERSION "mainline")
   set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "hg")
 else()
-  set(ORTHANC_FRAMEWORK_DEFAULT_VERSION "1.12.11")
+  # Do NOT use framework 1.12.11 here, which is buggy because of:
+  # https://orthanc.uclouvain.be/hg/orthanc/rev/3bd8715e21bc
+  set(ORTHANC_FRAMEWORK_DEFAULT_VERSION "1.12.10")
   set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "web")
 endif()
 
--- a/Plugin/WadoRsRetrieveRendered.cpp	Tue Apr 14 15:48:07 2026 +0200
+++ b/Plugin/WadoRsRetrieveRendered.cpp	Tue Apr 14 18:16:54 2026 +0200
@@ -24,7 +24,6 @@
 
 #include "../Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h"
 
-#include <CompatibilityMath.h>
 #include <Images/Image.h>
 #include <Images/ImageProcessing.h>
 #include <Images/ImageTraits.h>
@@ -33,6 +32,41 @@
 #include <EmbeddedResources.h>
 
 
+#if ORTHANC_FRAMEWORK_VERSION_IS_ABOVE(1, 12, 11)
+#  include <CompatibilityMath.h>
+#else
+
+// For compatibility of Boost 1.89.0 with MSVC <= 2015, this is an excerpt from:
+// https://orthanc.uclouvain.be/hg/orthanc/file/Orthanc-1.12.11/OrthancFramework/Sources/CompatibilityMath.h
+namespace Orthanc
+{
+  namespace Math
+  {
+    namespace Internals
+    {
+      float RoundFloat(float v)
+      {
+        if (v >= 0.0f)
+        {
+          return std::floor(v + 0.5f);
+        }
+        else
+        {
+          return std::ceil(v - 0.5f);
+        }
+      }
+    }
+
+    int iround(float v)
+    {
+      return static_cast<int>(Internals::RoundFloat(v));
+    }
+  }
+}
+
+#endif
+
+
 #if ORTHANC_FRAMEWORK_VERSION_IS_ABOVE(1, 9, 7)
 #  include <SerializationToolbox.h>
 #else