changeset 369:557c8ff1db5c am-2

integration mainline->am-2
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 05 Nov 2018 10:03:14 +0100
parents face7b7008de (current diff) 1c2cf9216579 (diff)
children 17d1814c2fd4
files Applications/Qt/QCairoWidget.cpp Applications/Samples/SingleFrameEditorApplication.h Applications/Samples/SingleVolumeApplication.h Applications/Sdl/SdlCairoSurface.cpp Framework/Layers/ColorFrameRenderer.cpp Framework/Layers/GrayscaleFrameRenderer.cpp Framework/Toolbox/OrthancSlicesLoader.cpp Framework/Viewport/CairoSurface.cpp Framework/Viewport/CairoSurface.h Framework/Viewport/WidgetViewport.cpp Framework/Volumes/ImageBuffer3D.cpp Framework/Volumes/ImageBuffer3D.h Framework/Widgets/CairoWidget.cpp Framework/Widgets/LayoutWidget.cpp Resources/Orthanc/DownloadOrthancFramework.cmake
diffstat 15 files changed, 103 insertions(+), 76 deletions(-) [+]
line wrap: on
line diff
--- a/Applications/Qt/QCairoWidget.cpp	Thu Nov 01 12:09:11 2018 +0100
+++ b/Applications/Qt/QCairoWidget.cpp	Mon Nov 05 10:03:14 2018 +0100
@@ -51,7 +51,7 @@
     OrthancStone::NativeStoneApplicationContext::GlobalMutexLocker locker(*context_);
     OrthancStone::IViewport& viewport = context_->GetCentralViewport();
     Orthanc::ImageAccessor a;
-    surface_.GetAccessor(a);
+    surface_.GetWriteableAccessor(a);
     viewport.Render(a);
     painter.drawImage(0, 0, *image_);
   }
--- a/Applications/Samples/SingleFrameEditorApplication.h	Thu Nov 01 12:09:11 2018 +0100
+++ b/Applications/Samples/SingleFrameEditorApplication.h	Mon Nov 05 10:03:14 2018 +0100
@@ -2249,7 +2249,7 @@
         // GrayscaleFrameRenderer => TODO MERGE?
 
         Orthanc::ImageAccessor target;
-        cairoBuffer_->GetAccessor(target);
+        cairoBuffer_->GetWriteableAccessor(target);
 
         float scaling = 255.0f / (x1 - x0);
         
--- a/Applications/Samples/SingleVolumeApplication.h	Thu Nov 01 12:09:11 2018 +0100
+++ b/Applications/Samples/SingleVolumeApplication.h	Mon Nov 05 10:03:14 2018 +0100
@@ -173,8 +173,8 @@
 
         std::auto_ptr<LayerWidget> widget(new LayerWidget);
 
-#if 0
-        std::auto_ptr<OrthancVolumeImage> volume(new OrthancVolumeImage(context_->GetWebService(), true));
+#if 1
+        std::auto_ptr<OrthancVolumeImage> volume(new OrthancVolumeImage(context.GetWebService(), true));
         if (series.empty())
         {
           volume->ScheduleLoadInstance(instance);
@@ -189,6 +189,15 @@
         context_->AddInteractor(new Interactor(*volume, *widget, projection, 0));
         context_->AddSlicedVolume(volume.release());
 
+        if (1)
+        {
+          RenderStyle s;
+          //s.drawGrid_ = true;
+          s.alpha_ = 1;
+          s.windowing_ = ImageWindowing_Bone;
+          widget->SetLayerStyle(0, s);
+        }
+        else
         {
           RenderStyle s;
           s.alpha_ = 1;
--- a/Applications/Sdl/SdlCairoSurface.cpp	Thu Nov 01 12:09:11 2018 +0100
+++ b/Applications/Sdl/SdlCairoSurface.cpp	Mon Nov 05 10:03:14 2018 +0100
@@ -82,7 +82,7 @@
     }
 
     Orthanc::ImageAccessor target;
-    cairoSurface_->GetAccessor(target);
+    cairoSurface_->GetWriteableAccessor(target);
 
     if (viewport.Render(target))
     {
--- a/Framework/Layers/ColorFrameRenderer.cpp	Thu Nov 01 12:09:11 2018 +0100
+++ b/Framework/Layers/ColorFrameRenderer.cpp	Mon Nov 05 10:03:14 2018 +0100
@@ -31,7 +31,8 @@
     std::auto_ptr<CairoSurface> display(new CairoSurface(frame_->GetWidth(), frame_->GetHeight()));
 
     Orthanc::ImageAccessor target;
-    display->GetAccessor(target);
+    display->GetWriteableAccessor(target);
+    
     Orthanc::ImageProcessing::Convert(target, *frame_);
 
     return display.release();
--- a/Framework/Layers/GrayscaleFrameRenderer.cpp	Thu Nov 01 12:09:11 2018 +0100
+++ b/Framework/Layers/GrayscaleFrameRenderer.cpp	Mon Nov 05 10:03:14 2018 +0100
@@ -55,7 +55,8 @@
     }
 
     Orthanc::ImageAccessor target;
-    result->GetAccessor(target);
+    result->GetWriteableAccessor(target);
+    
     const unsigned int width = target.GetWidth();
     const unsigned int height = target.GetHeight();
     
--- a/Framework/Toolbox/OrthancSlicesLoader.cpp	Thu Nov 01 12:09:11 2018 +0100
+++ b/Framework/Toolbox/OrthancSlicesLoader.cpp	Mon Nov 05 10:03:14 2018 +0100
@@ -564,10 +564,9 @@
     
     NotifySliceImageSuccess(operation, image);
   }
