changeset 509:f8cd1ddb777c

added abstraction ITiledPyramid::GetBackgroundColor()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 19 Aug 2026 16:37:30 +0200
parents 1ff289174726
children ea451645a59e
files Applications/Dicomizer.cpp Framework/Inputs/DecodedTiledPyramid.h Framework/Inputs/DicomPyramid.h Framework/Inputs/HierarchicalTiff.h Framework/Inputs/ITiledPyramid.h Framework/Inputs/TiledPyramidStatistics.h Framework/Outputs/InMemoryTiledImage.cpp Framework/Outputs/InMemoryTiledImage.h Framework/Outputs/TruncatedPyramidWriter.cpp Framework/Outputs/TruncatedPyramidWriter.h
diffstat 10 files changed, 34 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/Applications/Dicomizer.cpp	Mon Aug 10 09:41:52 2026 +0200
+++ b/Applications/Dicomizer.cpp	Wed Aug 19 16:37:30 2026 +0200
@@ -181,7 +181,7 @@
   if (lowerLevelsCount != levelsCount)
   {
     LOG(WARNING) << "Constructing the " << lowerLevelsCount << " lower levels of the pyramid";
-    OrthancWSI::TruncatedPyramidWriter truncated(target, lowerLevelsCount, source.GetPhotometricInterpretation());
+    OrthancWSI::TruncatedPyramidWriter truncated(target, lowerLevelsCount, source.GetPhotometricInterpretation(), source.GetBackgroundColor());
     OrthancWSI::ReconstructPyramidCommand::PrepareBagOfTasks
       (tasks, truncated, source, lowerLevelsCount + 1, 0, parameters);
     OrthancWSI::ApplicationToolbox::Execute(tasks, parameters.GetThreadsCount());
--- a/Framework/Inputs/DecodedTiledPyramid.h	Mon Aug 10 09:41:52 2026 +0200
+++ b/Framework/Inputs/DecodedTiledPyramid.h	Wed Aug 19 16:37:30 2026 +0200
@@ -57,7 +57,7 @@
       backgroundColor_.SetValue(red, green, blue);
     }
 
-    const BackgroundColor& GetBackgroundColor() const
+    virtual BackgroundColor GetBackgroundColor() const ORTHANC_OVERRIDE
     {
       return backgroundColor_;
     }
--- a/Framework/Inputs/DicomPyramid.h	Mon Aug 10 09:41:52 2026 +0200
+++ b/Framework/Inputs/DicomPyramid.h	Wed Aug 19 16:37:30 2026 +0200
@@ -87,7 +87,7 @@
 
     virtual Orthanc::PhotometricInterpretation GetPhotometricInterpretation() const ORTHANC_OVERRIDE;
 
-    const BackgroundColor& GetBackgroundColor() const
+    virtual BackgroundColor GetBackgroundColor() const ORTHANC_OVERRIDE
     {
       return backgroundColor_;
     }
--- a/Framework/Inputs/HierarchicalTiff.h	Mon Aug 10 09:41:52 2026 +0200
+++ b/Framework/Inputs/HierarchicalTiff.h	Wed Aug 19 16:37:30 2026 +0200
@@ -106,5 +106,10 @@
 
     bool LookupImagedVolumeSize(double& width,
                                 double& height) const;
+
+    virtual BackgroundColor GetBackgroundColor() const ORTHANC_OVERRIDE
+    {
+      return BackgroundColor();  // No background color
+    }
   };
 }
--- a/Framework/Inputs/ITiledPyramid.h	Mon Aug 10 09:41:52 2026 +0200
+++ b/Framework/Inputs/ITiledPyramid.h	Wed Aug 19 16:37:30 2026 +0200
@@ -23,6 +23,7 @@
 
 #pragma once
 
+#include "../BackgroundColor.h"
 #include "../Enumerations.h"
 
 #include <Compatibility.h>
@@ -69,5 +70,7 @@
     virtual Orthanc::PixelFormat GetPixelFormat() const = 0;
 
     virtual Orthanc::PhotometricInterpretation GetPhotometricInterpretation() const = 0;
+
+    virtual BackgroundColor GetBackgroundColor() const = 0;
   };
 }
