Medical Imaging Interaction Toolkit  2016.11.0
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< mitk::RenderWindow::PointerRenderWindowListType
 

Public Member Functions

 InteractionTestHelper (const std::string &interactionXmlFilePath)
 InteractionTestHelper set up all neseccary objects by calling Initialize. More...
 
virtual ~InteractionTestHelper ()
 
mitk::DataStorage::Pointer GetDataStorage ()
 Returns the datastorage, in order to modify the data inside a rendering test. More...
 
void AddNodeToStorage (mitk::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 (mitk::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 LoadInteraction ()
 LoadInteraction loads events from xml file. More...
 

Protected Attributes

mitk::XML2EventParser::EventContainerType m_Events
 
std::string m_InteractionFilePath
 
RenderWindowListType m_RenderWindowList
 
mitk::DataStorage::Pointer m_DataStorage
 
mitk::MouseModeSwitcher::Pointer m_MouseModeSwitcher
 

Detailed Description

Creates everything needed to load and playback interaction events.

The interaction is loaded from an xml file and the event 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 55 of file mitkInteractionTestHelper.h.

Member Typedef Documentation

Constructor & Destructor Documentation

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.

Definition at line 33 of file mitkInteractionTestHelper.cpp.

References Initialize().

Member Function Documentation

void mitk::InteractionTestHelper::AddDisplayPlaneSubTree ( )
void mitk::InteractionTestHelper::AddNodeToStorage ( mitk::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.

Definition at line 207 of file mitkInteractionTestHelper.cpp.

References m_DataStorage.

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

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

Definition at line 202 of file mitkInteractionTestHelper.cpp.

References m_DataStorage.

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

GetRenderWindow Get renderWindow at position 'index'.

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

Definition at line 307 of file mitkInteractionTestHelper.cpp.

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

GetRenderWindowByDefaultViewDirection Get a renderWindow by its default viewdirection.

Parameters
viewDirection
Returns
NULL if not found.

Definition at line 292 of file mitkInteractionTestHelper.cpp.

mitk::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
NULL if not found.

Definition at line 278 of file mitkInteractionTestHelper.cpp.

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

Definition at line 94 of file mitkInteractionTestHelper.h.

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.

Definition at line 39 of file mitkInteractionTestHelper.cpp.

References AddDisplayPlaneSubTree(), mitk::SliceNavigationController::Axial, mitk::SliceNavigationController::ConnectGeometryTimeEvent(), mitk::RenderingManager::GetInstance(), mitk::RenderingManager::GetTimeNavigationController(), m_DataStorage, mitkThrow, mitk::RenderWindow::New(), mitk::StandaloneDataStorage::New(), mitk::MouseModeSwitcher::New(), mitk::BaseRenderer::Standard2D, mitk::BaseRenderer::Standard3D, mitk::InteractionEventConst::xmlCameraFocalPointX(), mitk::InteractionEventConst::xmlCameraFocalPointY(), mitk::InteractionEventConst::xmlCameraFocalPointZ(), mitk::InteractionEventConst::xmlCameraPositionX(), mitk::InteractionEventConst::xmlCameraPositionY(), mitk::InteractionEventConst::xmlCameraPositionZ(), mitk::InteractionEventConst::xmlEventPropertyMapperID(), mitk::InteractionEventConst::xmlEventPropertyRendererName(), mitk::InteractionEventConst::xmlEventPropertyViewDirection(), mitk::InteractionEventConst::xmlRenderSizeX(), mitk::InteractionEventConst::xmlRenderSizeY(), mitk::InteractionEventConst::xmlRenderSizeZ(), mitk::InteractionEventConst::xmlTagConfigRoot(), mitk::InteractionEventConst::xmlTagInteractions(), mitk::InteractionEventConst::xmlTagRenderer(), mitk::InteractionEventConst::xmlViewUpX(), mitk::InteractionEventConst::xmlViewUpY(), and mitk::InteractionEventConst::xmlViewUpZ().

Referenced by InteractionTestHelper().

void mitk::InteractionTestHelper::LoadInteraction ( )
protected

LoadInteraction loads events from xml file.

Parameters
interactionXmlPathpath to xml file with interaction events.

Definition at line 253 of file mitkInteractionTestHelper.cpp.

void mitk::InteractionTestHelper::PlaybackInteraction ( )

PlaybackInteraction playback loaded interaction by passing events to the dispatcher.

Definition at line 214 of file mitkInteractionTestHelper.cpp.

References mitk::RenderingManager::GetInstance(), mitk::RenderingManager::InitializeViewsByBoundingObjects(), and m_DataStorage.

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.

Definition at line 264 of file mitkInteractionTestHelper.cpp.

References mitk::SliceNavigationController::GetCreatedWorldGeometry(), mitk::RenderingManager::GetInstance(), mitk::BaseController::GetTime(), mitk::RenderingManager::GetTimeNavigationController(), mitk::RenderingManager::InitializeViewsByBoundingObjects(), mitk::TimeGeometry::IsValidTimeStep(), m_DataStorage, and mitk::Stepper::SetPos().

Member Data Documentation

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

Definition at line 143 of file mitkInteractionTestHelper.h.

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

Definition at line 138 of file mitkInteractionTestHelper.h.

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

Definition at line 140 of file mitkInteractionTestHelper.h.

mitk::MouseModeSwitcher::Pointer mitk::InteractionTestHelper::m_MouseModeSwitcher
protected

Definition at line 144 of file mitkInteractionTestHelper.h.

RenderWindowListType mitk::InteractionTestHelper::m_RenderWindowList
protected

Definition at line 142 of file mitkInteractionTestHelper.h.


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