Page MenuHomePhabricator

Correct handling of time points selected by SliceNavigator
Closed, ResolvedPublic

Description

Currently we have a lot of code that does something like:

unsigned int timestep = mitk::RenderingManager::GetInstance()->GetTimeNavigationController()->GetTime()->GetPos();
auto geometry = someImage->GetGeometry(timestep);
//use the geometry

This is in most cases wrong and often can lead to crashes or undefined states. Reason: the time step of the world geometry must be first converted into a time point and then mapped into the appropriated time step of the image time geometry. (This is analogous to the mapping between indeces and points over the worldgeometry to adress right pixels in images).

This must be checked in our code base and some T27476 are i.a. caused by that problem.

As a preperation to rework the faulty usage, we should introduce an easier way to do it correctly.
I would propose to

  1. extend the interface of SliceNavigationController to offer a methods to directly query the current selected time point / time step
  2. extend the IRenderWindowPart (which offers allready a GetSelectedPosition()) to offer a GetSelectedTimePoint(). And use the new functions of SliceNavigtionController.

Then we can correct wrong usage in such a way

auto timepoint = mitk::RenderingManager::GetInstance()->GetSelectedTimePoint();

if(someImage->GetTimeGeometry()->IsValidTimePoint(timepoint))
{
  auto timeStep = someImage->GetTimeGeometry()->TimePointToTimeStep(timepoint)
  auto geometry = someImage->GetGeometry(timestep);
  //use the geometry
}
else //do what ever you do if the timepoint is not supported

Revisions and Commits

rMITK MITK
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision
Restricted Differential Revision

Event Timeline

kislinsk added a revision: Restricted Differential Revision.Jun 22 2020, 1:40 PM