21 #include <vtkCamera.h> 22 #include <vtkRenderWindowInteractor.h> 30 : m_InteractionFilePath(interactionXmlFilePath)
38 TiXmlDocument document(interactionXmlFilePath);
39 bool loadOkay = document.LoadFile();
56 const char *rendererName =
63 int viewDirectionNum =
79 size[0] = size[1] = size[2] = 0;
96 if (size[0] != 0 && size[1] != 0)
98 rw->SetSize(size[0], size[1]);
99 rw->GetRenderer()->Resize(size[0], size[1]);
106 rw->GetSliceNavigationController()->SetDefaultViewDirection(viewDirection);
109 rw->GetRenderer()->SetMapperID(mapperID);
111 rw->GetRenderer()->PrepareRender();
120 double cameraFocalPoint[3];
122 cameraFocalPoint[0] =
124 cameraFocalPoint[1] =
126 cameraFocalPoint[2] =
128 rw->GetRenderer()->GetVtkRenderer()->GetActiveCamera()->SetFocalPoint(cameraFocalPoint);
133 double cameraPosition[3];
138 rw->GetRenderer()->GetVtkRenderer()->GetActiveCamera()->SetPosition(cameraPosition);
148 rw->GetRenderer()->GetVtkRenderer()->GetActiveCamera()->SetViewUp(viewUp);
152 rw->GetVtkRenderWindow()->Render();
153 rw->GetVtkRenderWindow()->WaitForCompletion();
156 rw->GetSliceNavigationController()->ConnectGeometryTimeEvent(rm->GetTimeNavigationController(),
false);
157 rm->GetTimeNavigationController()->ConnectGeometryTimeEvent(rw->GetSliceNavigationController(),
false);
188 for (; it != end; ++it)
194 rm->RemoveAllObservers();
218 for (; it != end; ++it)
220 (*it)->GetRenderer()->PrepareRender();
222 (*it)->GetVtkRenderWindow()->Render();
223 (*it)->GetVtkRenderWindow()->WaitForCompletion();
228 for (; it != end; ++it)
230 (*it)->GetVtkRenderWindow()->Render();
231 (*it)->GetVtkRenderWindow()->WaitForCompletion();
236 for (
unsigned long i = 0; i <
m_Events.size(); ++i)
244 (*it)->GetVtkRenderWindow()->GetInteractor()->Start();
253 m_Events = parser.GetInteractions();
256 parser.SetReferenceCount(0);
263 bool timeStepIsvalid =
278 for (; it != end; ++it)
280 if (name.compare((*it)->GetRenderer()->GetName()) == 0)
281 return (*it).GetPointer();
293 for (; it != end; ++it)
295 if (viewDirection == (*it)->GetSliceNavigationController()->GetDefaultViewDirection())
296 return (*it).GetPointer();
341 planeNode1->SetProperty(
"layer", layer);
342 planeNode1->SetColor(1.0, 0.0, 0.0);
352 bool loadOkay = document.LoadFile();
363 const char *rendererName =
381 if (strcmp(it->GetRenderer()->GetName(), rendererName) == 0)
383 namedRenderer = it.GetPointer();
388 if (namedRenderer ==
nullptr)
390 MITK_ERROR <<
"No match for render window was found.";
397 double cameraFocalPoint[3];
399 cameraFocalPoint[0] =
401 cameraFocalPoint[1] =
403 cameraFocalPoint[2] =
410 double cameraPosition[3];
static const std::string xmlCameraPositionZ()
virtual const mitk::TimeGeometry * GetCreatedWorldGeometry()
Access the created geometry.
static const std::string xmlViewUpX()
void Disconnect(T *receiver)
vtkRenderWindow * GetVtkRenderWindow() override
void Set3dCameraSettings()
static const std::string xmlEventPropertyRendererName()
static BaseRenderer * GetInstance(vtkRenderWindow *renWin)
vtkRenderer * GetVtkRenderer() const
void PlaybackInteraction()
PlaybackInteraction playback loaded interaction by passing events to the dispatcher.
mitk::DataStorage::Pointer m_DataStorage
static const std::string xmlTagConfigRoot()
static const std::string xmlTagInteractions()
static const std::string xmlEventPropertyMapperID()
static const std::string xmlCameraFocalPointZ()
const SliceNavigationController * GetTimeNavigationController() const
void SetTimeStep(int newTimeStep)
SetTimeStep Sets timesteps of all SliceNavigationControllers to given timestep.
mitk::XML2EventParser::EventContainerType m_Events
static const std::string xmlCameraFocalPointX()
static const std::string xmlCameraFocalPointY()
static const std::string xmlRenderSizeX()
virtual ~InteractionTestHelper()
int MapperSlotId
MapperSlotId defines which kind of mapper (e.g. 2D or 3D) should be used.
Manager for coordinating the rendering process.
static const std::string xmlRenderSizeY()
void AddDisplayPlaneSubTree()
AddDisplayPlaneSubTree.
static RenderingManager * GetInstance()
ViewDirection
Possible view directions, Original will uses the PlaneGeometry instances in a SlicedGeometry3D provid...
virtual mitk::VtkPropRenderer * GetRenderer()
static const std::string xmlEventPropertyViewDirection()
virtual void SetPos(unsigned int pos)
RenderWindow * GetRenderWindowByDefaultViewDirection(mitk::SliceNavigationController::ViewDirection viewDirection)
GetRenderWindowByDefaultViewDirection Get a renderWindow by its default viewdirection.
static const std::string xmlTagRenderer()
RenderWindowListType m_RenderWindowList
void Initialize(const std::string &interactionXmlFilePath)
Initialize Internal method to initialize the renderwindow and set the datastorage.
RenderWindow * GetRenderWindowByName(const std::string &name)
GetRenderWindowByName Get renderWindow by the name of its renderer.
mitk::MouseModeSwitcher::Pointer m_MouseModeSwitcher
static const std::string xmlViewUpY()
RenderWindow * GetRenderWindow(unsigned int index)
GetRenderWindow Get renderWindow at position 'index'.
virtual void PrepareRender()
This methods contains all method neceassary before a VTK Render() call.
static const std::string xmlCameraPositionX()
void LoadInteraction()
LoadInteraction loads events from xml file.
mitkRenderWindow integrates the MITK rendering mechanism into VTK and is NOT QT dependent ...
static const std::string xmlCameraPositionY()
static const std::string xmlRenderSizeZ()
mitk::Stepper * GetTime()
Get the Stepper through the time.
static void RemoveInstance(vtkRenderWindow *renWin)
virtual void InitializeViewsByBoundingObjects(const DataStorage *)
Initializes the renderwindows by the aggregated geometry of all objects that are held in the data sto...
static const std::string xmlViewUpZ()
void AddNodeToStorage(mitk::DataNode::Pointer node)
AddNodeToStorage Add a node to the datastorage and perform a reinit which is necessary for rendering...
virtual bool IsValidTimeStep(TimeStepType timeStep) const =0
Test for the given time step if a geometry is availible.
InteractionTestHelper(const std::string &interactionXmlFilePath)
InteractionTestHelper set up all neseccary objects by calling Initialize.
mitk::DataStorage::Pointer GetDataStorage()
Returns the datastorage, in order to modify the data inside a rendering test.
std::string m_InteractionFilePath