--- a/Framework/Inputs/TiledPyramidStatistics.h	Mon Aug 10 09:41:52 2026 +0200
+++ b/Framework/Inputs/TiledPyramidStatistics.h	Wed Aug 19 16:37:30 2026 +0200
@@ -87,5 +87,10 @@
     {
       return source_.GetPhotometricInterpretation();
     }
+
+    virtual BackgroundColor GetBackgroundColor() const ORTHANC_OVERRIDE
+    {
+      return source_.GetBackgroundColor();
+    }
   };
 }
--- a/Framework/Outputs/InMemoryTiledImage.cpp	Mon Aug 10 09:41:52 2026 +0200
+++ b/Framework/Outputs/InMemoryTiledImage.cpp	Wed Aug 19 16:37:30 2026 +0200
@@ -48,13 +48,15 @@
                                          unsigned int countTilesY,
                                          unsigned int tileWidth,
                                          unsigned int tileHeight,
-                                         Orthanc::PhotometricInterpretation photometric) :
+                                         Orthanc::PhotometricInterpretation photometric,
+                                         BackgroundColor backgroundColor) :
     format_(format),
     countTilesX_(countTilesX),
     countTilesY_(countTilesY),
     tileWidth_(tileWidth),
     tileHeight_(tileHeight),
-    photometric_(photometric)
+    photometric_(photometric),
+    backgroundColor_(backgroundColor)
   {
   }
 
--- a/Framework/Outputs/InMemoryTiledImage.h	Mon Aug 10 09:41:52 2026 +0200
+++ b/Framework/Outputs/InMemoryTiledImage.h	Wed Aug 19 16:37:30 2026 +0200
@@ -47,6 +47,7 @@
     unsigned int          tileHeight_;
     Tiles                 tiles_;
     Orthanc::PhotometricInterpretation  photometric_;
+    BackgroundColor       backgroundColor_;
 
   public:
     InMemoryTiledImage(Orthanc::PixelFormat format,
@@ -54,7 +55,8 @@
                        unsigned int countTilesY,
                        unsigned int tileWidth,
                        unsigned int tileHeight,
-                       Orthanc::PhotometricInterpretation photometric);
+                       Orthanc::PhotometricInterpretation photometric,
+                       BackgroundColor backgroundColor);
 
     virtual ~InMemoryTiledImage();
 
@@ -124,5 +126,10 @@
     {
       return photometric_;
     }
+
+    virtual BackgroundColor GetBackgroundColor() const ORTHANC_OVERRIDE
+    {
+      return backgroundColor_;
+    }
   };
 }
--- a/Framework/Outputs/TruncatedPyramidWriter.cpp	Mon Aug 10 09:41:52 2026 +0200
+++ b/Framework/Outputs/TruncatedPyramidWriter.cpp	Wed Aug 19 16:37:30 2026 +0200
@@ -30,14 +30,16 @@
 {
   TruncatedPyramidWriter::TruncatedPyramidWriter(IPyramidWriter& lower,
                                                  unsigned int upperLevelIndex,
-                                                 Orthanc::PhotometricInterpretation photometric) :
+                                                 Orthanc::PhotometricInterpretation photometric,
+                                                 const BackgroundColor& backgroundColor) :
     lowerLevels_(lower),
     upperLevel_(lower.GetPixelFormat(),
                 lower.GetCountTilesX(upperLevelIndex),
                 lower.GetCountTilesY(upperLevelIndex),
                 lower.GetTileWidth(),
                 lower.GetTileHeight(),
-                photometric),
+                photometric,
+                backgroundColor),
     upperLevelIndex_(upperLevelIndex)
   {
     if (upperLevelIndex > lower.GetLevelCount())
--- a/Framework/Outputs/TruncatedPyramidWriter.h	Mon Aug 10 09:41:52 2026 +0200
+++ b/Framework/Outputs/TruncatedPyramidWriter.h	Wed Aug 19 16:37:30 2026 +0200
@@ -37,7 +37,8 @@
   public:
     TruncatedPyramidWriter(IPyramidWriter& lower,
                            unsigned int upperLevelIndex,
-                           Orthanc::PhotometricInterpretation photometric);
+                           Orthanc::PhotometricInterpretation photometric,
+                           const BackgroundColor& backgroundColor);
 
     virtual unsigned int GetLevelCount() const ORTHANC_OVERRIDE
     {