changeset 4534:d9700b9f4ad9

back to mainline
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 25 Feb 2021 18:27:28 +0100
parents d64e6f401a8a (current diff) 409cba9c1dba (diff)
children c40c1234a696
files OrthancFramework/Resources/CMake/DownloadOrthancFramework.cmake OrthancFramework/Resources/CMake/OrthancFrameworkParameters.cmake
diffstat 4 files changed, 45 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Thu Feb 25 12:15:18 2021 +0100
+++ b/NEWS	Thu Feb 25 18:27:28 2021 +0100
@@ -1,6 +1,10 @@
 Pending changes in the mainline
 ===============================
 
+
+Version 1.9.1 (2021-02-25)
+==========================
+
 General
 -------
 
--- a/OrthancFramework/Resources/CMake/DownloadOrthancFramework.cmake	Thu Feb 25 12:15:18 2021 +0100
+++ b/OrthancFramework/Resources/CMake/DownloadOrthancFramework.cmake	Thu Feb 25 18:27:28 2021 +0100
@@ -124,6 +124,8 @@
         set(ORTHANC_FRAMEWORK_MD5 "8bfa10e66c9931e74111be0bfb1f4548")
       elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.9.0")
         set(ORTHANC_FRAMEWORK_MD5 "cea0b02ce184671eaf1bd668beefbf28")
+      elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.9.1")
+        set(ORTHANC_FRAMEWORK_MD5 "08eebc66ef93c3b40115c38501db5fbd")
 
       # Below this point are development snapshots that were used to
       # release some plugin, before an official release of the Orthanc
--- a/OrthancFramework/Sources/DicomParsing/ParsedDicomFile.cpp	Thu Feb 25 12:15:18 2021 +0100
+++ b/OrthancFramework/Sources/DicomParsing/ParsedDicomFile.cpp	Thu Feb 25 18:27:28 2021 +0100
@@ -104,6 +104,7 @@
 #include <dcmtk/dcmdata/dcuid.h>
 #include <dcmtk/dcmdata/dcmetinf.h>
 #include <dcmtk/dcmdata/dcdeftag.h>
+#include <dcmtk/dcmdata/dcswap.h>
 
 #include <dcmtk/dcmdata/dcvrae.h>
 #include <dcmtk/dcmdata/dcvras.h>
@@ -1389,39 +1390,52 @@
     const unsigned int height = accessor.GetHeight();
     const unsigned int width = accessor.GetWidth();
 
-    for (unsigned int y = 0; y < height; y++)
     {
-      switch (accessor.GetFormat())
+      Uint8* q = target;
+      for (unsigned int y = 0; y < height; y++)
       {
-        case PixelFormat_RGB24:
-        case PixelFormat_Grayscale8:
-        case PixelFormat_Grayscale16:
-        case PixelFormat_SignedGrayscale16:
+        switch (accessor.GetFormat())
         {
-          memcpy(target, reinterpret_cast<const Uint8*>(accessor.GetConstRow(y)), pitch);
-          target += pitch;
-          break;
-        }
-
-        case PixelFormat_RGBA32:
-        {
-          // The alpha channel is not supported by the DICOM standard
-          const Uint8* source = reinterpret_cast<const Uint8*>(accessor.GetConstRow(y));
-          for (unsigned int x = 0; x < width; x++, target += 3, source += 4)
+          case PixelFormat_RGB24:
+          case PixelFormat_Grayscale8:
+          case PixelFormat_Grayscale16:
+          case PixelFormat_SignedGrayscale16:
           {
-            target[0] = source[0];
-            target[1] = source[1];
-            target[2] = source[2];
+            memcpy(q, reinterpret_cast<const Uint8*>(accessor.GetConstRow(y)), pitch);
+            q += pitch;
+            break;
           }
 
-          break;
-        }
+          case PixelFormat_RGBA32:
+          {
+            // The alpha channel is not supported by the DICOM standard
+            const Uint8* source = reinterpret_cast<const Uint8*>(accessor.GetConstRow(y));
+            for (unsigned int x = 0; x < width; x++, q += 3, source += 4)
+            {
+              q[0] = source[0];
+              q[1] = source[1];
+              q[2] = source[2];
+            }
+
+            break;
+          }
           
-        default:
-          throw OrthancException(ErrorCode_NotImplemented);
+          default:
+            throw OrthancException(ErrorCode_NotImplemented);
+        }
       }
     }
 
+    static const Endianness ENDIANNESS = Toolbox::DetectEndianness();
+    if (ENDIANNESS == Endianness_Big &&
+        (accessor.GetFormat() == PixelFormat_Grayscale16 ||
+         accessor.GetFormat() == PixelFormat_SignedGrayscale16))
+    {
+      // New in Orthanc 1.9.1
+      assert(pitch % 2 == 0);
+      swapBytes(target, accessor.GetHeight() * pitch, sizeof(uint16_t));
+    }
+
     if (!GetDcmtkObject().getDataset()->insert(pixels.release(), false, false).good())
     {
       throw OrthancException(ErrorCode_InternalError);
--- a/OrthancFramework/UnitTestsSources/FromDcmtkTests.cpp	Thu Feb 25 12:15:18 2021 +0100
+++ b/OrthancFramework/UnitTestsSources/FromDcmtkTests.cpp	Thu Feb 25 18:27:28 2021 +0100
@@ -921,7 +921,7 @@
     uint16_t *p = reinterpret_cast<uint16_t*>(image.GetRow(y));
     for (int x = 0; x < 256; x++, v++, p++)
     {
-      *p = htole16(v);   // Orthanc uses Little-Endian transfer syntax to encode images
+      *p = v;
     }
   }
 
@@ -976,7 +976,7 @@
     int16_t *p = reinterpret_cast<int16_t*>(image.GetRow(y));
     for (int x = 0; x < 256; x++, v++, p++)
     {
-      *p = htole16(v);   // Orthanc uses Little-Endian transfer syntax to encode images
+      *p = v;
     }
   }