Medical Imaging Interaction Toolkit  2021.10.99-1c4db16f
Medical Imaging Interaction Toolkit
mitk::InteractionTestHelper Class Reference

Creates everything needed to load and playback interaction events. More...

#include <mitkInteractionTestHelper.h>

Collaboration diagram for mitk::InteractionTestHelper:

Public Types

typedef std::vector< RenderWindow::PointerRenderWindowListType
 

Public Member Functions

 InteractionTestHelper (const std::string &interactionXmlFilePath)
 InteractionTestHelper set up all neseccary objects by calling Initialize. More...
 
virtual ~InteractionTestHelper ()
 
DataStorage::Pointer GetDataStorage ()
 Returns the datastorage, in order to modify the data inside a rendering test. More...
 
void AddNodeToStorage (DataNode::Pointer node)
 AddNodeToStorage Add a node to the datastorage and perform a reinit which is necessary for rendering. More...
 
void PlaybackInteraction ()
 PlaybackInteraction playback loaded interaction by passing events to the dispatcher. More...
 
void SetTimeStep (int newTimeStep)
 SetTimeStep Sets timesteps of all SliceNavigationControllers to given timestep. More...
 
const RenderWindowListTypeGetRenderWindowList ()
 
RenderWindowGetRenderWindowByName (const std::string &name)
 GetRenderWindowByName Get renderWindow by the name of its renderer. More...
 
RenderWindowGetRenderWindowByDefaultViewDirection (SliceNavigationController::ViewDirection viewDirection)
 GetRenderWindowByDefaultViewDirection Get a renderWindow by its default viewdirection. More...
 
RenderWindowGetRenderWindow (unsigned int index)
 GetRenderWindow Get renderWindow at position 'index'. More...
 
void AddDisplayPlaneSubTree ()
 AddDisplayPlaneSubTree. More...
 
void Set3dCameraSettings ()
 

Protected Member Functions

void Initialize (const std::string &interactionXmlFilePath)
 Initialize Internal method to initialize the renderwindow and set the datastorage. More...
 
void InitializeDisplayActionEventHandling ()
 Initialize the interaction event observer / event state machine and register it as a service. More...
 
void LoadInteraction ()
 LoadInteraction loads events from xml file. More...
 

Protected Attributes

mitk::XML2EventParser::EventContainerType m_Events
 
std::string m_InteractionFilePath
 
RenderWindowListType m_RenderWindowList
 
DataStorage::Pointer m_DataStorage
 
DisplayActionEventBroadcast::Pointer m_DisplayActionEventBroadcast
 

Detailed Description

Creates everything needed to load and playback interaction events.

The interaction is loaded from an xml file and the events are created. This file is usually a recorded user interaction with the GUI. This can be done with InteractionEventRecorder plugin. Also all necessary objects to handle interaction events are generated. The user of this class is responsible to add the data object to interact with to the data storage of InteractionTestHelper. And must also make sure that a proper data interactor is associated with the data object.

To test a PointSet interaction for instance make sure you have a PointSet node and a PointSetDataInteractor. Then just add the node to the storage of the your InteractionTestHelper by calling InteractionTestHelper::AddNodeToStorage. Use InteractionTestHelper::PlaybackInteraction to execute. The result can afterwards be compared to a reference object.

Make sure to destroy the test helper instance after each test, since all render windows and its renderers have to be unregistered.

See also
XML2EventParser
EventFactory
EventRecorder

Definition at line 50 of file mitkInteractionTestHelper.h.

Member Typedef Documentation

◆ RenderWindowListType

Constructor & Destructor Documentation

◆ InteractionTestHelper()

mitk::InteractionTestHelper::InteractionTestHelper ( const std::string &  interactionXmlFilePath)

InteractionTestHelper set up all neseccary objects by calling Initialize.

Parameters
interactionXmlFilePathpath to xml file containing events and configuration information for the render windows.

◆ ~InteractionTestHelper()

virtual mitk::InteractionTestHelper::~InteractionTestHelper ( )
virtual

Member Function Documentation

◆ AddDisplayPlaneSubTree()

