Page MenuHomePhabricator

[Segmentation] Crash if new segmentation is created with timestep different than 0
Closed, ResolvedPublic

Description

Reproduce:

  • Load US4DCyl from MITK Data
  • Change timestep
  • Create new Segmentation
  • Choose static = Crash!

Event Timeline

thomass created this task.
thomass updated the task description. (Show Details)
  1. Works for timestep 0
  2. Independent from segmentation tool so might be a problem of the selection concept not the segmentation

mitk::ProportionalTimeGeometry::GetGeometryForTimeStep returns nullptr during
mitk::Vector3D spacing = workingNode->GetData()->GetGeometry(time_position)->GetSpacing() inside QmitkSlicesInterpolator::SetCurrentContourListID().
Obviously because IsValidTimeStep(timeStep)) for e.g. timestep = 2 is false.

A static mask is generated in QmitkSegmentationView::CreateNewSegmentation() with

const auto refTimeGeometry = image->GetTimeGeometry();
auto newTimeGeometry = mitk::ProportionalTimeGeometry::New();
newTimeGeometry->SetFirstTimePoint(refTimeGeometry->GetMinimumTimePoint());
newTimeGeometry->SetStepDuration(refTimeGeometry->GetMaximumTimePoint() - refTimeGeometry->GetMinimumTimePoint());

mitk::Image::Pointer newImage = selector->GetOutput();
newTimeGeometry->SetTimeStepGeometry(image->GetGeometry(), 0);
newImage->SetTimeGeometry(newTimeGeometry);

So a static mask contains only a single timestep with duration 4ms in this case. It is not possible to select timestep = 2.

We could add a check in QmitkSlicesInterpolator::SetCurrentContourListID()

before / inside

// In case the time is not valid use 0 to access the time geometry of the working node
unsigned int time_position = 0;
if (m_LastSNC->GetTime() != nullptr)
  time_position = m_LastSNC->GetTime()->GetPos();

to either always use time_position = 0 or to check for 4D-data.

floca added a subscriber: floca.

Please check if problem still persists as soon as T27490 is merged into develop or directly with D329 (is open for review by the way ;)

Seems to be resolved because D329 changed

// In case the time is not valid use 0 to access the time geometry of the working node
unsigned int time_position = 0;
if (m_LastSNC->GetTime() != nullptr)
  time_position = m_LastSNC->GetTime()->GetPos();

to

const auto timePoint = m_LastSNC->GetSelectedTimePoint();
// In case the time is not valid use 0 to access the time geometry of the working node
unsigned int time_position = 0;
if (!workingNode->GetData()->GetTimeGeometry()->IsValidTimePoint(timePoint))
{
  MITK_WARN << "Cannot accept interpolation. Time point selected by SliceNavigationController is not within the time bounds of WorkingImage. Time point: " << timePoint;
}
time_position = workingNode->GetData()->GetTimeGeometry()->TimePointToTimeStep(timePoint);

Needs to be verified when D329 has been landed and merged.

floca added a project: Restricted Project.Jul 1 2020, 4:33 PM

As D329 is now landed. I think this is an low hanging fruit to check if the problem still exists ;)

kalali claimed this task.
kalali removed projects: Restricted Project, Missing Info.