changeset 925:4639d0bf6390

Added support for Grayscale16 in the multiframe loader (Victor)
author Benjamin Golinvaux <bgo@osimis.io>
date Mon, 22 Jul 2019 16:00:03 +0200
parents 988fa647df21
children e594e76e0a81
files Framework/Loaders/OrthancMultiframeVolumeLoader.cpp
diffstat 1 files changed, 13 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/Loaders/OrthancMultiframeVolumeLoader.cpp	Mon Jul 22 11:22:56 2019 +0200
+++ b/Framework/Loaders/OrthancMultiframeVolumeLoader.cpp	Mon Jul 22 16:00:03 2019 +0200
@@ -127,8 +127,7 @@
       GetLoader<OrthancMultiframeVolumeLoader>().SetTransferSyntax(message.GetAnswer());
     }
   };
-   
-    
+
   class OrthancMultiframeVolumeLoader::LoadUncompressedPixelData : public State
   {
   public:
@@ -142,8 +141,7 @@
       GetLoader<OrthancMultiframeVolumeLoader>().SetUncompressedPixelData(message.GetAnswer());
     }
   };
-   
-    
+
   const std::string& OrthancMultiframeVolumeLoader::GetInstanceId() const
   {
     if (IsActive())
@@ -156,7 +154,6 @@
     }
   }
 
-
   void OrthancMultiframeVolumeLoader::ScheduleFrameDownloads()
   {
     if (transferSyntaxUid_.empty() ||
@@ -243,13 +240,18 @@
 
 
   ORTHANC_FORCE_INLINE
-  static void CopyPixel(uint32_t& target,
-                        const void* source)
+  static void CopyPixel(uint32_t& target, const void* source)
   {
     // TODO - check alignement?
     target = le32toh(*reinterpret_cast<const uint32_t*>(source));
   }
-      
+
+  ORTHANC_FORCE_INLINE
+    static void CopyPixel(uint16_t& target, const void* source)
+  {
+    // TODO - check alignement?
+    target = le16toh(*reinterpret_cast<const uint16_t*>(source));
+  }
 
   template <typename T>
   void OrthancMultiframeVolumeLoader::CopyPixelData(const std::string& pixelData)
@@ -305,7 +307,9 @@
       case Orthanc::PixelFormat_Grayscale32:
         CopyPixelData<uint32_t>(pixelData);
         break;
-
+      case Orthanc::PixelFormat_Grayscale16:
+        CopyPixelData<uint16_t>(pixelData);
+        break;
       default:
         throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);
     }