comparison 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
comparison
equal deleted inserted replaced
317:f611fb47d0e8 318:8ad12abde290
41 #include <cassert> 41 #include <cassert>
42 42
43 #define ORTHANC_PLUGIN_NAME "wsi" 43 #define ORTHANC_PLUGIN_NAME "wsi"
44 44
45 45
46 static void AnswerSparseTile(OrthancPluginRestOutput* output,
47 unsigned int tileWidth,
48 unsigned int tileHeight)
49 {
50 Orthanc::Image tile(Orthanc::PixelFormat_RGB24, tileWidth, tileHeight, false);
51
52 // Black (TODO parameter)
53 uint8_t red = 0;
54 uint8_t green = 0;
55 uint8_t blue = 0;
56 Orthanc::ImageProcessing::Set(tile, red, green, blue, 255);
57
58 // TODO Cache the tile
59 OrthancPluginCompressAndAnswerPngImage(OrthancPlugins::GetGlobalContext(),
60 output, OrthancPluginPixelFormat_RGB24,
61 tile.GetWidth(), tile.GetHeight(),
62 tile.GetPitch(), tile.GetBuffer());
63 }
64
65
66 static bool DisplayPerformanceWarning() 46 static bool DisplayPerformanceWarning()
67 { 47 {
68 (void) DisplayPerformanceWarning; // Disable warning about unused function 48 (void) DisplayPerformanceWarning; // Disable warning about unused function
69 OrthancPluginLogWarning(OrthancPlugins::GetGlobalContext(), "Performance warning in whole-slide imaging: " 49 OrthancPluginLogWarning(OrthancPlugins::GetGlobalContext(), "Performance warning in whole-slide imaging: "
70 "Non-release build, runtime debug assertions are turned on"); 50 "Non-release build, runtime debug assertions are turned on");
161 141
162 rawTile.reset(new OrthancWSI::RawTile(locker.GetPyramid(), 142 rawTile.reset(new OrthancWSI::RawTile(locker.GetPyramid(),
163 static_cast<unsigned int>(level), 143 static_cast<unsigned int>(level),
164 static_cast<unsigned int>(tileX), 144 static_cast<unsigned int>(tileX),
165 static_cast<unsigned int>(tileY))); 145 static_cast<unsigned int>(tileY)));
146 }
147
148 if (rawTile->IsEmpty())
149 {
150 OrthancWSI::RawTile::AnswerBackgroundTile(output, rawTile->GetTileWidth(), rawTile->GetTileHeight());
151 return;
166 } 152 }
167 153
168 Orthanc::MimeType mime; 154 Orthanc::MimeType mime;
169 155
170 if (rawTile->GetCompression() == OrthancWSI::ImageCompression_Jpeg) 156 if (rawTile->GetCompression() == OrthancWSI::ImageCompression_Jpeg)