-  
-  
-  class StringImage :
-      public Orthanc::ImageAccessor
+
+
+  class StringImage : public Orthanc::ImageAccessor
   {
   private:
     std::string  buffer_;
--- a/Framework/Viewport/CairoSurface.cpp	Thu Nov 01 12:09:11 2018 +0100
+++ b/Framework/Viewport/CairoSurface.cpp	Mon Nov 05 10:03:14 2018 +0100
@@ -107,20 +107,20 @@
   {
     Orthanc::ImageAccessor source, target;
 
-    other.GetConstAccessor(source);
-    GetAccessor(target);
+    other.GetReadOnlyAccessor(source);
+    GetWriteableAccessor(target);
 
     Orthanc::ImageProcessing::Copy(target, source);
   }
 
 
-  void CairoSurface::GetConstAccessor(Orthanc::ImageAccessor& target) const
+  void CairoSurface::GetReadOnlyAccessor(Orthanc::ImageAccessor& target) const
   {
     target.AssignReadOnly(Orthanc::PixelFormat_BGRA32, width_, height_, pitch_, buffer_);
   }
-
+  
 
-  void CairoSurface::GetAccessor(Orthanc::ImageAccessor& target)
+  void CairoSurface::GetWriteableAccessor(Orthanc::ImageAccessor& target)
   {
     target.AssignWritable(Orthanc::PixelFormat_BGRA32, width_, height_, pitch_, buffer_);
   }
--- a/Framework/Viewport/CairoSurface.h	Thu Nov 01 12:09:11 2018 +0100
+++ b/Framework/Viewport/CairoSurface.h	Mon Nov 05 10:03:14 2018 +0100
@@ -98,8 +98,8 @@
       return surface_;
     }
 
-    void GetConstAccessor(Orthanc::ImageAccessor& target) const;
+    void GetReadOnlyAccessor(Orthanc::ImageAccessor& target) const;
 
-    void GetAccessor(Orthanc::ImageAccessor& target);
+    void GetWriteableAccessor(Orthanc::ImageAccessor& target);
   };
 }
--- a/Framework/Viewport/WidgetViewport.cpp	Thu Nov 01 12:09:11 2018 +0100
+++ b/Framework/Viewport/WidgetViewport.cpp	Mon Nov 05 10:03:14 2018 +0100
@@ -107,9 +107,9 @@
     {
       return false;
     }
-    
+
     Orthanc::ImageAccessor background;
-    background_.GetAccessor(background);
+    background_.GetWriteableAccessor(background);
 
     if (backgroundChanged_ &&
         !centralWidget_->Render(background))
