Page MenuHomePhabricator

RT Struct visualization crashes
Closed, ResolvedPublic

Description

OS: Windows

Loading an RT Struct (drag'n'drop) leads to a crach in the contour model mapper. So we cannot view RT structs. (In the release everything worked fine).

I assume it may be correlated to the switch to openGL 2 backend; but I cannot be sure.

Event Timeline

floca added a project: Restricted Project.Oct 6 2017, 1:32 PM

A mr guidance data set. Weren't you able to reproduce it?

I'm able to reproduce it with MITK testdata (RT/StructureSet/RS.dcm).
The RTStructureSetReaderServiceTest runs fine, however. So reading the data sets isn't the problem.

No it is definitly the rendering, as written in the task description. I tracked it down into an (i think) null ptr exception in the renderer.

hentsch added a parent task: Restricted Maniphest Task.Oct 10 2017, 4:16 PM

I tested loading the MITK-data RT/StructureSet/RS.dcm with the dicom plugin

  1. with the two week old master (8a945164c978aa3f37d8b9b0c8a3993055448a12) and
  2. an two-month old version (86900f283f0955fb2c2d16c01cb3feb982756d0d)

Result:

  1. crashed
  2. worked

Then I tested loading directly via drag-n-drop

  1. crashed
  2. worked

It happens here. GetPen() returns a null pointer. However just checking for it and aborting results in 2D contours no longer being rendered.

To fix the crash and make sure that GetPen() has a chance of returning anything but a null pointer

diff --git a/Modules/ContourModel/Rendering/mitkContourModelGLMapper2DBase.cpp b/Modules/ContourModel/Rendering/mitkContourModelGLMapper2DBase.cpp
index df2fc88..5342b1c 100644
--- a/Modules/ContourModel/Rendering/mitkContourModelGLMapper2DBase.cpp
+++ b/Modules/ContourModel/Rendering/mitkContourModelGLMapper2DBase.cpp
@@ -64,6 +64,10 @@ void mitk::ContourModelGLMapper2DBase::ApplyColorAndOpacityProperties(mitk::Base
   // check for opacity prop and use it for rendering if it exists
   GetDataNode()->GetOpacity(rgba[3], renderer, "opacity");

+  if (this->m_Context->GetPen() == nullptr)
+  {
+    return;
+  }
   this->m_Context->GetPen()->SetColorF((double)rgba[0], (double)rgba[1], (double)rgba[2], (double)rgba[3]);
 }

diff --git a/Modules/ContourModel/Rendering/mitkContourModelSetGLMapper2D.cpp b/Modules/ContourModel/Rendering/mitkContourModelSetGLMapper2D.cpp
index b512906..1f825c4 100644
--- a/Modules/ContourModel/Rendering/mitkContourModelSetGLMapper2D.cpp
+++ b/Modules/ContourModel/Rendering/mitkContourModelSetGLMapper2D.cpp
@@ -78,6 +78,10 @@ void mitk::ContourModelSetGLMapper2D::InternalDrawContour(mitk::ContourModel *re
 {
   if (!renderingContour)
     return;
+  if (!this->m_Initialized)
+  {
+    this->Initialize(renderer);
+  }

   mitk::DataNode::Pointer dataNode = this->GetDataNode();

However this will still result in the contours not being drawn with the following console error messages:

core.mod.core.loggingadapter ERROR: ERROR: In ep\src\VTK\Rendering\OpenGL2\vtkTextureObject.cxx, line 548
vtkTextureObject (0000005401D08A10): failed at glBindTexture 1 OpenGL errors detected
  0 : (1282) Invalid operation
goch moved this task from Restricted Project Column to Restricted Project Column on the Restricted Project board.Oct 17 2017, 1:52 PM

@hentsch can you verify the visualization is now as it should be?

the visualization of RT struct does not work as it should (and not as smoothly), but this is not due to the changes.

goch moved this task from Restricted Project Column to Restricted Project Column on the Restricted Project board.