Medical Imaging Interaction Toolkit  2018.4.99-9a29ffc6
Medical Imaging Interaction Toolkit
mitkBaseRenderer.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 (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #include "mitkBaseRenderer.h"
14 #include "mitkMapper.h"
16 
17 // Geometries
18 #include "mitkPlaneGeometry.h"
19 #include "mitkSlicedGeometry3D.h"
20 
21 // Controllers
22 #include "mitkCameraController.h"
25 
26 #include "mitkVtkLayerController.h"
27 
28 #include "mitkInteractionConst.h"
29 #include "mitkProperties.h"
31 
32 // VTK
33 #include <vtkCamera.h>
34 #include <vtkLinearTransform.h>
35 #include <vtkRenderWindow.h>
36 #include <vtkRenderer.h>
37 
38 #include <vtkActor.h>
39 #include <vtkPolyDataMapper.h>
40 #include <vtkProperty.h>
41 
43 
45 {
46  for (auto mapit = baseRendererMap.begin(); mapit != baseRendererMap.end(); ++mapit)
47  {
48  if ((*mapit).first == renWin)
49  return (*mapit).second;
50  }
51  return nullptr;
52 }
53 
54 void mitk::BaseRenderer::AddInstance(vtkRenderWindow *renWin, BaseRenderer *baseRenderer)
55 {
56  if (renWin == nullptr || baseRenderer == nullptr)
57  return;
58 
59  // ensure that no BaseRenderer is managed twice
61 
62  baseRendererMap.insert(BaseRendererMapType::value_type(renWin, baseRenderer));
63 }
64 
65 void mitk::BaseRenderer::RemoveInstance(vtkRenderWindow *renWin)
66 {
67  auto mapit = baseRendererMap.find(renWin);
68  if (mapit != baseRendererMap.end())
69  baseRendererMap.erase(mapit);
70 }
71 
73 {
74  for (auto mapit = baseRendererMap.begin(); mapit != baseRendererMap.end(); ++mapit)
75  {
76  if ((*mapit).second->m_Name == name)
77  return (*mapit).second;
78  }
79  return nullptr;
80 }
81 
82 vtkRenderWindow *mitk::BaseRenderer::GetRenderWindowByName(const std::string &name)
83 {
84  for (auto mapit = baseRendererMap.begin(); mapit != baseRendererMap.end(); ++mapit)
85  {
86  if ((*mapit).second->m_Name == name)
87  return (*mapit).first;
88  }
89  return nullptr;
90 }
91 
93  vtkRenderWindow *renWin)
94  : m_RenderWindow(nullptr),
95  m_VtkRenderer(nullptr),
97  m_DataStorage(nullptr),
99  m_CameraController(nullptr),
102  m_WorldTimeGeometry(nullptr),
103  m_CurrentWorldGeometry(nullptr),
104  m_CurrentWorldPlaneGeometry(nullptr),
105  m_Slice(0),
106  m_TimeStep(),
107  m_CurrentWorldPlaneGeometryUpdateTime(),
108  m_TimeStepUpdateTime(),
109  m_KeepDisplayedRegion(true),
113  m_Name(name),
114  m_EmptyWorldGeometry(true),
116 {
117  m_Bounds[0] = 0;
118  m_Bounds[1] = 0;
119  m_Bounds[2] = 0;
120  m_Bounds[3] = 0;
121  m_Bounds[4] = 0;
122  m_Bounds[5] = 0;
123 
124  if (name != nullptr)
125  {
126  m_Name = name;
127  }
128  else
129  {
130  m_Name = "unnamed renderer";
131  itkWarningMacro(<< "Created unnamed renderer. Bad for serialization. Please choose a name.");
132  }
133 
134  if (renWin != nullptr)
135  {
136  m_RenderWindow = renWin;
137  m_RenderWindow->Register(nullptr);
138  }
139  else
140  {
141  itkWarningMacro(<< "Created mitkBaseRenderer without vtkRenderWindow present.");
142  }
143  // instances.insert( this );
144 
145  // adding this BaseRenderer to the List of all BaseRenderer
146 
147  m_BindDispatcherInteractor = new mitk::BindDispatcherInteractor(GetName());
148 
149  WeakPointerProperty::Pointer rendererProp = WeakPointerProperty::New((itk::Object *)this);
150 
151  m_CurrentWorldPlaneGeometry = mitk::PlaneGeometry::New();
152 
154  m_CurrentWorldPlaneGeometryData->SetPlaneGeometry(m_CurrentWorldPlaneGeometry);
157  m_CurrentWorldPlaneGeometryNode->GetPropertyList()->SetProperty("renderer", rendererProp);
158  m_CurrentWorldPlaneGeometryNode->GetPropertyList()->SetProperty("layer", IntProperty::New(1000));
159 
160  m_CurrentWorldPlaneGeometryNode->SetProperty("reslice.thickslices", mitk::ResliceMethodProperty::New());
161  m_CurrentWorldPlaneGeometryNode->SetProperty("reslice.thickslices.num", mitk::IntProperty::New(1));
162 
164 
166  sliceNavigationController->SetRenderer(this);
167  sliceNavigationController->ConnectGeometrySliceEvent(this);
168  sliceNavigationController->ConnectGeometryUpdateEvent(this);
169  sliceNavigationController->ConnectGeometryTimeEvent(this, false);
170  m_SliceNavigationController = sliceNavigationController;
171 
173  m_CameraRotationController->SetRenderWindow(m_RenderWindow);
174  m_CameraRotationController->AcquireCamera();
175 
177  m_CameraController->SetRenderer(this);
178 
179  m_VtkRenderer = vtkRenderer::New();
180  m_VtkRenderer->SetMaximumNumberOfPeels(16);
181 
183  m_VtkRenderer->UseFXAAOn();
184 
187 
189 }
190 
192 {
193  if (m_VtkRenderer != nullptr)
194  {
195  m_VtkRenderer->Delete();
196  m_VtkRenderer = nullptr;
197  }
198 
199  if (m_CameraController.IsNotNull())
200  m_CameraController->SetRenderer(nullptr);
201 
203 
205 
206  m_DataStorage = nullptr;
207 
208  if (m_BindDispatcherInteractor != nullptr)
209  {
210  delete m_BindDispatcherInteractor;
211  }
212 
213  if (m_RenderWindow != nullptr)
214  {
215  m_RenderWindow->Delete();
216  m_RenderWindow = nullptr;
217  }
218 }
219 
221 {
222  if (m_MapperID != id)
223  {
224  bool useDepthPeeling = Standard3D == id;
225  m_VtkRenderer->SetUseDepthPeeling(useDepthPeeling);
226  m_VtkRenderer->SetUseDepthPeelingForVolumes(useDepthPeeling);
227 
228  m_MapperID = id;
229  this->Modified();
230  }
231 }
232 
234 {
235  this->InvokeEvent(mitk::BaseRenderer::RendererResetEvent());
236 
237  std::list<mitk::BaseLocalStorageHandler *>::iterator it;
238  for (it = m_RegisteredLocalStorageHandlers.begin(); it != m_RegisteredLocalStorageHandlers.end(); ++it)
239  (*it)->ClearLocalStorage(this, false);
241 }
242 
244 {
245  m_RegisteredLocalStorageHandlers.push_back(lsh);
246 }
247 
249 {
250  return m_BindDispatcherInteractor->GetDispatcher();
251 }
252 
254 {
256 }
257 
259 {
260  if (storage != m_DataStorage && storage != nullptr)
261  {
262  m_DataStorage = storage;
263  m_BindDispatcherInteractor->SetDataStorage(m_DataStorage);
264  this->Modified();
265  }
266 }
267 
269 
271 {
272 }
273 
275 {
276 }
277 
278 void mitk::BaseRenderer::Resize(int w, int h)
279 {
280  this->m_RenderWindow->SetSize(w, h);
281 }
282 
283 void mitk::BaseRenderer::InitRenderer(vtkRenderWindow *renderwindow)
284 {
285  if (m_RenderWindow != renderwindow)
286  {
287  if (m_RenderWindow != nullptr)
288  {
289  m_RenderWindow->Delete();
290  }
291  m_RenderWindow = renderwindow;
292  if (m_RenderWindow != nullptr)
293  {
294  m_RenderWindow->Register(nullptr);
295  }
296  }
298 
299  if (m_CameraController.IsNotNull())
300  {
301  m_CameraController->SetRenderer(this);
302  }
303 }
304 
306 {
307  this->m_RenderWindow->SetSize(w, h);
308 }
309 
310 void mitk::BaseRenderer::SetSlice(unsigned int slice)
311 {
312  if (m_Slice != slice)
313  {
314  m_Slice = slice;
315  if (m_WorldTimeGeometry.IsNotNull())
316  {
317  // get world geometry which may be rotated, for the current time step
318  SlicedGeometry3D *slicedWorldGeometry =
319  dynamic_cast<SlicedGeometry3D *>(m_WorldTimeGeometry->GetGeometryForTimeStep(m_TimeStep).GetPointer());
320  if (slicedWorldGeometry != nullptr)
321  {
322  // if slice position is part of the world geometry...
323  if (m_Slice >= slicedWorldGeometry->GetSlices())
324  // set the current worldplanegeomety as the selected 2D slice of the world geometry
325  m_Slice = slicedWorldGeometry->GetSlices() - 1;
326  SetCurrentWorldPlaneGeometry(slicedWorldGeometry->GetPlaneGeometry(m_Slice));
327  SetCurrentWorldGeometry(slicedWorldGeometry);
328  }
329  }
330  else
331  Modified();
332  }
333 }
334 
335 void mitk::BaseRenderer::SetTimeStep(unsigned int timeStep)
336 {
337  if (m_TimeStep != timeStep)
338  {
339  m_TimeStep = timeStep;
340  m_TimeStepUpdateTime.Modified();
341 
342  if (m_WorldTimeGeometry.IsNotNull())
343  {
344  if (m_TimeStep >= m_WorldTimeGeometry->CountTimeSteps())
345  m_TimeStep = m_WorldTimeGeometry->CountTimeSteps() - 1;
346  SlicedGeometry3D *slicedWorldGeometry =
347  dynamic_cast<SlicedGeometry3D *>(m_WorldTimeGeometry->GetGeometryForTimeStep(m_TimeStep).GetPointer());
348  if (slicedWorldGeometry != nullptr)
349  {
350  SetCurrentWorldPlaneGeometry(slicedWorldGeometry->GetPlaneGeometry(m_Slice));
351  SetCurrentWorldGeometry(slicedWorldGeometry);
352  }
353  }
354  else
355  Modified();
356  }
357 }
358 
360 {
361  if ((data == nullptr) || (data->IsInitialized() == false))
362  {
363  return -1;
364  }
365  return data->GetTimeGeometry()->TimePointToTimeStep(GetTime());
366 }
367 
369 {
370  if (m_WorldTimeGeometry.IsNull())
371  {
372  return 0;
373  }
374  else
375  {
376  ScalarType timeInMS = m_WorldTimeGeometry->TimeStepToTimePoint(GetTimeStep());
377  if (timeInMS == itk::NumericTraits<mitk::ScalarType>::NonpositiveMin())
378  return 0;
379  else
380  return timeInMS;
381  }
382 }
383 
385 {
386  assert(geometry != nullptr);
387 
388  itkDebugMacro("setting WorldTimeGeometry to " << geometry);
389  if (m_WorldTimeGeometry != geometry)
390  {
391  if (geometry->GetBoundingBoxInWorld()->GetDiagonalLength2() == 0)
392  return;
393 
394  m_WorldTimeGeometry = geometry;
395  itkDebugMacro("setting WorldTimeGeometry to " << m_WorldTimeGeometry);
396 
397  if (m_TimeStep >= m_WorldTimeGeometry->CountTimeSteps())
398  m_TimeStep = m_WorldTimeGeometry->CountTimeSteps() - 1;
399 
400  BaseGeometry *geometry3d;
401  geometry3d = m_WorldTimeGeometry->GetGeometryForTimeStep(m_TimeStep);
402  SetWorldGeometry3D(geometry3d);
403  }
404 }
405 
407 {
408  itkDebugMacro("setting WorldGeometry3D to " << geometry);
409 
410  if (geometry->GetBoundingBox()->GetDiagonalLength2() == 0)
411  return;
412  const SlicedGeometry3D *slicedWorldGeometry;
413  slicedWorldGeometry = dynamic_cast<const SlicedGeometry3D *>(geometry);
414 
415  PlaneGeometry::ConstPointer geometry2d;
416  if (slicedWorldGeometry != nullptr)
417  {
418  if (m_Slice >= slicedWorldGeometry->GetSlices() && (m_Slice != 0))
419  m_Slice = slicedWorldGeometry->GetSlices() - 1;
420  geometry2d = slicedWorldGeometry->GetPlaneGeometry(m_Slice);
421  if (geometry2d.IsNull())
422  {
424  plane->InitializeStandardPlane(slicedWorldGeometry);
425  geometry2d = plane;
426  }
427  SetCurrentWorldGeometry(slicedWorldGeometry);
428  }
429  else
430  {
431  geometry2d = dynamic_cast<const PlaneGeometry *>(geometry);
432  if (geometry2d.IsNull())
433  {
435  plane->InitializeStandardPlane(geometry);
436  geometry2d = plane;
437  }
438  SetCurrentWorldGeometry(geometry);
439  }
440  SetCurrentWorldPlaneGeometry(geometry2d); // calls Modified()
441 
442  if (m_CurrentWorldPlaneGeometry.IsNull())
443  itkWarningMacro("m_CurrentWorldPlaneGeometry is nullptr");
444 }
445 
447 {
448  if (m_CurrentWorldPlaneGeometry != geometry2d)
449  {
450  m_CurrentWorldPlaneGeometry = geometry2d->Clone();
451  m_CurrentWorldPlaneGeometryData->SetPlaneGeometry(m_CurrentWorldPlaneGeometry);
452  m_CurrentWorldPlaneGeometryUpdateTime.Modified();
453  Modified();
454  }
455 }
456 
458 {
459  m_CurrentWorldPlaneGeometryUpdateTime.Modified();
460 }
461 
463 {
464  return this->m_RenderWindow->GetSize();
465 }
466 
468 {
469  return this->m_VtkRenderer->GetSize();
470 }
471 
473 {
474  m_CurrentWorldGeometry = geometry;
475  if (geometry == nullptr)
476  {
477  m_Bounds[0] = 0;
478  m_Bounds[1] = 0;
479  m_Bounds[2] = 0;
480  m_Bounds[3] = 0;
481  m_Bounds[4] = 0;
482  m_Bounds[5] = 0;
483  m_EmptyWorldGeometry = true;
484  return;
485  }
486  BoundingBox::Pointer boundingBox = m_CurrentWorldGeometry->CalculateBoundingBoxRelativeToTransform(nullptr);
487  const BoundingBox::BoundsArrayType &worldBounds = boundingBox->GetBounds();
488  m_Bounds[0] = worldBounds[0];
489  m_Bounds[1] = worldBounds[1];
490  m_Bounds[2] = worldBounds[2];
491  m_Bounds[3] = worldBounds[3];
492  m_Bounds[4] = worldBounds[4];
493  m_Bounds[5] = worldBounds[5];
494  if (boundingBox->GetDiagonalLength2() <= mitk::eps)
495  m_EmptyWorldGeometry = true;
496  else
497  m_EmptyWorldGeometry = false;
498 }
499 
500 void mitk::BaseRenderer::SetGeometry(const itk::EventObject &geometrySendEvent)
501 {
502  const auto *sendEvent =
503  dynamic_cast<const SliceNavigationController::GeometrySendEvent *>(&geometrySendEvent);
504 
505  assert(sendEvent != nullptr);
506  SetWorldTimeGeometry(sendEvent->GetTimeGeometry());
507 }
508 
509 void mitk::BaseRenderer::UpdateGeometry(const itk::EventObject &geometryUpdateEvent)
510 {
511  const auto *updateEvent =
512  dynamic_cast<const SliceNavigationController::GeometryUpdateEvent *>(&geometryUpdateEvent);
513 
514  if (updateEvent == nullptr)
515  return;
516 
517  if (m_CurrentWorldGeometry.IsNotNull())
518  {
519  auto *slicedWorldGeometry = dynamic_cast<const SlicedGeometry3D *>(m_CurrentWorldGeometry.GetPointer());
520  if (slicedWorldGeometry)
521  {
522  PlaneGeometry *geometry2D = slicedWorldGeometry->GetPlaneGeometry(m_Slice);
523 
524  SetCurrentWorldPlaneGeometry(geometry2D); // calls Modified()
525  }
526  }
527 }
528 
529 void mitk::BaseRenderer::SetGeometrySlice(const itk::EventObject &geometrySliceEvent)
530 {
531  const auto *sliceEvent =
532  dynamic_cast<const SliceNavigationController::GeometrySliceEvent *>(&geometrySliceEvent);
533 
534  assert(sliceEvent != nullptr);
535  SetSlice(sliceEvent->GetPos());
536 }
537 
538 void mitk::BaseRenderer::SetGeometryTime(const itk::EventObject &geometryTimeEvent)
539 {
540  const auto *timeEvent =
541  dynamic_cast<const SliceNavigationController::GeometryTimeEvent *>(&geometryTimeEvent);
542 
543  assert(timeEvent != nullptr);
544  SetTimeStep(timeEvent->GetPos());
545 }
546 
547 const double *mitk::BaseRenderer::GetBounds() const
548 {
549  return m_Bounds;
550 }
551 
553 {
554  MITK_INFO << "BaseRenderer::DrawOverlayMouse()- should be inconcret implementation OpenGLRenderer." << std::endl;
555 }
556 
558 {
561 }
562 
564 {
566 }
567 
569 {
571 }
572 
577 {
578  if (SlicenavigationController == nullptr)
579  return;
580 
581  // copy worldgeometry
582  SlicenavigationController->SetInputWorldTimeGeometry(SlicenavigationController->GetCreatedWorldGeometry());
583  SlicenavigationController->Update();
584 
585  // set new
586  m_SliceNavigationController = SlicenavigationController;
587  m_SliceNavigationController->SetRenderer(this);
588 
589  if (m_SliceNavigationController.IsNotNull())
590  {
591  m_SliceNavigationController->ConnectGeometrySliceEvent(this);
592  m_SliceNavigationController->ConnectGeometryUpdateEvent(this);
593  m_SliceNavigationController->ConnectGeometryTimeEvent(this, false);
594  }
595 }
596 
597 void mitk::BaseRenderer::DisplayToWorld(const Point2D &displayPoint, Point3D &worldIndex) const
598 {
600  {
601  double display[3], *world;
602 
603  // For the rigth z-position in display coordinates, take the focal point, convert it to display and use it for
604  // correct depth.
605  double *displayCoord;
606  double cameraFP[4];
607  // Get camera focal point and position. Convert to display (screen)
608  // coordinates. We need a depth value for z-buffer.
609  this->GetVtkRenderer()->GetActiveCamera()->GetFocalPoint(cameraFP);
610  cameraFP[3] = 0.0;
611  this->GetVtkRenderer()->SetWorldPoint(cameraFP[0], cameraFP[1], cameraFP[2], cameraFP[3]);
612  this->GetVtkRenderer()->WorldToDisplay();
613  displayCoord = this->GetVtkRenderer()->GetDisplayPoint();
614 
615  // now convert the display point to world coordinates
616  display[0] = displayPoint[0];
617  display[1] = displayPoint[1];
618  display[2] = displayCoord[2];
619 
620  this->GetVtkRenderer()->SetDisplayPoint(display);
621  this->GetVtkRenderer()->DisplayToWorld();
622  world = this->GetVtkRenderer()->GetWorldPoint();
623 
624  for (int i = 0; i < 3; i++)
625  {
626  worldIndex[i] = world[i] / world[3];
627  }
628  }
630  {
632  displayPoint,
633  worldIndex); // Seems to be the same code as above, but subclasses may contain different implementations.
634  }
635 
636  return;
637 }
638 
639 void mitk::BaseRenderer::DisplayToPlane(const Point2D &displayPoint, Point2D &planePointInMM) const
640 {
642  {
643  Point3D worldPoint;
644  this->DisplayToWorld(displayPoint, worldPoint);
645  this->m_CurrentWorldPlaneGeometry->Map(worldPoint, planePointInMM);
646  }
648  {
649  MITK_WARN << "No conversion possible with 3D mapper.";
650  return;
651  }
652 
653  return;
654 }
655 
656 void mitk::BaseRenderer::WorldToDisplay(const Point3D &worldIndex, Point2D &displayPoint) const
657 {
658  double world[4], *display;
659 
660  world[0] = worldIndex[0];
661  world[1] = worldIndex[1];
662  world[2] = worldIndex[2];
663  world[3] = 1.0;
664 
665  this->GetVtkRenderer()->SetWorldPoint(world);
666  this->GetVtkRenderer()->WorldToDisplay();
667  display = this->GetVtkRenderer()->GetDisplayPoint();
668 
669  displayPoint[0] = display[0];
670  displayPoint[1] = display[1];
671 
672  return;
673 }
674 
675 void mitk::BaseRenderer::WorldToView(const mitk::Point3D &worldIndex, mitk::Point2D &viewPoint) const
676 {
677  double world[4], *view;
678 
679  world[0] = worldIndex[0];
680  world[1] = worldIndex[1];
681  world[2] = worldIndex[2];
682  world[3] = 1.0;
683 
684  this->GetVtkRenderer()->SetWorldPoint(world);
685  this->GetVtkRenderer()->WorldToView();
686  view = this->GetVtkRenderer()->GetViewPoint();
687  this->GetVtkRenderer()->ViewToNormalizedViewport(view[0], view[1], view[2]);
688 
689  viewPoint[0] = view[0] * this->GetViewportSize()[0];
690  viewPoint[1] = view[1] * this->GetViewportSize()[1];
691 
692  return;
693 }
694 
695 void mitk::BaseRenderer::PlaneToDisplay(const Point2D &planePointInMM, Point2D &displayPoint) const
696 {
697  Point3D worldPoint;
698  this->m_CurrentWorldPlaneGeometry->Map(planePointInMM, worldPoint);
699  this->WorldToDisplay(worldPoint, displayPoint);
700 
701  return;
702 }
703 
704 void mitk::BaseRenderer::PlaneToView(const Point2D &planePointInMM, Point2D &viewPoint) const
705 {
706  Point3D worldPoint;
707  this->m_CurrentWorldPlaneGeometry->Map(planePointInMM, worldPoint);
708  this->WorldToView(worldPoint,viewPoint);
709 
710  return;
711 }
712 
714 {
715  if (this->GetMapperID() == BaseRenderer::Standard2D)
716  {
717  // GetParallelScale returns half of the height of the render window in mm.
718  // Divided by the half size of the Display size in pixel givest the mm per pixel.
719  return this->GetVtkRenderer()->GetActiveCamera()->GetParallelScale() * 2.0 / GetViewportSize()[1];
720  }
721  else
722  return 1.0;
723 }
724 
726 {
727  Point2D dispSizeInMM;
728  dispSizeInMM[0] = GetSizeX() * GetScaleFactorMMPerDisplayUnit();
729  dispSizeInMM[1] = GetSizeY() * GetScaleFactorMMPerDisplayUnit();
730  return dispSizeInMM;
731 }
732 
734 {
735  Point2D dispSizeInMM;
736  dispSizeInMM[0] = GetViewportSize()[0] * GetScaleFactorMMPerDisplayUnit();
737  dispSizeInMM[1] = GetViewportSize()[1] * GetScaleFactorMMPerDisplayUnit();
738  return dispSizeInMM;
739 }
740 
742 {
743  Point2D originPx;
744  originPx[0] = m_VtkRenderer->GetOrigin()[0];
745  originPx[1] = m_VtkRenderer->GetOrigin()[1];
746  Point2D displayGeometryOriginInMM;
747  DisplayToPlane(originPx, displayGeometryOriginInMM); // top left of the render window (Origin)
748  return displayGeometryOriginInMM;
749 }
750 
752 {
753  m_ConstrainZoomingAndPanning = constrain;
755  {
757  }
758 }
759 
761 {
762  // DEPRECATED: Map2DRendererPositionTo3DWorldPosition is deprecated. use DisplayToWorldInstead
763  Point3D position;
764  DisplayToWorld(mousePosition, position);
765  return position;
766 }
767 
768 void mitk::BaseRenderer::PrintSelf(std::ostream &os, itk::Indent indent) const
769 {
770  os << indent << " MapperID: " << m_MapperID << std::endl;
771  os << indent << " Slice: " << m_Slice << std::endl;
772  os << indent << " TimeStep: " << m_TimeStep << std::endl;
773 
774  os << indent << " CurrentWorldPlaneGeometry: ";
775  if (m_CurrentWorldPlaneGeometry.IsNull())
776  os << "nullptr" << std::endl;
777  else
778  m_CurrentWorldPlaneGeometry->Print(os, indent);
779 
780  os << indent << " CurrentWorldPlaneGeometryUpdateTime: " << m_CurrentWorldPlaneGeometryUpdateTime << std::endl;
781  os << indent << " CurrentWorldPlaneGeometryTransformTime: " << m_CurrentWorldPlaneGeometryTransformTime << std::endl;
782 
783  Superclass::PrintSelf(os, indent);
784 }
std::map< vtkRenderWindow *, BaseRenderer * > BaseRendererMapType
PlaneGeometryData::Pointer m_CurrentWorldPlaneGeometryData
void DisplayToWorld(const Point2D &displayPoint, Point3D &worldIndex) const
This method converts a display point to the 3D world index using the geometry of the renderWindow...
virtual const mitk::TimeGeometry * GetCreatedWorldGeometry()
Access the created geometry.
ScalarType GetTime() const
Get the time in ms of the currently displayed content.
BaseRenderer(const char *name=nullptr, vtkRenderWindow *renWin=nullptr)
BoundingBox * GetBoundingBoxInWorld() const
Returns a bounding box that covers all time steps.
Data management class that handles &#39;was created by&#39; relations.
unsigned int GetNumberOfVisibleLODEnabledMappers() const
This Class is used to connect a DataStorage with the Dispatcher.
void SetSliceNavigationController(SliceNavigationController *SlicenavigationController)
static BaseRenderer * GetInstance(vtkRenderWindow *renWin)
static vtkRenderWindow * GetRenderWindowByName(const std::string &name)
#define MITK_INFO
Definition: mitkLogMacros.h:18
static Pointer New()
void InsertSceneRenderer(vtkSmartPointer< vtkRenderer > renderer)
Base of all data objects.
Definition: mitkBaseData.h:42
vtkRenderer * GetVtkRenderer() const
void SetInputWorldTimeGeometry(const mitk::TimeGeometry *geometry)
virtual void SetConstrainZoomingAndPanning(bool constrain)
double ScalarType
virtual void SetDataStorage(DataStorage *storage)
set the datastorage that will be used for rendering
Point2D GetDisplaySizeInMM() const
virtual void Resize(int w, int h)
Called to inform the renderer that the RenderWindow has been resized.
void PlaneToView(const Point2D &planePointInMM, Point2D &viewPoint) const
This method converts a 2D plane coordinate to the point on the viewport using the geometry of the ren...
Organizes the rendering process.
virtual void SetWorldTimeGeometry(const mitk::TimeGeometry *geometry)
double GetScaleFactorMMPerDisplayUnit() const
virtual unsigned int GetSlices() const
Get the number of slices.
std::list< mitk::BaseLocalStorageHandler * > m_RegisteredLocalStorageHandlers
virtual void SetTimeStep(unsigned int timeStep)
Set/Get m_TimeStep which defines together with m_Slice the 2D geometry stored in m_WorldTimeGeometry ...
Interface for accessing (templated) LocalStorageHandler instances.
void DisplayToPlane(const Point2D &displayPoint, Point2D &planePointInMM) const
This method converts a display point to the 2D world index, mapped onto the display plane using the g...
Pointer Clone() const
virtual void SetWorldGeometry3D(const BaseGeometry *geometry)
Set/Get the WorldGeometry (m_WorldGeometry) for 3D and 2D rendering, that describing the (maximal) ar...
static const MapperSlotId defaultMapper
Default mapper id to use.
Constants for most interaction classes, due to the generic StateMachines.
virtual int * GetSize() const
CameraRotationController::Pointer m_CameraRotationController
void PlaneToDisplay(const Point2D &planePointInMM, Point2D &displayPoint) const
This method converts a 2D plane coordinate to the display point using the geometry of the renderWindo...
unsigned long m_LastUpdateTime
Timestamp of last call of Update().
void WorldToDisplay(const Point3D &worldIndex, Point2D &displayPoint) const
This method converts a 3D world index to the display point using the geometry of the renderWindow...
Controls the selection of the slice the associated BaseRenderer will display.
static Pointer New()
static void AddInstance(vtkSmartPointer< vtkRenderWindow > renWin, vtkSmartPointer< vtkRenderer > mitkSceneRenderer)
virtual mitk::PlaneGeometry * GetPlaneGeometry(int s) const
Returns the PlaneGeometry of the slice (s).
void SetDataStorage(DataStorage::Pointer dataStorage)
virtual void SetGeometrySlice(const itk::EventObject &geometrySliceEvent)
SetSlice is called according to the geometrySliceEvent, which is supposed to be a SliceNavigationCont...
const double * GetBounds() const
virtual void UpdateGeometry(const itk::EventObject &geometrySliceEvent)
UpdateWorldGeometry is called to re-read the 2D geometry from the slice navigation controller...
int GetSizeX() const
get the x_size of the RendererWindow
static VtkLayerController * GetInstance(vtkSmartPointer< vtkRenderWindow > renWin)
const mitk::TimeGeometry * GetTimeGeometry() const
Return the TimeGeometry of the data as const pointer.
Definition: mitkBaseData.h:66
#define MITK_WARN
Definition: mitkLogMacros.h:19
virtual void SetSlice(unsigned int slice)
Set/Get m_Slice which defines together with m_TimeStep the 2D geometry stored in m_WorldTimeGeometry ...
int MapperSlotId
MapperSlotId defines which kind of mapper (e.g. 2D or 3D) should be used.
static Pointer New()
static RenderingManager * GetInstance()
virtual unsigned int GetTimeStep() const
virtual TimeStepType TimePointToTimeStep(TimePointType timePoint) const =0
Converts a time point to the corresponding time step.
virtual CameraController * GetCameraController()
static BaseRendererMapType baseRendererMap
virtual void InitSize(int w, int h)
Set the initial size. Called by RenderWindow after it has become visible for the first time...
unsigned long m_CurrentWorldPlaneGeometryTransformTime
test only
virtual MapperSlotId GetMapperID()
Get the MapperSlotId to use.
vtkRenderer * m_VtkRenderer
vtkRenderWindow * m_RenderWindow
virtual int * GetViewportSize() const
virtual void SetGeometry(const itk::EventObject &geometrySliceEvent)
SetWorldGeometry is called according to the geometrySliceEvent, which is supposed to be a SliceNaviga...
void ForceImmediateUpdate(vtkRenderWindow *renderWindow)
virtual void Paint()
Do the rendering and flush the result.
static Pointer New()
virtual void SetMapperID(MapperSlotId id)
Set the MapperSlotId to use.
unsigned int m_NumberOfVisibleLODEnabledMappers
Describes the geometry of a data object consisting of slices.
virtual void PickWorldPoint(const Point2D &diplayPosition, Point3D &worldPosition) const =0
Perform a picking: find the x,y,z world coordinate of a display x,y coordinate.
void RequestUpdate(vtkRenderWindow *renderWindow)
static Pointer New()
DataStorage::Pointer m_DataStorage
The DataStorage that is used for rendering.
void PrintSelf(std::ostream &os, itk::Indent indent) const override
virtual bool IsInitialized() const
Check whether the data has been initialized, i.e., at least the Geometry and other header data has be...
Dispatcher::Pointer GetDispatcher() const
Returns the Dispatcher which handles Events for this BaseRenderer.
Point2D GetOriginInMM() const
virtual void SetGeometryTime(const itk::EventObject &geometryTimeEvent)
SetTimeStep is called according to the geometrySliceEvent, which is supposed to be a SliceNavigationC...
static Pointer New()
void RegisterLocalStorageHandler(mitk::BaseLocalStorageHandler *lsh)
virtual void Initialize()
Initialize the RenderWindow. Should only be called from RenderWindow.
static BaseRenderer * GetByName(const std::string &name)
MITKCORE_EXPORT const ScalarType eps
virtual void SetCurrentWorldPlaneGeometry(const PlaneGeometry *geometry2d)
Sets m_CurrentWorldPlaneGeometry.
Point2D GetViewportSizeInMM() const
Describes a two-dimensional, rectangular plane.
DataNode::Pointer m_CurrentWorldPlaneGeometryNode
static void RemoveInstance(vtkRenderWindow *renWin)
itk::SmartPointer< CameraController > m_CameraController
CameraController for 3D rendering.
void AdjustCameraToPlane()
AdjustCameraToPlane Moves the camera of a 2D Renderwindow without panning or zooming, eg. only rotate the camera.
MapperSlotId m_MapperID
MapperSlotId to use. Defines which kind of mapper (e.g., 2D or 3D) shoud be used. ...
virtual void Update()
Do the actual creation and send it to the connected observers (renderers)
void WorldToView(const Point3D &worldIndex, Point2D &viewPoint) const
This method converts a 3D world index to the point on the viewport using the geometry of the renderWi...
virtual Point3D Map2DRendererPositionTo3DWorldPosition(const Point2D &mousePosition) const
Provides (1) world coordinates for a given mouse position and (2) translates mousePosition to Display...
SliceNavigationController::Pointer m_SliceNavigationController
void SendUpdateSlice()
Sets timestamp of CurrentWorldPlaneGeometry and forces so reslicing in that renderwindow.
static void AddInstance(vtkRenderWindow *renWin, BaseRenderer *baseRenderer)
virtual void SetCurrentWorldGeometry(const BaseGeometry *geometry)
Sets m_CurrentWorldGeometry.
virtual void InitRenderer(vtkRenderWindow *renderwindow)
Initialize the renderer with a RenderWindow (renderwindow).
BaseGeometry Describes the geometry of a data object.
const char * GetName() const
get the name of the Renderer
int GetSizeY() const
get the y_size of the RendererWindow
static void RemoveInstance(vtkSmartPointer< vtkRenderWindow > renWin)
BoundingBoxType::BoundsArrayType BoundsArrayType
berry::Display * display
[MinimalApplicationClass_StartMethod]
virtual void DrawOverlayMouse(Point2D &p2d)
Draws a point on the widget. Should be used during conferences to show the position of the remote mou...
virtual const BoundingBoxType * GetBoundingBox()
void UnregisterLocalStorageHandler(mitk::BaseLocalStorageHandler *lsh)