void mitk::InteractionTestHelper::AddDisplayPlaneSubTree ( )

AddDisplayPlaneSubTree.

Creates DisplayPlanes that are shown in a 3D RenderWindow.

◆ AddNodeToStorage()

void mitk::InteractionTestHelper::AddNodeToStorage ( DataNode::Pointer  node)

AddNodeToStorage Add a node to the datastorage and perform a reinit which is necessary for rendering.

Parameters
nodeThe data you want to add.

◆ GetDataStorage()

DataStorage::Pointer mitk::InteractionTestHelper::GetDataStorage ( )

Returns the datastorage, in order to modify the data inside a rendering test.

◆ GetRenderWindow()

RenderWindow* mitk::InteractionTestHelper::GetRenderWindow ( unsigned int  index)

GetRenderWindow Get renderWindow at position 'index'.

Parameters
indexPosition within the renderWindow list.
Returns
nullptr if index is out of bounds.

◆ GetRenderWindowByDefaultViewDirection()

RenderWindow* mitk::InteractionTestHelper::GetRenderWindowByDefaultViewDirection ( SliceNavigationController::ViewDirection  viewDirection)

GetRenderWindowByDefaultViewDirection Get a renderWindow by its default viewdirection.

Parameters
viewDirection
Returns
nullptr if not found.

◆ GetRenderWindowByName()

RenderWindow* mitk::InteractionTestHelper::GetRenderWindowByName ( const std::string &  name)

GetRenderWindowByName Get renderWindow by the name of its renderer.

Parameters
nameThe name of the renderer of the desired renderWindow.
Returns
nullptr if not found.

◆ GetRenderWindowList()

const RenderWindowListType& mitk::InteractionTestHelper::GetRenderWindowList ( )
inline

Definition at line 89 of file mitkInteractionTestHelper.h.

◆ Initialize()

void mitk::InteractionTestHelper::Initialize ( const std::string &  interactionXmlFilePath)
protected

Initialize Internal method to initialize the renderwindow and set the datastorage.

Exceptions
mitk::Exceptionif interaction xml file can not be loaded.

◆ InitializeDisplayActionEventHandling()

void mitk::InteractionTestHelper::InitializeDisplayActionEventHandling ( )
protected

Initialize the interaction event observer / event state machine and register it as a service.

◆ LoadInteraction()

void mitk::InteractionTestHelper::LoadInteraction ( )
protected

LoadInteraction loads events from xml file.

◆ PlaybackInteraction()

void mitk::InteractionTestHelper::PlaybackInteraction ( )

PlaybackInteraction playback loaded interaction by passing events to the dispatcher.

◆ Set3dCameraSettings()

void mitk::InteractionTestHelper::Set3dCameraSettings ( )

◆ SetTimeStep()

void mitk::InteractionTestHelper::SetTimeStep ( int  newTimeStep)

SetTimeStep Sets timesteps of all SliceNavigationControllers to given timestep.

Parameters
newTimeStepnew timestep

Does the same as using ImageNavigators Time slider. Use this if your data was modified in a timestep other than 0.

Member Data Documentation

◆ m_DataStorage

DataStorage::Pointer mitk::InteractionTestHelper::m_DataStorage
protected

Definition at line 140 of file mitkInteractionTestHelper.h.

◆ m_DisplayActionEventBroadcast

DisplayActionEventBroadcast::Pointer mitk::InteractionTestHelper::m_DisplayActionEventBroadcast
protected

Definition at line 141 of file mitkInteractionTestHelper.h.

◆ m_Events

mitk::XML2EventParser::EventContainerType mitk::InteractionTestHelper::m_Events
protected

Definition at line 135 of file mitkInteractionTestHelper.h.

◆ m_InteractionFilePath

std::string mitk::InteractionTestHelper::m_InteractionFilePath
protected

Definition at line 137 of file mitkInteractionTestHelper.h.

◆ m_RenderWindowList

RenderWindowListType mitk::InteractionTestHelper::m_RenderWindowList
protected

Definition at line 139 of file mitkInteractionTestHelper.h.


The documentation for this class was generated from the following file: