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
- extend the interface of SliceNavigationController to offer a methods to directly query the current selected time point / time step
- 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