diff --git a/Modules/Core/files.cmake b/Modules/Core/files.cmake index 7a28848686..d8412455d1 100644 --- a/Modules/Core/files.cmake +++ b/Modules/Core/files.cmake @@ -1,328 +1,329 @@ file(GLOB_RECURSE H_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/include/*") set(CPP_FILES mitkCoreActivator.cpp mitkCoreObjectFactoryBase.cpp mitkCoreObjectFactory.cpp mitkCoreServices.cpp mitkException.cpp Algorithms/mitkBaseDataSource.cpp Algorithms/mitkClippedSurfaceBoundsCalculator.cpp Algorithms/mitkCompareImageDataFilter.cpp Algorithms/mitkCompositePixelValueToString.cpp Algorithms/mitkConvert2Dto3DImageFilter.cpp Algorithms/mitkDataNodeSource.cpp Algorithms/mitkExtractSliceFilter.cpp Algorithms/mitkExtractSliceFilter2.cpp Algorithms/mitkHistogramGenerator.cpp Algorithms/mitkImageChannelSelector.cpp Algorithms/mitkImageSliceSelector.cpp Algorithms/mitkImageSource.cpp Algorithms/mitkImageTimeSelector.cpp Algorithms/mitkImageToImageFilter.cpp Algorithms/mitkImageToSurfaceFilter.cpp Algorithms/mitkMultiComponentImageDataComparisonFilter.cpp Algorithms/mitkPlaneGeometryDataToSurfaceFilter.cpp Algorithms/mitkPointSetSource.cpp Algorithms/mitkPointSetToPointSetFilter.cpp Algorithms/mitkRGBToRGBACastImageFilter.cpp Algorithms/mitkSubImageSelector.cpp Algorithms/mitkSurfaceSource.cpp Algorithms/mitkSurfaceToImageFilter.cpp Algorithms/mitkSurfaceToSurfaceFilter.cpp Algorithms/mitkUIDGenerator.cpp Algorithms/mitkVolumeCalculator.cpp Algorithms/mitkTemporalJoinImagesFilter.cpp Controllers/mitkBaseController.cpp Controllers/mitkCallbackFromGUIThread.cpp Controllers/mitkCameraController.cpp Controllers/mitkCameraRotationController.cpp Controllers/mitkCrosshairManager.cpp Controllers/mitkLimitedLinearUndo.cpp Controllers/mitkOperationEvent.cpp Controllers/mitkPlanePositionManager.cpp Controllers/mitkProgressBar.cpp Controllers/mitkRenderingManager.cpp Controllers/mitkSliceNavigationController.cpp Controllers/mitkSliceNavigationHelper.cpp Controllers/mitkStatusBar.cpp Controllers/mitkStepper.cpp Controllers/mitkTestManager.cpp + Controllers/mitkTimeNavigationController.cpp Controllers/mitkUndoController.cpp Controllers/mitkVerboseLimitedLinearUndo.cpp Controllers/mitkVtkLayerController.cpp DataManagement/mitkAnatomicalStructureColorPresets.cpp DataManagement/mitkArbitraryTimeGeometry.cpp DataManagement/mitkAbstractTransformGeometry.cpp DataManagement/mitkAnnotationProperty.cpp DataManagement/mitkApplicationCursor.cpp DataManagement/mitkApplyTransformMatrixOperation.cpp DataManagement/mitkBaseData.cpp DataManagement/mitkBaseGeometry.cpp DataManagement/mitkBaseProperty.cpp DataManagement/mitkChannelDescriptor.cpp DataManagement/mitkClippingProperty.cpp DataManagement/mitkColorProperty.cpp DataManagement/mitkCrosshairData.cpp DataManagement/mitkDataNode.cpp DataManagement/mitkDataStorage.cpp DataManagement/mitkEnumerationProperty.cpp DataManagement/mitkFloatPropertyExtension.cpp DataManagement/mitkGeometry3D.cpp DataManagement/mitkGeometryData.cpp DataManagement/mitkGeometryTransformHolder.cpp DataManagement/mitkGroupTagProperty.cpp DataManagement/mitkGenericIDRelationRule.cpp DataManagement/mitkIdentifiable.cpp DataManagement/mitkImageAccessorBase.cpp DataManagement/mitkImageCaster.cpp DataManagement/mitkImageCastPart1.cpp DataManagement/mitkImageCastPart2.cpp DataManagement/mitkImageCastPart3.cpp DataManagement/mitkImageCastPart4.cpp DataManagement/mitkImage.cpp DataManagement/mitkImageDataItem.cpp DataManagement/mitkImageDescriptor.cpp DataManagement/mitkImageReadAccessor.cpp DataManagement/mitkImageStatisticsHolder.cpp DataManagement/mitkImageVtkAccessor.cpp DataManagement/mitkImageVtkReadAccessor.cpp DataManagement/mitkImageVtkWriteAccessor.cpp DataManagement/mitkImageWriteAccessor.cpp DataManagement/mitkIntPropertyExtension.cpp DataManagement/mitkIPersistenceService.cpp DataManagement/mitkIPropertyAliases.cpp DataManagement/mitkIPropertyDescriptions.cpp DataManagement/mitkIPropertyExtensions.cpp DataManagement/mitkIPropertyFilters.cpp DataManagement/mitkIPropertyOwner.cpp DataManagement/mitkIPropertyPersistence.cpp DataManagement/mitkIPropertyProvider.cpp DataManagement/mitkLandmarkProjectorBasedCurvedGeometry.cpp DataManagement/mitkLandmarkProjector.cpp DataManagement/mitkLevelWindow.cpp DataManagement/mitkLevelWindowManager.cpp DataManagement/mitkLevelWindowPreset.cpp DataManagement/mitkLevelWindowProperty.cpp DataManagement/mitkLine.cpp DataManagement/mitkLookupTable.cpp DataManagement/mitkLookupTableProperty.cpp DataManagement/mitkLookupTables.cpp # specializations of GenericLookupTable DataManagement/mitkMaterial.cpp DataManagement/mitkMemoryUtilities.cpp DataManagement/mitkModalityProperty.cpp DataManagement/mitkModifiedLock.cpp DataManagement/mitkNodePredicateAnd.cpp DataManagement/mitkNodePredicateBase.cpp DataManagement/mitkNodePredicateCompositeBase.cpp DataManagement/mitkNodePredicateData.cpp DataManagement/mitkNodePredicateDataType.cpp DataManagement/mitkNodePredicateDataUID.cpp DataManagement/mitkNodePredicateDimension.cpp DataManagement/mitkNodePredicateFunction.cpp DataManagement/mitkNodePredicateGeometry.cpp DataManagement/mitkNodePredicateNot.cpp DataManagement/mitkNodePredicateOr.cpp DataManagement/mitkNodePredicateProperty.cpp DataManagement/mitkNodePredicateDataProperty.cpp DataManagement/mitkNodePredicateSubGeometry.cpp DataManagement/mitkNumericConstants.cpp DataManagement/mitkPlaneGeometry.cpp DataManagement/mitkPlaneGeometryData.cpp DataManagement/mitkPlaneOperation.cpp DataManagement/mitkPlaneOrientationProperty.cpp DataManagement/mitkPointOperation.cpp DataManagement/mitkPointSet.cpp DataManagement/mitkPointSetShapeProperty.cpp DataManagement/mitkProperties.cpp DataManagement/mitkPropertyAliases.cpp DataManagement/mitkPropertyDescriptions.cpp DataManagement/mitkPropertyExtension.cpp DataManagement/mitkPropertyExtensions.cpp DataManagement/mitkPropertyFilter.cpp DataManagement/mitkPropertyFilters.cpp DataManagement/mitkPropertyKeyPath.cpp DataManagement/mitkPropertyList.cpp DataManagement/mitkPropertyListReplacedObserver.cpp DataManagement/mitkPropertyNameHelper.cpp DataManagement/mitkPropertyObserver.cpp DataManagement/mitkPropertyPersistence.cpp DataManagement/mitkPropertyPersistenceInfo.cpp DataManagement/mitkPropertyRelationRuleBase.cpp DataManagement/mitkProportionalTimeGeometry.cpp DataManagement/mitkRenderingModeProperty.cpp DataManagement/mitkResliceMethodProperty.cpp DataManagement/mitkRestorePlanePositionOperation.cpp DataManagement/mitkRotationOperation.cpp DataManagement/mitkScaleOperation.cpp DataManagement/mitkSlicedData.cpp DataManagement/mitkSlicedGeometry3D.cpp DataManagement/mitkSmartPointerProperty.cpp DataManagement/mitkStandaloneDataStorage.cpp DataManagement/mitkStringProperty.cpp DataManagement/mitkSurface.cpp DataManagement/mitkSurfaceOperation.cpp DataManagement/mitkSourceImageRelationRule.cpp DataManagement/mitkThinPlateSplineCurvedGeometry.cpp DataManagement/mitkTimeGeometry.cpp DataManagement/mitkTransferFunction.cpp DataManagement/mitkTransferFunctionInitializer.cpp DataManagement/mitkTransferFunctionProperty.cpp DataManagement/mitkTemporoSpatialStringProperty.cpp DataManagement/mitkUIDManipulator.cpp DataManagement/mitkVector.cpp DataManagement/mitkVectorProperty.cpp DataManagement/mitkVtkInterpolationProperty.cpp DataManagement/mitkVtkRepresentationProperty.cpp DataManagement/mitkVtkResliceInterpolationProperty.cpp DataManagement/mitkVtkScalarModeProperty.cpp DataManagement/mitkWeakPointerProperty.cpp DataManagement/mitkIPropertyRelations.cpp DataManagement/mitkPropertyRelations.cpp Interactions/mitkAction.cpp Interactions/mitkBindDispatcherInteractor.cpp Interactions/mitkDataInteractor.cpp Interactions/mitkDispatcher.cpp Interactions/mitkDisplayActionEventBroadcast.cpp Interactions/mitkDisplayActionEventFunctions.cpp Interactions/mitkDisplayActionEventHandler.cpp Interactions/mitkDisplayActionEventHandlerDesynchronized.cpp Interactions/mitkDisplayActionEventHandlerStd.cpp Interactions/mitkDisplayActionEventHandlerSynchronized.cpp Interactions/mitkDisplayCoordinateOperation.cpp Interactions/mitkEventConfig.cpp Interactions/mitkEventFactory.cpp Interactions/mitkEventRecorder.cpp Interactions/mitkEventStateMachine.cpp Interactions/mitkInteractionEventConst.cpp Interactions/mitkInteractionEvent.cpp Interactions/mitkInteractionEventHandler.cpp Interactions/mitkInteractionEventObserver.cpp Interactions/mitkInteractionKeyEvent.cpp Interactions/mitkInteractionPositionEvent.cpp Interactions/mitkInteractionSchemeSwitcher.cpp Interactions/mitkInternalEvent.cpp Interactions/mitkMouseDoubleClickEvent.cpp Interactions/mitkMouseMoveEvent.cpp Interactions/mitkMousePressEvent.cpp Interactions/mitkMouseReleaseEvent.cpp Interactions/mitkMouseWheelEvent.cpp Interactions/mitkPointSetDataInteractor.cpp Interactions/mitkSinglePointDataInteractor.cpp Interactions/mitkStateMachineAction.cpp Interactions/mitkStateMachineCondition.cpp Interactions/mitkStateMachineContainer.cpp Interactions/mitkStateMachineState.cpp Interactions/mitkStateMachineTransition.cpp Interactions/mitkVtkEventAdapter.cpp Interactions/mitkVtkInteractorStyle.cxx Interactions/mitkXML2EventParser.cpp IO/mitkAbstractFileIO.cpp IO/mitkAbstractFileReader.cpp IO/mitkAbstractFileWriter.cpp IO/mitkCustomMimeType.cpp IO/mitkFileReader.cpp IO/mitkFileReaderRegistry.cpp IO/mitkFileReaderSelector.cpp IO/mitkFileReaderWriterBase.cpp IO/mitkFileWriter.cpp IO/mitkFileWriterRegistry.cpp IO/mitkFileWriterSelector.cpp IO/mitkGeometry3DToXML.cpp IO/mitkIFileIO.cpp IO/mitkIFileReader.cpp IO/mitkIFileWriter.cpp IO/mitkGeometryDataReaderService.cpp IO/mitkGeometryDataWriterService.cpp IO/mitkImageGenerator.cpp IO/mitkImageVtkLegacyIO.cpp IO/mitkImageVtkXmlIO.cpp IO/mitkIMimeTypeProvider.cpp IO/mitkIOConstants.cpp IO/mitkIOMimeTypes.cpp IO/mitkIOUtil.cpp IO/mitkItkImageIO.cpp IO/mitkItkLoggingAdapter.cpp IO/mitkLegacyFileReaderService.cpp IO/mitkLegacyFileWriterService.cpp IO/mitkLocaleSwitch.cpp IO/mitkLogBackend.cpp IO/mitkMimeType.cpp IO/mitkMimeTypeProvider.cpp IO/mitkOperation.cpp IO/mitkPixelType.cpp IO/mitkPointSetReaderService.cpp IO/mitkPointSetWriterService.cpp IO/mitkProportionalTimeGeometryToXML.cpp IO/mitkRawImageFileReader.cpp IO/mitkStandardFileLocations.cpp IO/mitkSurfaceStlIO.cpp IO/mitkSurfaceVtkIO.cpp IO/mitkSurfaceVtkLegacyIO.cpp IO/mitkSurfaceVtkXmlIO.cpp IO/mitkUtf8Util.cpp IO/mitkVtkLoggingAdapter.cpp IO/mitkPreferenceListReaderOptionsFunctor.cpp IO/mitkIOMetaInformationPropertyConstants.cpp IO/mitkIPreferences.cpp IO/mitkPreferences.cpp IO/mitkIPreferencesService.cpp IO/mitkPreferencesService.cpp IO/mitkIPreferencesStorage.cpp IO/mitkXMLPreferencesStorage.cpp Rendering/mitkAbstractAnnotationRenderer.cpp Rendering/mitkAnnotationUtils.cpp Rendering/mitkBaseRenderer.cpp Rendering/mitkBaseRendererHelper.cpp Rendering/mitkCrosshairVtkMapper2D.cpp Rendering/mitkGradientBackground.cpp Rendering/mitkImageVtkMapper2D.cpp Rendering/mitkMapper.cpp Rendering/mitkAnnotation.cpp Rendering/mitkPlaneGeometryDataMapper2D.cpp Rendering/mitkPlaneGeometryDataVtkMapper3D.cpp Rendering/mitkPointSetVtkMapper2D.cpp Rendering/mitkPointSetVtkMapper3D.cpp Rendering/mitkRenderWindowBase.cpp Rendering/mitkRenderWindow.cpp Rendering/mitkRenderWindowFrame.cpp Rendering/mitkSurfaceVtkMapper2D.cpp Rendering/mitkSurfaceVtkMapper3D.cpp Rendering/mitkVideoRecorder.cpp Rendering/mitkVtkEventProvider.cpp Rendering/mitkVtkMapper.cpp Rendering/mitkVtkPropRenderer.cpp Rendering/mitkVtkWidgetRendering.cpp Rendering/vtkMitkLevelWindowFilter.cpp Rendering/vtkMitkRectangleProp.cpp Rendering/vtkMitkRenderProp.cpp Rendering/vtkMitkThickSlicesFilter.cpp Rendering/vtkNeverTranslucentTexture.cpp ) set(RESOURCE_FILES Interactions/globalConfig.xml Interactions/DisplayInteraction.xml Interactions/DisplayConfigMITKBase.xml Interactions/DisplayConfigPACSBase.xml Interactions/DisplayConfigCrosshair.xml Interactions/DisplayConfigRotation.xml Interactions/DisplayConfigActivateCoupling.xml Interactions/DisplayConfigSwivel.xml Interactions/DisplayConfigPACSPan.xml Interactions/DisplayConfigPACSScroll.xml Interactions/DisplayConfigPACSZoom.xml Interactions/DisplayConfigPACSLevelWindow.xml Interactions/DisplayConfigBlockLMB.xml Interactions/PointSet.xml Interactions/PointSetConfig.xml mitkLevelWindowPresets.xml mitkAnatomicalStructureColorPresets.xml ) diff --git a/Modules/Core/include/mitkTimeNavigationController.h b/Modules/Core/include/mitkTimeNavigationController.h new file mode 100644 index 0000000000..69d81ccd18 --- /dev/null +++ b/Modules/Core/include/mitkTimeNavigationController.h @@ -0,0 +1,172 @@ +/*============================================================================ + +The Medical Imaging Interaction Toolkit (MITK) + +Copyright (c) German Cancer Research Center (DKFZ) +All rights reserved. + +Use of this source code is governed by a 3-clause BSD license that can be +found in the LICENSE file. + +============================================================================*/ + +#ifndef TimeNavigationController_h +#define TimeNavigationController_h + +#include + +#include +#include + +#include + +namespace mitk +{ + /** + * \brief Controls the time-related properties of the time stepper, according to the + * given input world time geomtry. + * + * A TimeNavigationController takes a TimeGeometry as input world time geometry + * and sets the properties of the associated stepper (BaseController). + * The time-related properties are: + * - steps: the number of input time steps + * - pos: the current time step / position of the stepper + * - range: the time bounds for the slider (minimum, maximum) + * + * The timestep controls the selection of a specific time point from the TimeGeometry. + * The TimeNavigationController generates ITK events to tell observers, + * like a BaseRenderer, when the selected timestep changes. + * + * Example: + * \code + * // Initialize the time navigation controller. + * timeCtrl = mitk::TimeNavigationController::New(); + * + * // Set the required input world time geomtry (a TimeGeometry::ConstPointer). + * timeCtrl->SetInputWorldTimeGeometry(geometry.GetPointer()); + * + * // Set the time-related properties and send the information to the connected renderer(s). + * timeCtrl->Update(); + * \endcode + * + * Vvisible navigation widgets can be connected to a TimeNavigationController, e.g., a + * QmitkSliceNavigationWidget (for Qt): + * + * \code + * // Create the visible navigation widget (a slider with a spin-box). + * QmitkSliceNavigationWidget* navigationWidget = new QmitkSliceNavigationWidget(parent); + * + * // Connect the navigation widget to the time-stepper of the + * // TimeNavigationController. For initialization (timestep, minimal and + * // maximal values) the values of the TimeNavigationController are used. + * // Thus, accessing methods of a navigation widget is normally not necessary, + * // since everything can be set via the (Qt-independent) TimeNavigationController. + * // The QmitkStepperAdapter converts the Qt-signals to Qt-independent + * // itk-events. + * new QmitkStepperAdapter(navigationWidget, timeCtrl->GetSlice()); + * \endcode + */ + class MITKCORE_EXPORT TimeNavigationController : public BaseController + { + public: + + mitkClassMacro(TimeNavigationController, BaseController); + itkNewMacro(Self); + + /** + * \brief Set the input time geometry out of which the + * time-related properties will be generated. + * + * Any previous set input geometry (3D or Time) will + * be ignored in the future. + */ + void SetInputWorldTimeGeometry(const TimeGeometry* geometry); + itkGetConstObjectMacro(InputWorldTimeGeometry, mitk::TimeGeometry); + + /** + * \brief Do the actual time-related properties extraction + and send the currently selected time step to the connecte + observers (renderers). + */ + virtual void Update(); + + /** + * \brief Send the currently selected time step to the connected + * observers (renderers). + * + * Called by Update(). + */ + virtual void SendTime(); + + class MITKCORE_EXPORT TimeEvent : public itk::AnyEvent + { + public: + + typedef TimeEvent Self; + typedef itk::AnyEvent Superclass; + + TimeEvent(TimeStepType timeStep) : m_TimeStep(timeStep) {} + ~TimeEvent() override {} + const char *GetEventName() const override { return "TimeEvent"; } + bool CheckEvent(const ::itk::EventObject *e) const override { return dynamic_cast(e); } + ::itk::EventObject *MakeObject() const override { return new Self(m_TimeStep); } + TimeStepType GetTimeStep() const { return m_TimeStep; } + private: + + TimeStepType m_TimeStep; + void operator=(const Self &); + }; + + template + void ConnectTimeEvent(T* receiver) + { + typedef typename itk::ReceptorMemberCommand::Pointer ReceptorMemberCommandPointer; + ReceptorMemberCommandPointer eventReceptorCommand = itk::ReceptorMemberCommand::New(); + eventReceptorCommand->SetCallbackFunction(receiver, &T::SetGeometryTime); + unsigned long tag = AddObserver(TimeEvent(0), eventReceptorCommand); + m_ReceiverToObserverTagsMap[static_cast(receiver)].push_back(tag); + } + + // use a templated method to get the right offset when casting to void* + template + void Disconnect(T* receiver) + { + auto i = m_ReceiverToObserverTagsMap.find(static_cast(receiver)); + if (i == m_ReceiverToObserverTagsMap.end()) + return; + const std::list& tags = i->second; + for (auto tagIter = tags.begin(); tagIter != tags.end(); ++tagIter) + { + RemoveObserver(*tagIter); + } + m_ReceiverToObserverTagsMap.erase(i); + } + + /** + * \brief Convenience method that returns the time step currently selected by the controller. + */ + TimeStepType GetSelectedTimeStep() const; + + /** + * \brief Convenience method that returns the time point that corresponds to the selected + * time step. The conversion is done using the time geometry of the controller. + * If the time geometry is not yet set, this function will always return 0.0. + */ + TimePointType GetSelectedTimePoint() const; + + protected: + + TimeNavigationController(); + ~TimeNavigationController() override; + + TimeGeometry::ConstPointer m_InputWorldTimeGeometry; + + bool m_BlockUpdate; + + typedef std::map> ObserverTagsMapType; + ObserverTagsMapType m_ReceiverToObserverTagsMap; + }; + +} // namespace mitk + +#endif diff --git a/Modules/Core/src/Controllers/mitkTimeNavigationController.cpp b/Modules/Core/src/Controllers/mitkTimeNavigationController.cpp new file mode 100644 index 0000000000..30189059e3 --- /dev/null +++ b/Modules/Core/src/Controllers/mitkTimeNavigationController.cpp @@ -0,0 +1,129 @@ +/*============================================================================ + +The Medical Imaging Interaction Toolkit (MITK) + +Copyright (c) German Cancer Research Center (DKFZ) +All rights reserved. + +Use of this source code is governed by a 3-clause BSD license that can be +found in the LICENSE file. + +============================================================================*/ + +#include + +#include +#include + + mitk::TimeNavigationController::TimeNavigationController() + : BaseController() + , m_InputWorldTimeGeometry(mitk::TimeGeometry::ConstPointer()) + , m_BlockUpdate(false) +{ + typedef itk::SimpleMemberCommand SNCCommandType; + SNCCommandType::Pointer timeStepperChangedCommand; + + timeStepperChangedCommand = SNCCommandType::New(); + timeStepperChangedCommand->SetCallbackFunction(this, &TimeNavigationController::SendTime); + m_Time->AddObserver(itk::ModifiedEvent(), timeStepperChangedCommand); + m_Time->SetUnitName("ms"); +} + +mitk::TimeNavigationController::~TimeNavigationController() {} + +void mitk::TimeNavigationController::SetInputWorldTimeGeometry(const TimeGeometry* geometry) +{ + if (geometry != nullptr) + { + if (geometry->GetBoundingBoxInWorld()->GetDiagonalLength2() < eps) + { + itkWarningMacro("setting an empty bounding-box"); + geometry = nullptr; + } + } + if (m_InputWorldTimeGeometry != geometry) + { + m_InputWorldTimeGeometry = geometry; + this->Modified(); + } +} + +void mitk::TimeNavigationController::Update() +{ + if (m_BlockUpdate) + { + return; + } + + if (m_InputWorldTimeGeometry.IsNull()) + { + return; + } + + if (0 == m_InputWorldTimeGeometry->CountTimeSteps()) + { + return; + } + + m_BlockUpdate = true; + + if (m_LastUpdateTime < m_InputWorldTimeGeometry->GetMTime()) + { + Modified(); + } + + if (m_LastUpdateTime < GetMTime()) + { + m_LastUpdateTime = GetMTime(); + + TimeStepType inputTimeSteps = m_InputWorldTimeGeometry->CountTimeSteps(); + const TimeBounds &timeBounds = m_InputWorldTimeGeometry->GetTimeBounds(); + m_Time->SetSteps(inputTimeSteps); + m_Time->SetPos(0); + m_Time->SetRange(timeBounds[0], timeBounds[1]); + } + + // unblock update; we may do this now, because if m_BlockUpdate was already + // true before this method was entered, then we will never come here. + m_BlockUpdate = false; + + // Send the time. Do this even if nothing was changed, because maybe + // Update() was only called to re-send the old time data. + this->SendTime(); +} + +void mitk::TimeNavigationController::SendTime() +{ + if (!m_BlockUpdate) + { + if (m_InputWorldTimeGeometry.IsNotNull()) + { + this->InvokeEvent(TimeEvent(m_Time->GetPos())); + RenderingManager::GetInstance()->RequestUpdateAll(); + } + } +} + +mitk::TimeStepType mitk::TimeNavigationController::GetSelectedTimeStep() const +{ + return this->GetTime()->GetPos(); +} + +mitk::TimePointType mitk::TimeNavigationController::GetSelectedTimePoint() const +{ + const auto timeStep = this->GetSelectedTimeStep(); + + if (m_InputWorldTimeGeometry.IsNull()) + { + return 0.0; + } + + if (!m_InputWorldTimeGeometry->IsValidTimeStep(timeStep)) + { + mitkThrow() << "SliceNavigationController is in an invalid state. It has a time step" + << "selected that is not covered by its time geometry. Selected time step: " << timeStep + << "; TimeGeometry steps count: " << m_InputWorldTimeGeometry->CountTimeSteps(); + } + + return m_InputWorldTimeGeometry->TimeStepToTimePoint(timeStep); +}