diff ViewerPlugin/Plugin.cpp @ 318:8ad12abde290

sparse re-encoding with OpenSlide (notably for MIRAX format)
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 11 Sep 2024 16:11:16 +0200
parents 0683312e21ba
children c42083d50ddf
line wrap: on
line diff
--- a/ViewerPlugin/Plugin.cpp	Wed Sep 11 13:43:39 2024 +0200
+++ b/ViewerPlugin/Plugin.cpp	Wed Sep 11 16:11:16 2024 +0200
@@ -43,26 +43,6 @@
 #define ORTHANC_PLUGIN_NAME "wsi"
 
 
-static void AnswerSparseTile(OrthancPluginRestOutput* output,
-                             unsigned int tileWidth,
-                             unsigned int tileHeight)
-{
-  Orthanc::Image tile(Orthanc::PixelFormat_RGB24, tileWidth, tileHeight, false);
-
-  // Black (TODO parameter)
-  uint8_t red = 0;
-  uint8_t green = 0;
-  uint8_t blue = 0;
-  Orthanc::ImageProcessing::Set(tile, red, green, blue, 255);
-
-  // TODO Cache the tile
-  OrthancPluginCompressAndAnswerPngImage(OrthancPlugins::GetGlobalContext(),
-                                         output, OrthancPluginPixelFormat_RGB24, 
-                                         tile.GetWidth(), tile.GetHeight(), 
-                                         tile.GetPitch(), tile.GetBuffer());
-}
-
-
 static bool DisplayPerformanceWarning()
 {
   (void) DisplayPerformanceWarning;   // Disable warning about unused function
@@ -165,6 +145,12 @@
                                           static_cast<unsigned int>(tileY)));
   }
 
+  if (rawTile->IsEmpty())
+  {
+    OrthancWSI::RawTile::AnswerBackgroundTile(output, rawTile->GetTileWidth(), rawTile->GetTileHeight());
+    return;
+  }
+
   Orthanc::MimeType mime;
 
   if (rawTile->GetCompression() == OrthancWSI::ImageCompression_Jpeg)