Page MenuHomePhabricator

Running tutorial's Step8 gives Segmentation Fault!
Closed, ResolvedPublic

Description

MITK version: 2018.04.99
OS: Ubuntu 18.04

I'm new to MITK, I'm running the codes from tutorial to learn. I have compiled the tutorial Step8 with the default cmake files and with a custom cmake, both binaries gave the segmentation fault message when executed.

Using Qt Creator's debugger I found the segmentation fault occurs at line 62 in Step8.cpp. Here's the code line:

multiWidget->GetRenderWindow4()->GetRenderer()->SetMapperID(mitk::BaseRenderer::Standard3D);

Before going deeper in my investigation I'd like to know if someone is able to reproduce this issue.

Event Timeline

Oshio created this task.May 11 2020, 10:38 AM
Oshio edited projects, added MITK (2018-04); removed MITK.May 11 2020, 7:53 PM
kalali claimed this task.Jun 16 2020, 1:23 PM
kalali triaged this task as High priority.
kalali added a subscriber: kalali.

I can reproduce the error. There was a change in the StdMultiWidget so we have to adapt the tutorial. A specific initialization-method was added, so we need to call InitializeMultiWidget before accessing the render windows (which does some things for us so we can remove some lines from the tutorial).
The level window slider was removed from the StdMultiWidget and needs to be added additionally.

I committed the changes and modified the tutorial description. I would be happy if you can review the changes and see if everything works now. You can check {D320} and download a Raw Diff to be add the changes to your code base by using git apply D320.

kalali closed this task as Resolved.Jun 19 2020, 2:58 PM

I fixed the tutorial accordingly and close this task as resolved. If you still have problems, don't hesitate to reopen this task.

Oshio added a comment.Jun 20 2020, 6:12 AM

@kalali Your solution solved the problem. I'd like to point out that SetWidgetPlanesVisibility(true) is already called somewhere inside InitializeMultiWidget(), so just AddPlanesToDataStorage()is enough for rendering the planes.

Not related to this issue:
A couple of weeks ago I sent to the mail list an email with the title QmitkRenderWindowWidget design flaw: Setting datastorage globally. I'm developing an application with various rendering windows for displaying different datasets, but when running, all of them displayed the same data.

I actually changed the source code to solve this issue without touching API's interface, if you are curious here is the link to the modified files:
https://github.com/Oshio09/covid-gui/tree/master/source-code-modifications

Thank you for your response and for pointing out the redundancy, I will fix this next week.

Your user list email is still on my todo list, I will take care of this next week and look at your suggestion. Thank you for your help!

kalali added a comment.EditedJun 30 2020, 9:41 AM

@kalali Your solution solved the problem. I'd like to point out that SetWidgetPlanesVisibility(true) is already called somewhere inside InitializeMultiWidget(), so just AddPlanesToDataStorage()is enough for rendering the planes.

I couldn't find a call to SetWidgetPlanesVisibility(true) but the widget planes are set to visible on creation, so you're right, we can remove that specific call (see {D336}).

Oshio added a comment.Jun 30 2020, 8:31 PM

A couple of days after writing that, I found the code that is setting the initial state to visible.

Inside

void QmitkStdMultiWidget::AddDisplayPlaneSubTree()

We have the line:

m_PlaneNode1->SetProperty("visible", mitk::BoolProperty::New(true));

Changing it to false will require SetWidgetPlanesVisibility(true) to be called in order to show the axial plane.