Medical Imaging Interaction Toolkit
2016.11.0
Medical Imaging Interaction Toolkit
|
Creates everything needed to load and playback interaction events. More...
#include <mitkInteractionTestHelper.h>
Public Types | |
typedef std::vector< mitk::RenderWindow::Pointer > | RenderWindowListType |
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 RenderWindowListType & | GetRenderWindowList () |
RenderWindow * | GetRenderWindowByName (const std::string &name) |
GetRenderWindowByName Get renderWindow by the name of its renderer. More... | |
RenderWindow * | GetRenderWindowByDefaultViewDirection (mitk::SliceNavigationController::ViewDirection viewDirection) |
GetRenderWindowByDefaultViewDirection Get a renderWindow by its default viewdirection. More... | |
RenderWindow * | GetRenderWindow (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... | |
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.
Definition at line 55 of file mitkInteractionTestHelper.h.
typedef std::vector<mitk::RenderWindow::Pointer> mitk::InteractionTestHelper::RenderWindowListType |
Definition at line 92 of file mitkInteractionTestHelper.h.
mitk::InteractionTestHelper::InteractionTestHelper | ( | const std::string & | interactionXmlFilePath | ) |
InteractionTestHelper set up all neseccary objects by calling Initialize.
interactionXmlFilePath | path to xml file containing events and configuration information for the render windows. |
Definition at line 33 of file mitkInteractionTestHelper.cpp.
References Initialize().
|
virtual |
Definition at line 185 of file mitkInteractionTestHelper.cpp.
References mitk::SliceNavigationController::Disconnect(), mitk::RenderingManager::GetInstance(), mitk::RenderingManager::GetTimeNavigationController(), and mitk::BaseRenderer::RemoveInstance().
void mitk::InteractionTestHelper::AddDisplayPlaneSubTree | ( | ) |
AddDisplayPlaneSubTree.
Creates DisplayPlanes that are shown in a 3D RenderWindow.
Definition at line 319 of file mitkInteractionTestHelper.cpp.
References mitk::BaseRenderer::GetInstance(), m_DataStorage, mitk::BoolProperty::New(), mitk::IntProperty::New(), mitk::StringProperty::New(), mitk::PlaneGeometryDataMapper2D::New(), mitk::DataNode::New(), mitk::BaseRenderer::Standard2D, and mitk::BaseRenderer::Standard3D.
void mitk::InteractionTestHelper::AddNodeToStorage | ( | mitk::DataNode::Pointer | node | ) |
AddNodeToStorage Add a node to the datastorage and perform a reinit which is necessary for rendering.
node | The 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'.
index | Position within the renderWindow list. |
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.
viewDirection |
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.
name | The name of the renderer of the desired renderWindow. |
Definition at line 278 of file mitkInteractionTestHelper.cpp.
|
inline |
Definition at line 94 of file mitkInteractionTestHelper.h.
|
protected |
Initialize Internal method to initialize the renderwindow and set the datastorage.
mitk::Exception | if 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().
|
protected |
LoadInteraction loads events from xml file.
interactionXmlPath | path 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::Set3dCameraSettings | ( | ) |
Definition at line 354 of file mitkInteractionTestHelper.cpp.
References mitk::RenderWindowBase::GetRenderer(), mitk::BaseRenderer::GetVtkRenderer(), mitk::RenderWindow::GetVtkRenderWindow(), MITK_ERROR, mitk::VtkPropRenderer::PrepareRender(), 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::xmlTagConfigRoot(), mitk::InteractionEventConst::xmlTagInteractions(), mitk::InteractionEventConst::xmlTagRenderer(), mitk::InteractionEventConst::xmlViewUpX(), mitk::InteractionEventConst::xmlViewUpY(), and mitk::InteractionEventConst::xmlViewUpZ().
void mitk::InteractionTestHelper::SetTimeStep | ( | int | newTimeStep | ) |
SetTimeStep Sets timesteps of all SliceNavigationControllers to given timestep.
newTimeStep | new 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().
|
protected |
Definition at line 143 of file mitkInteractionTestHelper.h.
|
protected |
Definition at line 138 of file mitkInteractionTestHelper.h.
|
protected |
Definition at line 140 of file mitkInteractionTestHelper.h.
|
protected |
Definition at line 144 of file mitkInteractionTestHelper.h.
|
protected |
Definition at line 142 of file mitkInteractionTestHelper.h.