diff Framework/Radiography/RadiographyScene.cpp @ 432:4eb96c6b4e96 am-vsol-upgrade

improved handling of MONOCHROME1, background and invertion
author am@osimis.io
date Mon, 03 Dec 2018 13:53:29 +0100
parents 26b90b110719
children 04711a2e12cd
line wrap: on
line diff
--- a/Framework/Radiography/RadiographyScene.cpp	Thu Nov 29 19:25:15 2018 +0100
+++ b/Framework/Radiography/RadiographyScene.cpp	Mon Dec 03 13:53:29 2018 +0100
@@ -166,6 +166,21 @@
     }
   }
 
+  PhotometricDisplayMode RadiographyScene::GetPreferredPhotomotricDisplayMode() const
+  {
+    // return the mode of the first layer who "cares" about its display mode (normaly, the one and only layer that is a DicomLayer)
+    for (Layers::const_iterator it = layers_.begin(); it != layers_.end(); it++)
+    {
+      if (it->second->GetPreferredPhotomotricDisplayMode() != PhotometricDisplayMode_Default)
+      {
+        return it->second->GetPreferredPhotomotricDisplayMode();
+      }
+    }
+
+    return PhotometricDisplayMode_Default;
+  }
+
+
   void RadiographyScene::GetLayersIndexes(std::vector<size_t>& output) const
   {
     for (Layers::const_iterator it = layers_.begin(); it != layers_.end(); it++)
@@ -423,8 +438,6 @@
                                 const AffineTransform2D& viewTransform,
                                 ImageInterpolation interpolation) const
   {
-    Orthanc::ImageProcessing::Set(buffer, 0);
-
     // Render layers in the background-to-foreground order
     for (size_t index = 0; index < countLayers_; index++)
     {
@@ -571,6 +584,9 @@
           AffineTransform2D::CreateScaling(1.0 / pixelSpacingX, 1.0 / pixelSpacingY),
           AffineTransform2D::CreateOffset(-extent.GetX1(), -extent.GetY1()));
 
+    // wipe background before rendering
+    Orthanc::ImageProcessing::Set(layers, 0);
+
     Render(layers, view, interpolation);
 
     Orthanc::Image rendered(Orthanc::PixelFormat_Grayscale16,