Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkRenderingManager.cpp
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #include "mitkRenderingManager.h"
18 #include "mitkBaseRenderer.h"
19 #include "mitkCameraController.h"
20 #include "mitkNodePredicateNot.h"
24 
25 #include <vtkRenderWindow.h>
26 
27 #include "mitkNumericTypes.h"
28 #include <itkAffineGeometryFrame.h>
29 #include <itkCommand.h>
30 #include <itkScalableAffineTransform.h>
31 #include <mitkVtkPropRenderer.h>
32 
33 #include <algorithm>
34 
35 namespace mitk
36 {
37  itkEventMacroDefinition(FocusChangedEvent, itk::AnyEvent)
38 
39  RenderingManager::Pointer RenderingManager::s_Instance = 0;
40  RenderingManagerFactory *RenderingManager::s_RenderingManagerFactory = 0;
41 
43  : m_UpdatePending(false),
44  m_MaxLOD(1),
45  m_LODIncreaseBlocked(false),
46  m_LODAbortMechanismEnabled(false),
47  m_ClippingPlaneEnabled(false),
49  m_DataStorage(NULL),
50  m_ConstrainedPanningZooming(true),
51  m_FocusedRenderWindow(nullptr)
52  {
53  m_ShadingEnabled.assign(3, false);
54  m_ShadingValues.assign(4, 0.0);
55 
56  InitializePropertyList();
57  }
58 
60  {
61  // Decrease reference counts of all registered vtkRenderWindows for
62  // proper destruction
63  RenderWindowVector::iterator it;
64  for (it = m_AllRenderWindows.begin(); it != m_AllRenderWindows.end(); ++it)
65  {
66  (*it)->UnRegister(NULL);
67 
68  RenderWindowCallbacksList::iterator callbacks_it = this->m_RenderWindowCallbacksList.find(*it);
69 
70  if (callbacks_it != this->m_RenderWindowCallbacksList.end())
71  {
72  (*it)->RemoveObserver(callbacks_it->second.commands[0u]);
73  (*it)->RemoveObserver(callbacks_it->second.commands[1u]);
74  (*it)->RemoveObserver(callbacks_it->second.commands[2u]);
75  }
76  }
77  }
78 
82  {
84  {
85  return true;
86  }
87  else
88  {
89  return false;
90  }
91  }
92 
94  {
95  const RenderingManagerFactory *factory = GetFactory();
96  if (factory == NULL)
97  return NULL;
98  return factory->CreateRenderingManager();
99  }
100 
102  {
104  {
106  {
108  }
109  }
110 
111  return s_Instance;
112  }
113 
115  {
117  return true;
118  else
119  return false;
120  }
121 
122  void RenderingManager::AddRenderWindow(vtkRenderWindow *renderWindow)
123  {
124  if (renderWindow && (m_RenderWindowList.find(renderWindow) == m_RenderWindowList.end()))
125  {
126  m_RenderWindowList[renderWindow] = RENDERING_INACTIVE;
127  m_AllRenderWindows.push_back(renderWindow);
128 
129  if (m_DataStorage.IsNotNull())
130  mitk::BaseRenderer::GetInstance(renderWindow)->SetDataStorage(m_DataStorage.GetPointer());
131 
132  // Register vtkRenderWindow instance
133  renderWindow->Register(NULL);
134 
135  // Add callbacks for rendering abort mechanism
136  // BaseRenderer *renderer = BaseRenderer::GetInstance( renderWindow );
137  vtkCallbackCommand *startCallbackCommand = vtkCallbackCommand::New();
138  startCallbackCommand->SetCallback(RenderingManager::RenderingStartCallback);
139  renderWindow->AddObserver(vtkCommand::StartEvent, startCallbackCommand);
140 
141  vtkCallbackCommand *progressCallbackCommand = vtkCallbackCommand::New();
142  progressCallbackCommand->SetCallback(RenderingManager::RenderingProgressCallback);
143  renderWindow->AddObserver(vtkCommand::AbortCheckEvent, progressCallbackCommand);
144 
145  vtkCallbackCommand *endCallbackCommand = vtkCallbackCommand::New();
146  endCallbackCommand->SetCallback(RenderingManager::RenderingEndCallback);
147  renderWindow->AddObserver(vtkCommand::EndEvent, endCallbackCommand);
148 
149  RenderWindowCallbacks callbacks;
150 
151  callbacks.commands[0u] = startCallbackCommand;
152  callbacks.commands[1u] = progressCallbackCommand;
153  callbacks.commands[2u] = endCallbackCommand;
154  this->m_RenderWindowCallbacksList[renderWindow] = callbacks;
155 
156  // Delete vtk variables correctly
157  startCallbackCommand->Delete();
158  progressCallbackCommand->Delete();
159  endCallbackCommand->Delete();
160  }
161  }
162 
163  void RenderingManager::RemoveRenderWindow(vtkRenderWindow *renderWindow)
164  {
165  if (m_RenderWindowList.erase(renderWindow))
166  {
167  RenderWindowCallbacksList::iterator callbacks_it = this->m_RenderWindowCallbacksList.find(renderWindow);
168  if (callbacks_it != this->m_RenderWindowCallbacksList.end())
169  {
170  renderWindow->RemoveObserver(callbacks_it->second.commands[0u]);
171  renderWindow->RemoveObserver(callbacks_it->second.commands[1u]);
172  renderWindow->RemoveObserver(callbacks_it->second.commands[2u]);
173  this->m_RenderWindowCallbacksList.erase(callbacks_it);
174  }
175 
176  RenderWindowVector::iterator rw_it =
177  std::find(m_AllRenderWindows.begin(), m_AllRenderWindows.end(), renderWindow);
178 
179  if (rw_it != m_AllRenderWindows.cend())
180  {
181  // Decrease reference count for proper destruction
182  (*rw_it)->UnRegister(NULL);
183  m_AllRenderWindows.erase(rw_it);
184  }
185  }
186  }
187 
189  {
190  return m_AllRenderWindows;
191  }
192 
193  void RenderingManager::RequestUpdate(vtkRenderWindow *renderWindow)
194  {
195  // If the renderWindow is not valid, we do not want to inadvertantly create
196  // an entry in the m_RenderWindowList map. It is possible if the user is
197  // regularly calling AddRenderer and RemoveRenderer for a rendering update
198  // to come into this method with a renderWindow pointer that is valid in the
199  // sense that the window does exist within the application, but that
200  // renderWindow has been temporarily removed from this RenderingManager for
201  // performance reasons.
202  if (m_RenderWindowList.find(renderWindow) == m_RenderWindowList.cend())
203  {
204  return;
205  }
206 
207  m_RenderWindowList[renderWindow] = RENDERING_REQUESTED;
208 
209  if (!m_UpdatePending)
210  {
211  m_UpdatePending = true;
213  }
214  }
215 
216  void RenderingManager::ForceImmediateUpdate(vtkRenderWindow *renderWindow)
217  {
218  // If the renderWindow is not valid, we do not want to inadvertantly create
219  // an entry in the m_RenderWindowList map. It is possible if the user is
220  // regularly calling AddRenderer and RemoveRenderer for a rendering update
221  // to come into this method with a renderWindow pointer that is valid in the
222  // sense that the window does exist within the application, but that
223  // renderWindow has been temporarily removed from this RenderingManager for
224  // performance reasons.
225  if (m_RenderWindowList.find(renderWindow) == m_RenderWindowList.cend())
226  {
227  return;
228  }
229 
230  // Erase potentially pending requests for this window
231  m_RenderWindowList[renderWindow] = RENDERING_INACTIVE;
232 
233  m_UpdatePending = false;
234 
235  // Immediately repaint this window (implementation platform specific)
236  // If the size is 0 it crashes
237  int *size = renderWindow->GetSize();
238  if (0 != size[0] && 0 != size[1])
239  {
240  // prepare the camera etc. before rendering
241  // Note: this is a very important step which should be called before the VTK render!
242  // If you modify the camera anywhere else or after the render call, the scene cannot be seen.
244  if (vPR)
245  vPR->PrepareRender();
246  // Execute rendering
247  renderWindow->Render();
248  }
249  }
250 
252  {
253  RenderWindowList::const_iterator it;
254  for (it = m_RenderWindowList.cbegin(); it != m_RenderWindowList.cend(); ++it)
255  {
256  int id = BaseRenderer::GetInstance(it->first)->GetMapperID();
257  if ((type == REQUEST_UPDATE_ALL) || ((type == REQUEST_UPDATE_2DWINDOWS) && (id == 1)) ||
258  ((type == REQUEST_UPDATE_3DWINDOWS) && (id == 2)))
259  {
260  this->RequestUpdate(it->first);
261  }
262  }
263  }
264 
266  {
267  RenderWindowList::const_iterator it;
268  for (it = m_RenderWindowList.cbegin(); it != m_RenderWindowList.cend(); ++it)
269  {
270  int id = BaseRenderer::GetInstance(it->first)->GetMapperID();
271  if ((type == REQUEST_UPDATE_ALL) || ((type == REQUEST_UPDATE_2DWINDOWS) && (id == 1)) ||
272  ((type == REQUEST_UPDATE_3DWINDOWS) && (id == 2)))
273  {
274  // Immediately repaint this window (implementation platform specific)
275  // If the size is 0, it crashes
276  this->ForceImmediateUpdate(it->first);
277  }
278  }
279  }
280 
282  {
283  if (!ds)
284  return;
285 
286  // get all nodes that have not set "includeInBoundingBox" to false
288  mitk::NodePredicateProperty::New("includeInBoundingBox", mitk::BoolProperty::New(false)));
289 
291  // calculate bounding geometry of these nodes
292  mitk::TimeGeometry::Pointer bounds = ds->ComputeBoundingGeometry3D(rs, "visible");
293 
294  // initialize the views to the bounding geometry
295  this->InitializeViews(bounds);
296  }
297 
298  // TODO_GOETZ
299  // Remove old function, so only this one is working.
301  RequestType type,
302  bool preserveRoughOrientationInWorldSpace)
303  {
305  propTimeGeometry->Initialize(dynamic_cast<BaseGeometry *>(dataGeometry->Clone().GetPointer()), 1);
306  return InitializeViews(propTimeGeometry, type, preserveRoughOrientationInWorldSpace);
307  }
308 
310  RequestType type,
311  bool /*preserveRoughOrientationInWorldSpace*/)
312  {
313  MITK_DEBUG << "initializing views";
314 
315  bool boundingBoxInitialized = false;
316 
317  TimeGeometry::ConstPointer timeGeometry = dataGeometry;
318  TimeGeometry::Pointer modifiedGeometry = NULL;
319  if (dataGeometry != NULL)
320  {
321  modifiedGeometry = dataGeometry->Clone();
322  }
323 
324  int warningLevel = vtkObject::GetGlobalWarningDisplay();
325  vtkObject::GlobalWarningDisplayOff();
326 
327  if ((timeGeometry.IsNotNull()) &&
328  (const_cast<mitk::BoundingBox *>(timeGeometry->GetBoundingBoxInWorld())->GetDiagonalLength2() > mitk::eps))
329  {
330  boundingBoxInitialized = true;
331  }
332 
333  if (timeGeometry.IsNotNull())
334  { // make sure bounding box has an extent bigger than zero in any direction
335  // clone the input geometry
336  // Old Geometry3D::Pointer modifiedGeometry = dynamic_cast<Geometry3D*>( dataGeometry->Clone().GetPointer() );
337  assert(modifiedGeometry.IsNotNull());
338  for (TimeStepType step = 0; step < modifiedGeometry->CountTimeSteps(); ++step)
339  {
340  BaseGeometry::BoundsArrayType newBounds = modifiedGeometry->GetGeometryForTimeStep(step)->GetBounds();
341  for (unsigned int dimension = 0; (2 * dimension) < newBounds.Size(); dimension++)
342  {
343  // check for equality but for an epsilon
344  if (Equal(newBounds[2 * dimension], newBounds[2 * dimension + 1]))
345  {
346  newBounds[2 * dimension + 1] += 1;
347  if (Equal(
348  newBounds[2 * dimension],
349  newBounds[2 * dimension + 1])) // newBounds will still be equal if values are beyond double precision
350  {
351  mitkThrow() << "One dimension of object data has zero length, please make sure you're not using numbers "
352  "beyond double precision as coordinates.";
353  }
354  }
355  }
356  modifiedGeometry->GetGeometryForTimeStep(step)->SetBounds(newBounds);
357  }
358  }
359 
360  timeGeometry = modifiedGeometry;
361  RenderWindowList::const_iterator it;
362  for (it = m_RenderWindowList.cbegin(); it != m_RenderWindowList.cend(); ++it)
363  {
364  mitk::BaseRenderer *baseRenderer = mitk::BaseRenderer::GetInstance(it->first);
365 
367 
368  int id = baseRenderer->GetMapperID();
369  if (((type == REQUEST_UPDATE_ALL) || ((type == REQUEST_UPDATE_2DWINDOWS) && (id == 1)) ||
370  ((type == REQUEST_UPDATE_3DWINDOWS) && (id == 2))))
371  {
372  this->InternalViewInitialization(baseRenderer, timeGeometry, boundingBoxInitialized, id);
373  }
374  }
375 
376  if (boundingBoxInitialized)
377  {
378  m_TimeNavigationController->SetInputWorldTimeGeometry(timeGeometry);
379  }
380  m_TimeNavigationController->Update();
381 
382  this->RequestUpdateAll(type);
383 
384  vtkObject::SetGlobalWarningDisplay(warningLevel);
385 
386  // Inform listeners that views have been initialized
387  this->InvokeEvent(mitk::RenderingManagerViewsInitializedEvent());
388 
389  return boundingBoxInitialized;
390  }
391 
393  {
394  RenderWindowList::const_iterator it;
395  for (it = m_RenderWindowList.cbegin(); it != m_RenderWindowList.cend(); ++it)
396  {
397  mitk::BaseRenderer *baseRenderer = mitk::BaseRenderer::GetInstance(it->first);
398  int id = baseRenderer->GetMapperID();
399  if ((type == REQUEST_UPDATE_ALL) || ((type == REQUEST_UPDATE_2DWINDOWS) && (id == 1)) ||
400  ((type == REQUEST_UPDATE_3DWINDOWS) && (id == 2)))
401  {
403 
404  baseRenderer->GetSliceNavigationController();
405 
406  // Re-initialize view direction
408 
409  // Update the SNC
410  nc->Update();
411  }
412  }
413 
414  this->RequestUpdateAll(type);
415 
416  return true;
417  }
418 
419  bool RenderingManager::InitializeView(vtkRenderWindow *renderWindow,
420  const BaseGeometry *geometry,
421  bool initializeGlobalTimeSNC)
422  {
424  propTimeGeometry->Initialize(dynamic_cast<BaseGeometry *>(geometry->Clone().GetPointer()), 1);
425  return InitializeView(renderWindow, propTimeGeometry, initializeGlobalTimeSNC);
426  }
427 
428  bool RenderingManager::InitializeView(vtkRenderWindow *renderWindow,
429  const TimeGeometry *geometry,
430  bool initializeGlobalTimeSNC)
431  {
432  bool boundingBoxInitialized = false;
433 
434  int warningLevel = vtkObject::GetGlobalWarningDisplay();
435  vtkObject::GlobalWarningDisplayOff();
436 
437  if ((geometry != NULL) &&
438  (const_cast<mitk::BoundingBox *>(geometry->GetBoundingBoxInWorld())->GetDiagonalLength2() > mitk::eps))
439  {
440  boundingBoxInitialized = true;
441  }
442 
443  mitk::BaseRenderer *baseRenderer = mitk::BaseRenderer::GetInstance(renderWindow);
444 
445  int id = baseRenderer->GetMapperID();
446 
447  this->InternalViewInitialization(baseRenderer, geometry, boundingBoxInitialized, id);
448 
449  if (boundingBoxInitialized && initializeGlobalTimeSNC)
450  {
451  m_TimeNavigationController->SetInputWorldTimeGeometry(geometry);
452  }
453  m_TimeNavigationController->Update();
454 
455  this->RequestUpdate(renderWindow);
456 
457  vtkObject::SetGlobalWarningDisplay(warningLevel);
458 
459  return boundingBoxInitialized;
460  }
461 
462  bool RenderingManager::InitializeView(vtkRenderWindow *renderWindow)
463  {
464  mitk::BaseRenderer *baseRenderer = mitk::BaseRenderer::GetInstance(renderWindow);
465 
467 
468  // Re-initialize view direction
470 
471  // Update the SNC
472  nc->Update();
473 
474  this->RequestUpdate(renderWindow);
475 
476  return true;
477  }
478 
479  void RenderingManager::InternalViewInitialization(mitk::BaseRenderer *baseRenderer,
480  const mitk::TimeGeometry *geometry,
481  bool boundingBoxInitialized,
482  int mapperID)
483  {
485 
486  // Re-initialize view direction
488 
489  if (boundingBoxInitialized)
490  {
491  // Set geometry for NC
492  nc->SetInputWorldTimeGeometry(geometry);
493  nc->Update();
494 
495  if (mapperID == BaseRenderer::Standard2D)
496  {
497  // For 2D SNCs, steppers are set so that the cross is centered
498  // in the image
499  nc->GetSlice()->SetPos(nc->GetSlice()->GetSteps() / 2);
500  }
501 
502  baseRenderer->GetCameraController()->SetViewToAnterior();
503  baseRenderer->GetCameraController()->Fit();
504  }
505  else
506  {
507  nc->Update();
508  }
509  }
510 
512  {
513  return m_TimeNavigationController.GetPointer();
514  }
515 
517  {
518  return m_TimeNavigationController.GetPointer();
519  }
520 
522  {
523  m_UpdatePending = false;
524 
525  // Satisfy all pending update requests
526  RenderWindowList::const_iterator it;
527  int i = 0;
528  for (it = m_RenderWindowList.cbegin(); it != m_RenderWindowList.cend(); ++it, ++i)
529  {
530  if (it->second == RENDERING_REQUESTED)
531  {
532  this->ForceImmediateUpdate(it->first);
533  }
534  }
535  }
536 
537  void RenderingManager::RenderingStartCallback(vtkObject *caller, unsigned long, void *, void *)
538  {
539  vtkRenderWindow *renderWindow = dynamic_cast<vtkRenderWindow *>(caller);
541  RenderWindowList &renderWindowList = renman->m_RenderWindowList;
542 
543  if (renderWindow)
544  {
545  renderWindowList[renderWindow] = RENDERING_INPROGRESS;
546  }
547 
548  renman->m_UpdatePending = false;
549  }
550 
551  void RenderingManager::RenderingProgressCallback(vtkObject *caller, unsigned long, void *, void *)
552  {
553  vtkRenderWindow *renderWindow = dynamic_cast<vtkRenderWindow *>(caller);
555 
556  if (renman->m_LODAbortMechanismEnabled)
557  {
558  vtkRenderWindow *renderWindow = dynamic_cast<vtkRenderWindow *>(caller);
559  if (renderWindow)
560  {
561  BaseRenderer *renderer = BaseRenderer::GetInstance(renderWindow);
562  if (renderer && (renderer->GetNumberOfVisibleLODEnabledMappers() > 0))
563  {
564  renman->DoMonitorRendering();
565  }
566  }
567  }
568  }
569 
570  void RenderingManager::RenderingEndCallback(vtkObject *caller, unsigned long, void *, void *)
571  {
572  vtkRenderWindow *renderWindow = dynamic_cast<vtkRenderWindow *>(caller);
573 
575 
576  RenderWindowList &renderWindowList = renman->m_RenderWindowList;
577 
578  RendererIntMap &nextLODMap = renman->m_NextLODMap;
579 
580  if (renderWindow)
581  {
582  BaseRenderer *renderer = BaseRenderer::GetInstance(renderWindow);
583  if (renderer)
584  {
585  renderWindowList[renderer->GetRenderWindow()] = RENDERING_INACTIVE;
586 
587  // Level-of-Detail handling
588  if (renderer->GetNumberOfVisibleLODEnabledMappers() > 0)
589  {
590  if (nextLODMap[renderer] == 0)
591  renman->StartOrResetTimer();
592  else
593  nextLODMap[renderer] = 0;
594  }
595  }
596  }
597  }
598 
600  {
601  RenderWindowList::const_iterator it;
602  for (it = m_RenderWindowList.cbegin(); it != m_RenderWindowList.cend(); ++it)
603  {
604  if (it->second == RENDERING_INPROGRESS)
605  {
606  return true;
607  }
608  }
609  return false;
610  }
611 
613  {
614  RenderWindowList::const_iterator it;
615  for (it = m_RenderWindowList.cbegin(); it != m_RenderWindowList.cend(); ++it)
616  {
617  if (it->second == RENDERING_INPROGRESS)
618  {
619  it->first->SetAbortRender(true);
621  }
622  }
623  }
624 
626  {
627  if (renderer != NULL)
628  {
629  return m_NextLODMap[renderer];
630  }
631  else
632  {
633  return 0;
634  }
635  }
636 
638  {
639  RenderWindowList::const_iterator it;
640  for (it = m_RenderWindowList.cbegin(); it != m_RenderWindowList.cend(); ++it)
641  {
642  BaseRenderer *renderer = BaseRenderer::GetInstance(it->first);
643 
644  if (renderer->GetNumberOfVisibleLODEnabledMappers() > 0)
645  {
646  if (m_NextLODMap[renderer] == 0)
647  {
648  m_NextLODMap[renderer] = 1;
649  RequestUpdate(it->first);
650  }
651  }
652  }
653  }
654 
656  // enable/disable shading
657  void RenderingManager::SetShading(bool state, unsigned int lod)
658  {
659  if (lod > m_MaxLOD)
660  {
661  itkWarningMacro(<< "LOD out of range requested: " << lod << " maxLOD: " << m_MaxLOD);
662  return;
663  }
664  m_ShadingEnabled[lod] = state;
665  }
666 
667  bool RenderingManager::GetShading(unsigned int lod)
668  {
669  if (lod > m_MaxLOD)
670  {
671  itkWarningMacro(<< "LOD out of range requested: " << lod << " maxLOD: " << m_MaxLOD);
672  return false;
673  }
674  return m_ShadingEnabled[lod];
675  }
676 
677  // enable/disable the clipping plane
680  void RenderingManager::SetShadingValues(float ambient, float diffuse, float specular, float specpower)
681  {
682  m_ShadingValues[0] = ambient;
683  m_ShadingValues[1] = diffuse;
684  m_ShadingValues[2] = specular;
685  m_ShadingValues[3] = specpower;
686  }
687 
690  {
691  if (m_PropertyList.IsNull())
692  {
694  }
695 
696  this->SetProperty("coupled-zoom", BoolProperty::New(false));
697  this->SetProperty("coupled-plane-rotation", BoolProperty::New(false));
698  this->SetProperty("MIP-slice-rendering", BoolProperty::New(false));
699  }
700 
702  BaseProperty *RenderingManager::GetProperty(const char *propertyKey) const
703  {
704  return m_PropertyList->GetProperty(propertyKey);
705  }
706 
707  void RenderingManager::SetProperty(const char *propertyKey, BaseProperty *propertyValue)
708  {
709  m_PropertyList->SetProperty(propertyKey, propertyValue);
710  }
711 
713  {
714  if (storage != NULL)
715  {
716  m_DataStorage = storage;
717 
718  RenderingManager::RenderWindowVector::const_iterator iter;
719  for (iter = m_AllRenderWindows.cbegin(); iter < m_AllRenderWindows.cend(); ++iter)
720  {
722  }
723  }
724  }
725 
727  void RenderingManager::SetRenderWindowFocus(vtkRenderWindow *focusWindow)
728  {
729  if (focusWindow != m_FocusedRenderWindow)
730  {
731  if (!focusWindow || (m_RenderWindowList.find(focusWindow) != m_RenderWindowList.cend()))
732  {
733  m_FocusedRenderWindow = focusWindow;
734  this->InvokeEvent(FocusChangedEvent());
735  return;
736  }
737 
738  MITK_ERROR << "Tried to set a RenderWindow that does not exist.";
739  }
740  }
741 
742  // Create and register generic RenderingManagerFactory.
744 } // namespace
virtual bool InitializeViews(const BaseGeometry *geometry, RequestType type=REQUEST_UPDATE_ALL, bool preserveRoughOrientationInWorldSpace=false)
static const RenderingManagerFactory * GetFactory()
mitk::Stepper * GetSlice()
Get the Stepper through the slices.
RenderWindowList m_RenderWindowList
static void RenderingStartCallback(vtkObject *caller, unsigned long eid, void *clientdata, void *calldata)
Data management class that handles 'was created by' relations.
const SliceNavigationController * GetTimeNavigationController() const
itk::SmartPointer< Self > Pointer
static Pointer New()
PropertyList::Pointer GetPropertyList() const
itkEventMacroDefinition(OverlayAddEvent, itk::AnyEvent) OverlayManager
BoundingBoxType::BoundsArrayType BoundsArrayType
static BaseRenderer * GetInstance(vtkRenderWindow *renWin)
void RemoveRenderWindow(vtkRenderWindow *renderWindow)
RendererBoolMap m_RenderingAbortedMap
BoundingBox * GetBoundingBoxInWorld() const
Returns a bounding box that covers all time steps.
static void RenderingProgressCallback(vtkObject *caller, unsigned long eid, void *clientdata, void *calldata)
unsigned int GetNumberOfVisibleLODEnabledMappers() const
void SetInputWorldTimeGeometry(const mitk::TimeGeometry *geometry)
virtual void GenerateRenderingRequestEvent()=0
#define MITK_ERROR
Definition: mitkLogMacros.h:24
virtual void SetConstrainZoomingAndPanning(bool constrain)
virtual void SetDataStorage(DataStorage *storage)
set the datastorage that will be used for rendering
static RenderingManager::Pointer s_Instance
void SetMaximumLOD(unsigned int max)
std::vector< float > FloatVector
Organizes the rendering process.
#define MITK_DEBUG
Definition: mitkLogMacros.h:26
DataCollection - Class to facilitate loading/accessing structured data.
static RenderingManagerFactory * s_RenderingManagerFactory
void SetClippingPlaneStatus(bool status)
RenderWindowVector m_AllRenderWindows
Controls the selection of the slice the associated BaseRenderer will display.
itk::SmartPointer< const Self > ConstPointer
static Pointer New()
virtual unsigned int GetSteps() const
Abstract base class for properties.
void SetProperty(const char *propertyKey, BaseProperty *propertyValue)
mitk::DataStorage::Pointer m_DataStorage
virtual mitk::RenderingManager * GetRenderingManager() const
Setter for the RenderingManager that handles this instance of BaseRenderer.
void SetRenderWindowFocus(vtkRenderWindow *focusWindow)
Sets a flag to the given renderwindow to indicated that it has the focus e.g. has been clicked recent...
SetOfObjects::ConstPointer GetSubset(const NodePredicateBase *condition) const
returns a set of data objects that meet the given condition(s)
Manager for coordinating the rendering process.
RenderWindowCallbacksList m_RenderWindowCallbacksList
void SetShadingValues(float ambient, float diffuse, float specular, float specpower)
static RenderingManager * GetInstance()
std::map< vtkRenderWindow *, int > RenderWindowList
virtual CameraController * GetCameraController()
#define mitkThrow()
Factory interface for facilitating the usage of a platform-specific mitk::RenderingManager instance...
static Pointer New(const mitk::NodePredicateBase *_arg)
virtual MapperSlotId GetMapperID()
Get the MapperSlotId to use.
DataStoragePointer m_DataStorage
void SetDataStorage(mitk::DataStorage *storage)
Setter / Getter for internal DataStorage.
std::vcl_size_t TimeStepType
virtual void SetPos(unsigned int pos)
Definition: mitkStepper.h:59
void ForceImmediateUpdate(vtkRenderWindow *renderWindow)
static T max(T x, T y)
Definition: svm.cpp:70
std::vector< vtkRenderWindow * > RenderWindowVector
int GetNextLOD(BaseRenderer *renderer)
static Pointer New(const char *_arg)
virtual RenderingManager::Pointer CreateRenderingManager() const =0
Factory method to create platform specific instances of RenderingManager.
std::map< BaseRenderer *, unsigned int > RendererIntMap
bool GetShading(unsigned int lod)
mitk::TimeGeometry::Pointer ComputeBoundingGeometry3D(const SetOfObjects *input, const char *boolPropertyKey=nullptr, const mitk::BaseRenderer *renderer=nullptr, const char *boolPropertyKey2=nullptr) const
Compute the axis-parallel bounding geometry of the input objects.
void RequestUpdate(vtkRenderWindow *renderWindow)
virtual void PrepareRender()
This methods contains all method neceassary before a VTK Render() call.
void AddRenderWindow(vtkRenderWindow *renderWindow)
MITKNEWMODULE_EXPORT bool Equal(mitk::ExampleDataStructure *leftHandSide, mitk::ExampleDataStructure *rightHandSide, mitk::ScalarType eps, bool verbose)
Returns true if the example data structures are considered equal.
void ForceImmediateUpdateAll(RequestType type=REQUEST_UPDATE_ALL)
void SetShading(bool state, unsigned int lod)
PropertyList::Pointer m_PropertyList
MITKCORE_EXPORT const ScalarType eps
TestingRenderingManagerFactory renderingManagerFactory
virtual SliceNavigationController * GetSliceNavigationController()
Pointer Clone() const
static void RenderingEndCallback(vtkObject *caller, unsigned long eid, void *clientdata, void *calldata)
mitk::SliceNavigationController * m_TimeNavigationController
static void SetFactory(RenderingManagerFactory *factory)
mitk::DataStorage * GetDataStorage()
Setter / Getter for internal DataStorage.
void Fit()
Fit Adjust the camera, so that the world bounding box is fully visible.
virtual void InitializeViewsByBoundingObjects(const DataStorage *)
Initializes the renderwindows by the aggregated geometry of all objects that are held in the data sto...
virtual void Update()
Do the actual creation and send it to the connected observers (renderers)
Pointer Clone() const
virtual bool InitializeView(vtkRenderWindow *renderWindow, const BaseGeometry *geometry, bool initializeGlobalTimeSNC=false)
const RenderWindowVector & GetAllRegisteredRenderWindows()
vtkRenderWindow * GetRenderWindow() const
Access the RenderWindow into which this renderer renders.
void RequestUpdateAll(RequestType type=REQUEST_UPDATE_ALL)
BaseGeometry Describes the geometry of a data object.
BaseProperty * GetProperty(const char *propertyKey) const
itk::SmartPointer< SliceNavigationController > m_TimeNavigationController
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.