--- a/Framework/Volumes/ImageBuffer3D.cpp	Thu Nov 01 12:09:11 2018 +0100
+++ b/Framework/Volumes/ImageBuffer3D.cpp	Mon Nov 05 10:03:14 2018 +0100
@@ -353,18 +353,18 @@
   {
     switch (projection)
     {
-    case VolumeProjection_Axial:
-      that.GetAxialSliceAccessor(accessor_, slice, true);
-      break;
+      case VolumeProjection_Axial:
+        that.GetAxialSliceAccessor(accessor_, slice, true);
+        break;
 
-    case VolumeProjection_Coronal:
-      that.GetCoronalSliceAccessor(accessor_, slice, true);
-      break;
+      case VolumeProjection_Coronal:
+        that.GetCoronalSliceAccessor(accessor_, slice, true);
+        break;
 
-    case VolumeProjection_Sagittal:
-      sagittal_.reset(that.ExtractSagittalSlice(slice));
-      sagittal_->GetReadOnlyAccessor(accessor_);
-      break;
+      case VolumeProjection_Sagittal:
+        sagittal_.reset(that.ExtractSagittalSlice(slice));
+        sagittal_->GetReadOnlyAccessor(accessor_);
+        break;
 
     default:
       throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
@@ -397,18 +397,18 @@
   {
     switch (projection)
     {
-    case VolumeProjection_Axial:
-      that.GetAxialSliceAccessor(accessor_, slice, false);
-      break;
+      case VolumeProjection_Axial:
+        that.GetAxialSliceAccessor(accessor_, slice, false);
+        break;
 
-    case VolumeProjection_Coronal:
-      that.GetCoronalSliceAccessor(accessor_, slice, false);
-      break;
+      case VolumeProjection_Coronal:
+        that.GetCoronalSliceAccessor(accessor_, slice, false);
+        break;
 
-    case VolumeProjection_Sagittal:
-      sagittal_.reset(that.ExtractSagittalSlice(slice));
-      sagittal_->GetWriteableAccessor(accessor_);
-      break;
+      case VolumeProjection_Sagittal:
+        sagittal_.reset(that.ExtractSagittalSlice(slice));
+        sagittal_->GetWriteableAccessor(accessor_);
+        break;
 
     default:
       throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange);
--- a/Framework/Volumes/ImageBuffer3D.h	Thu Nov 01 12:09:11 2018 +0100
+++ b/Framework/Volumes/ImageBuffer3D.h	Mon Nov 05 10:03:14 2018 +0100
@@ -48,10 +48,10 @@
 
     void ExtendImageRange(const Orthanc::ImageAccessor& slice);
 
-    void  GetAxialSliceAccessor(Orthanc::ImageAccessor& target,
-                                unsigned int slice,
-                                bool readOnly) const;
-
+    void GetAxialSliceAccessor(Orthanc::ImageAccessor& target,
+                               unsigned int slice,
+                               bool readOnly) const;
+    
     void GetCoronalSliceAccessor(Orthanc::ImageAccessor& target,
                                  unsigned int slice,
                                  bool readOnly) const;
--- a/Framework/Widgets/CairoWidget.cpp	Thu Nov 01 12:09:11 2018 +0100
+++ b/Framework/Widgets/CairoWidget.cpp	Mon Nov 05 10:03:14 2018 +0100
@@ -63,9 +63,9 @@
 
       if (RenderCairo(context))
       {
-        Orthanc::ImageAccessor source;
-        surface_.GetAccessor(source);
-        Orthanc::ImageProcessing::Copy(target, source);
+        Orthanc::ImageAccessor surface;
+        surface_.GetReadOnlyAccessor(surface);
+        Orthanc::ImageProcessing::Copy(target, surface);
         return true;
       }
       else
@@ -89,7 +89,7 @@
     else
     {
       Orthanc::ImageAccessor accessor;
-      surface_.GetAccessor(accessor);
+      surface_.GetWriteableAccessor(accessor);
       Orthanc::ImageProcessing::Copy(accessor, target);
 
       CairoContext context(surface_);
--- a/Resources/CMake/SdlConfiguration.cmake	Thu Nov 01 12:09:11 2018 +0100
+++ b/Resources/CMake/SdlConfiguration.cmake	Mon Nov 05 10:03:14 2018 +0100
@@ -83,8 +83,6 @@
     file(GLOB TMP
       ${SDL_SOURCES_DIR}/src/core/linux/*.c
       ${SDL_SOURCES_DIR}/src/loadso/dlopen/*.c
-      ${SDL_SOURCES_DIR}/src/render/opengl/*.c
-      ${SDL_SOURCES_DIR}/src/render/opengles2/*.c
       ${SDL_SOURCES_DIR}/src/render/software/*.c
       ${SDL_SOURCES_DIR}/src/thread/pthread/*.c
       ${SDL_SOURCES_DIR}/src/timer/unix/*.c
@@ -100,13 +98,7 @@
       -DSDL_POWER_DISABLED=1
 
       -DSDL_VIDEO_DRIVER_X11=1
-      -DSDL_VIDEO_OPENGL=1
-      -DSDL_VIDEO_OPENGL_ES2=1
-      -DSDL_VIDEO_RENDER_OGL=1
-      -DSDL_VIDEO_RENDER_OGL_ES2=1
-      -DSDL_VIDEO_OPENGL_GLX=1
-      -DSDL_VIDEO_OPENGL_EGL=1
-      
+
       -DSDL_ASSEMBLY_ROUTINES=1
       -DSDL_THREAD_PTHREAD_RECURSIVE_MUTEX=1
       -DSDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS=1
@@ -115,6 +107,25 @@
 
     link_libraries(X11 Xext)
 
+    if (NOT CMAKE_SYSTEM_VERSION STREQUAL "Raspberry")
+      # Raspberry Pi has no support for OpenGL
+      file(GLOB TMP
+        ${SDL_SOURCES_DIR}/src/render/opengl/*.c
+        ${SDL_SOURCES_DIR}/src/render/opengles2/*.c
+        )
+
+      list(APPEND SDL_SOURCES ${TMP})
+
+      add_definitions(
+        -DSDL_VIDEO_OPENGL=1
+        -DSDL_VIDEO_OPENGL_ES2=1
+        -DSDL_VIDEO_RENDER_OGL=1
+        -DSDL_VIDEO_RENDER_OGL_ES2=1
+        -DSDL_VIDEO_OPENGL_GLX=1
+        -DSDL_VIDEO_OPENGL_EGL=1
+        )
+    endif()
+
   elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows")
     file(GLOB TMP
       ${SDL_SOURCES_DIR}/src/audio/directsound/*.c
--- a/Resources/Orthanc/DownloadOrthancFramework.cmake	Thu Nov 01 12:09:11 2018 +0100
+++ b/Resources/Orthanc/DownloadOrthancFramework.cmake	Mon Nov 05 10:03:14 2018 +0100
@@ -63,29 +63,35 @@
 
   set(ORTHANC_FRAMEWORK_MD5 "")
 
-  if (ORTHANC_FRAMEWORK_VERSION STREQUAL "mainline")
-    set(ORTHANC_FRAMEWORK_BRANCH "default")
+  if (NOT DEFINED ORTHANC_FRAMEWORK_BRANCH)
+    if (ORTHANC_FRAMEWORK_VERSION STREQUAL "mainline")
+      set(ORTHANC_FRAMEWORK_BRANCH "default")
 
-  else()
-    set(ORTHANC_FRAMEWORK_BRANCH "Orthanc-${ORTHANC_FRAMEWORK_VERSION}")
+    else()
+      set(ORTHANC_FRAMEWORK_BRANCH "Orthanc-${ORTHANC_FRAMEWORK_VERSION}")
 
-    set(RE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$")
-    string(REGEX REPLACE ${RE} "\\1" ORTHANC_FRAMEWORK_MAJOR ${ORTHANC_FRAMEWORK_VERSION})
-    string(REGEX REPLACE ${RE} "\\2" ORTHANC_FRAMEWORK_MINOR ${ORTHANC_FRAMEWORK_VERSION})
-    string(REGEX REPLACE ${RE} "\\3" ORTHANC_FRAMEWORK_REVISION ${ORTHANC_FRAMEWORK_VERSION})
+      set(RE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$")
+      string(REGEX REPLACE ${RE} "\\1" ORTHANC_FRAMEWORK_MAJOR ${ORTHANC_FRAMEWORK_VERSION})
+      string(REGEX REPLACE ${RE} "\\2" ORTHANC_FRAMEWORK_MINOR ${ORTHANC_FRAMEWORK_VERSION})
+      string(REGEX REPLACE ${RE} "\\3" ORTHANC_FRAMEWORK_REVISION ${ORTHANC_FRAMEWORK_VERSION})
 
-    if (NOT ORTHANC_FRAMEWORK_MAJOR MATCHES "^[0-9]+$" OR
-        NOT ORTHANC_FRAMEWORK_MINOR MATCHES "^[0-9]+$" OR
-        NOT ORTHANC_FRAMEWORK_REVISION MATCHES "^[0-9]+$")
-      message("Bad version of the Orthanc framework: ${ORTHANC_FRAMEWORK_VERSION}")
-    endif()
+      if (NOT ORTHANC_FRAMEWORK_MAJOR MATCHES "^[0-9]+$" OR
+          NOT ORTHANC_FRAMEWORK_MINOR MATCHES "^[0-9]+$" OR
+          NOT ORTHANC_FRAMEWORK_REVISION MATCHES "^[0-9]+$")
+        message("Bad version of the Orthanc framework: ${ORTHANC_FRAMEWORK_VERSION}")
+      endif()
 
-    if (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.3.1")
-      set(ORTHANC_FRAMEWORK_MD5 "dac95bd6cf86fb19deaf4e612961f378")
-    elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.3.2")
-      set(ORTHANC_FRAMEWORK_MD5 "d0ccdf68e855d8224331f13774992750")
-    elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.4.1")
-      set(ORTHANC_FRAMEWORK_MD5 "d41d8cd98f00b204e9800998ecf8427e")
+      if (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.3.1")
+        set(ORTHANC_FRAMEWORK_MD5 "dac95bd6cf86fb19deaf4e612961f378")
+      elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.3.2")
+        set(ORTHANC_FRAMEWORK_MD5 "d0ccdf68e855d8224331f13774992750")
+      elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.4.0")
+        set(ORTHANC_FRAMEWORK_MD5 "81e15f34d97ac32bbd7d26e85698835a")
+      elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.4.1")
+        set(ORTHANC_FRAMEWORK_MD5 "9b6f6114264b17ed421b574cd6476127")
+      elseif (ORTHANC_FRAMEWORK_VERSION STREQUAL "1.4.2")
+        set(ORTHANC_FRAMEWORK_MD5 "d1ee84927dcf668e60eb5868d24b9394")
+      endif()
     endif()
   endif()
 endif()