changeset 913:2b4b6b86520a

Re-enabled gl debug output in GuiAdapter + REMOVED GZIP ENCODING IN OrthancSeriesVolumeProgressiveLoader + added ability to use custom windowing in GrayscaleStyleConfigurator
author Benjamin Golinvaux <bgo@osimis.io>
date Fri, 19 Jul 2019 10:30:40 +0200
parents a6c12fe88bcb
children 4d1f57773b5b
files Applications/Generic/GuiAdapter.cpp Framework/Loaders/OrthancSeriesVolumeProgressiveLoader.cpp Framework/Scene2D/GrayscaleStyleConfigurator.cpp Framework/Scene2D/GrayscaleStyleConfigurator.h
diffstat 4 files changed, 29 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/Applications/Generic/GuiAdapter.cpp	Thu Jul 18 10:39:00 2019 +0200
+++ b/Applications/Generic/GuiAdapter.cpp	Fri Jul 19 10:30:40 2019 +0200
@@ -725,7 +725,7 @@
   // SDL ONLY
   void GuiAdapter::Run()
   {
-#if 0 
+#if 1
     // TODO: MAKE THIS DYNAMIC !!! See SdlOpenGLViewport vs Cairo in ViewportWrapper
 # if ORTHANC_ENABLE_OPENGL == 1 && !defined(__APPLE__)
     glEnable(GL_DEBUG_OUTPUT);
--- a/Framework/Loaders/OrthancSeriesVolumeProgressiveLoader.cpp	Thu Jul 18 10:39:00 2019 +0200
+++ b/Framework/Loaders/OrthancSeriesVolumeProgressiveLoader.cpp	Fri Jul 19 10:30:40 2019 +0200
@@ -264,7 +264,10 @@
       if (quality == BEST_QUALITY)
       {
         std::auto_ptr<GetOrthancImageCommand> tmp(new GetOrthancImageCommand);
-        tmp->SetHttpHeader("Accept-Encoding", "gzip");
+        // TODO: review the following comment. Commented out by bgo on 2019-07-19
+        // reason: Alain has seen cases where gzipping the uint16 image took 11 sec 
+        // to produce 5mb. The unzipped request was much much faster.
+        //tmp->SetHttpHeader("Accept-Encoding", "gzip");
         tmp->SetHttpHeader("Accept", std::string(Orthanc::EnumerationToString(Orthanc::MimeType_Pam)));
         tmp->SetInstanceUri(instance, slice.GetExpectedPixelFormat());
         tmp->SetExpectedPixelFormat(slice.GetExpectedPixelFormat());
@@ -273,7 +276,9 @@
       else
       {
         std::auto_ptr<GetOrthancWebViewerJpegCommand> tmp(new GetOrthancWebViewerJpegCommand);
-        tmp->SetHttpHeader("Accept-Encoding", "gzip");
+        // TODO: review the following comment. Commented out by bgo on 2019-07-19
+        // (gzip for jpeg seems overkill)
+        //tmp->SetHttpHeader("Accept-Encoding", "gzip");
         tmp->SetInstance(instance);
         tmp->SetQuality((quality == 0 ? 50 : 90));
         tmp->SetExpectedPixelFormat(slice.GetExpectedPixelFormat());
--- a/Framework/Scene2D/GrayscaleStyleConfigurator.cpp	Thu Jul 18 10:39:00 2019 +0200
+++ b/Framework/Scene2D/GrayscaleStyleConfigurator.cpp	Fri Jul 19 10:30:40 2019 +0200
@@ -34,6 +34,12 @@
     revision_++;
   }
 
+  void GrayscaleStyleConfigurator::SetCustomWindowing(float windowCenter, float windowWidth)
+  {
+    SetWindowing(ImageWindowing_Custom);
+    customWindowCenter_ = windowCenter;
+    customWindowWidth_ = windowWidth;
+  }
 
   void GrayscaleStyleConfigurator::SetLinearInterpolation(bool enabled)
   {
@@ -41,14 +47,12 @@
     revision_++;
   }
 
-  
   TextureBaseSceneLayer* GrayscaleStyleConfigurator::CreateTextureFromImage(
     const Orthanc::ImageAccessor& image) const
   {
     throw Orthanc::OrthancException(Orthanc::ErrorCode_NotImplemented);
   }
 
-  
   TextureBaseSceneLayer* GrayscaleStyleConfigurator::CreateTextureFromDicom(
     const Orthanc::ImageAccessor& frame,
     const DicomInstanceParameters& parameters) const
@@ -66,7 +70,6 @@
     }
   }
 
-
   void GrayscaleStyleConfigurator::ApplyStyle(ISceneLayer& layer) const
   {
     FloatTextureSceneLayer& l = dynamic_cast<FloatTextureSceneLayer&>(layer);
@@ -75,7 +78,14 @@
 
     if (hasWindowing_)
     {
-      l.SetWindowing(windowing_);
+      if (windowing_ != ImageWindowing_Custom)
+      {
+        l.SetWindowing(windowing_);
+      }
+      else
+      {
+        l.SetCustomWindowing(customWindowCenter_, customWindowWidth_);
+      }
     }
   }
 }
--- a/Framework/Scene2D/GrayscaleStyleConfigurator.h	Thu Jul 18 10:39:00 2019 +0200
+++ b/Framework/Scene2D/GrayscaleStyleConfigurator.h	Fri Jul 19 10:30:40 2019 +0200
@@ -36,19 +36,24 @@
     bool            linearInterpolation_;
     bool            hasWindowing_;
     ImageWindowing  windowing_;
-
+    float           customWindowWidth_;
+    float           customWindowCenter_;
     // TODO - Add custom windowing
     
   public:
     GrayscaleStyleConfigurator() :
       revision_(0),
       linearInterpolation_(false),
-      hasWindowing_(false)
+      hasWindowing_(false),
+      customWindowWidth_(0),
+      customWindowCenter_(0)
     {
     }
 
     void SetWindowing(ImageWindowing windowing);
 
+    void SetCustomWindowing(float windowWidth, float windowCenter);
+
     void SetLinearInterpolation(bool enabled);
 
     bool IsLinearInterpolation() const