changeset 514:c30f18b87876

display information about the source background color
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 21 Aug 2026 17:02:55 +0200
parents 8e1efa410312
children b26611429f83
files Applications/Dicomizer.cpp Framework/BackgroundColor.cpp Framework/BackgroundColor.h
diffstat 3 files changed, 22 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Applications/Dicomizer.cpp	Wed Aug 19 19:08:23 2026 +0200
+++ b/Applications/Dicomizer.cpp	Fri Aug 21 17:02:55 2026 +0200
@@ -219,6 +219,7 @@
   LOG(WARNING) << "Pixel format: " << Orthanc::EnumerationToString(source.GetPixelFormat());
   LOG(WARNING) << "Source photometric interpretation: " << Orthanc::EnumerationToString(source.GetPhotometricInterpretation());
   LOG(WARNING) << "Source compression: " << EnumerationToString(sourceCompression);
+  LOG(WARNING) << "Source background color: " << source.GetBackgroundColor().Format();
   LOG(WARNING) << "Smoothing is " << (parameters.IsSmoothEnabled() ? "enabled" : "disabled");
 
   if (parameters.IsRepaintBackground())
--- a/Framework/BackgroundColor.cpp	Wed Aug 19 19:08:23 2026 +0200
+++ b/Framework/BackgroundColor.cpp	Fri Aug 21 17:02:55 2026 +0200
@@ -27,6 +27,8 @@
 
 #include <OrthancException.h>
 
+#include <boost/lexical_cast.hpp>
+
 
 namespace OrthancWSI
 {
@@ -89,6 +91,21 @@
   }
 
 
+  std::string BackgroundColor::Format() const
+  {
+    if (present_)
+    {
+      return ("(" + boost::lexical_cast<std::string>(static_cast<unsigned int>(red_)) + "," +
+              boost::lexical_cast<std::string>(static_cast<unsigned int>(green_)) + "," +
+              boost::lexical_cast<std::string>(static_cast<unsigned int>(blue_)) + ")");
+    }
+    else
+    {
+      return "None";
+    }
+  }
+
+
   void BackgroundColor::Fill(Orthanc::ImageAccessor& region,
                              uint8_t defaultRed,
                              uint8_t defaultGreen,
--- a/Framework/BackgroundColor.h	Wed Aug 19 19:08:23 2026 +0200
+++ b/Framework/BackgroundColor.h	Fri Aug 21 17:02:55 2026 +0200
@@ -24,6 +24,8 @@
 #pragma once
 
 #include <stdint.h>
+#include <string>
+
 
 namespace Orthanc
 {
@@ -70,6 +72,8 @@
 
     uint8_t GetBlue() const;
 
+    std::string Format() const;
+
     void Fill(Orthanc::ImageAccessor& region,
               uint8_t defaultRed,
               uint8_t defaultGreen,