Medical Imaging Interaction Toolkit  2025.12.02
Medical Imaging Interaction Toolkit
mitkInteractionTestHelper.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkInteractionTestHelper_h
14 #define mitkInteractionTestHelper_h
15 
16 #include <mitkDataStorage.h>
18 #include <mitkRenderWindow.h>
19 #include <mitkXML2EventParser.h>
20 
21 #include <MitkTestingHelperExports.h>
22 
23 class vtkRenderWindow;
24 class vtkRenderer;
25 
26 namespace mitk
27 {
50  class MITKTESTINGHELPER_EXPORT InteractionTestHelper
51  {
52  public:
58  InteractionTestHelper(const std::string &interactionXmlFilePath);
59 
60  // unregisters all render windows and its renderers.
62 
65  DataStorage::Pointer GetDataStorage();
66 
71  void AddNodeToStorage(DataNode::Pointer node);
72 
77 
85  void SetTimeStep(int newTimeStep);
86 
87  typedef std::vector<RenderWindow::Pointer> RenderWindowListType;
88 
89  const RenderWindowListType &GetRenderWindowList() { return m_RenderWindowList; }
95  RenderWindow *GetRenderWindowByName(const std::string &name);
96 
103 
109  RenderWindow *GetRenderWindow(unsigned int index);
110 
117 
119 
120  protected:
125  void Initialize(const std::string &interactionXmlFilePath);
134 
135  mitk::XML2EventParser::EventContainerType m_Events; // List with loaded interaction events
136 
138 
140  DataStorage::Pointer m_DataStorage;
142 
143  };
144 }
145 
146 #endif
Creates everything needed to load and playback interaction events.
InteractionTestHelper(const std::string &interactionXmlFilePath)
InteractionTestHelper set up all neseccary objects by calling Initialize.
void AddNodeToStorage(DataNode::Pointer node)
AddNodeToStorage Add a node to the datastorage and perform a reinit which is necessary for rendering.
const RenderWindowListType & GetRenderWindowList()
void LoadInteraction()
LoadInteraction loads events from xml file.
void PlaybackInteraction()
PlaybackInteraction playback loaded interaction by passing events to the dispatcher.
DataStorage::Pointer GetDataStorage()
Returns the datastorage, in order to modify the data inside a rendering test.
DisplayActionEventBroadcast::Pointer m_DisplayActionEventBroadcast
void AddDisplayPlaneSubTree()
AddDisplayPlaneSubTree.
RenderWindow * GetRenderWindowByDefaultViewDirection(AnatomicalPlane viewDirection)
Get a renderWindow by its default view direction.
void SetTimeStep(int newTimeStep)
SetTimeStep Sets timesteps of all SliceNavigationControllers to given timestep.
void InitializeDisplayActionEventHandling()
Initialize the interaction event observer / event state machine and register it as a service.
RenderWindow * GetRenderWindow(unsigned int index)
GetRenderWindow Get renderWindow at position 'index'.
void Initialize(const std::string &interactionXmlFilePath)
Initialize Internal method to initialize the renderwindow and set the datastorage.
mitk::XML2EventParser::EventContainerType m_Events
std::vector< RenderWindow::Pointer > RenderWindowListType
RenderWindow * GetRenderWindowByName(const std::string &name)
GetRenderWindowByName Get renderWindow by the name of its renderer.
mitkRenderWindow integrates the MITK rendering mechanism into VTK and is NOT QT dependent
std::vector< mitk::InteractionEvent::Pointer > EventContainerType
Find image slices visible on a given plane.