vtkLightBoxRendererManager.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. #ifndef __vtkLightBoxRendererManager_h
  2. #define __vtkLightBoxRendererManager_h
  3. #include <vtkObject.h>
  4. #include "ctkVisualizationVTKCoreExport.h"
  5. class vtkRenderWindow;
  6. class vtkRenderer;
  7. class vtkImageData;
  8. class vtkCamera;
  9. class vtkCornerAnnotation;
  10. class CTK_VISUALIZATION_VTK_CORE_EXPORT vtkLightBoxRendererManager : public vtkObject
  11. {
  12. vtkTypeRevisionMacro(vtkLightBoxRendererManager,vtkObject);
  13. void PrintSelf(ostream& os, vtkIndent indent);
  14. static vtkLightBoxRendererManager *New();
  15. void Initialize(vtkRenderWindow* renderWindow);
  16. bool IsInitialized();
  17. /// Set the layer associated with the renderers
  18. /// \note By default, the value is 0
  19. /// \sa vtkRenderer::SetLayer
  20. void SetRendererLayer(int newLayer);
  21. /// Get associated RenderWindow
  22. vtkRenderWindow* GetRenderWindow();
  23. /// Set image data
  24. void SetImageData(vtkImageData* newImageData);
  25. vtkImageData* GetImageData()const;
  26. /// Get active camera
  27. /// Note that the same camera is used with all the renderWindowItem
  28. vtkCamera* GetActiveCamera();
  29. /// Set actice camera
  30. void SetActiveCamera(vtkCamera* newActiveCamera);
  31. /// Reset cameras associated with all renderWindowItem
  32. void ResetCamera();
  33. /// Return number of underlying render window Item
  34. /// \note In the current implementation
  35. int GetRenderWindowItemCount();
  36. /// Get a reference to the associated vtkRenderer(s) identified by its \a id
  37. vtkRenderer* GetRenderer(int id);
  38. /// Get a reference to the associated vtkRenderer(s) given its position in the grid
  39. /// \sa GetRenderer(int)
  40. vtkRenderer* GetRenderer(int rowId, int columnId);
  41. /// The layout type determines how the image slices should be displayed
  42. /// within the different render view items.
  43. /// \sa SetRenderWindowLayout() GetRenderWindowLayoutType()
  44. enum RenderWindowLayoutType{LeftRightTopBottom = 0, LeftRightBottomTop};
  45. /// Get current layout type
  46. int GetRenderWindowLayoutType() const;
  47. /// Set current \a layoutType
  48. void SetRenderWindowLayoutType(int layoutType);
  49. /// Split the current vtkRenderWindow in \a rowCount per \a columnCount grid
  50. void SetRenderWindowLayout(int rowCount, int columnCount);
  51. /// Set the \a rowCount
  52. /// \sa SetRenderWindowLayout
  53. void SetRenderWindowRowCount(int newRowCount);
  54. /// Get number of rows
  55. /// \sa SetRenderWindowLayout
  56. int GetRenderWindowRowCount();
  57. /// Set the \a columnCount
  58. /// \sa SetRenderWindowLayout
  59. void SetRenderWindowColumnCount(int newColumnCount);
  60. /// Get number of columns
  61. /// \sa SetRenderWindowLayout
  62. int GetRenderWindowColumnCount();
  63. /// Return True if the render view item identified by \a id is highlighted
  64. bool GetHighlightedById(int id);
  65. /// \brief Return True if the render view item identified by its position in the grid
  66. /// is highlighted
  67. /// \sa GetHighlightedById(int)
  68. bool GetHighlighted(int rowId, int columnId);
  69. /// Highlight / Unhighlight a render view item given its \a id
  70. void SetHighlightedById(int id, bool highlighted);
  71. /// Highlight / Unhighlight a render view item given its position in the grid
  72. /// \sa setHighlighted(int, bool)
  73. void SetHighlighted(int rowId, int columnId, bool highlighted);
  74. /// \sa SetHighlighted SetHighlightedBoxColorById
  75. void SetHighlightedBoxColor(double highlightedBoxColor[3]);
  76. /// \brief Set the color of the box displayed around the highlighted item
  77. /// identified by \a id
  78. /// The highlightedBox is set with a width of 3 screen units.
  79. /// \sa SetHighlightedById SetHighlighted vtkProperty2D::SetLineWidth
  80. double* GetHighlightedBoxColor()const;
  81. /// Convenient function allowing to compute the renderWindowItemId
  82. /// given \a rowId and \a columnId.
  83. /// The following formula is used: ColumnCount * rowId + columnId
  84. /// \note The \a rowCount and \a columnCount correspond to the one set
  85. /// using setRenderWindowLayout.
  86. inline int ComputeRenderWindowItemId(int rowId, int columnId);
  87. /// Set corner annotation \a text
  88. void SetCornerAnnotationText(const std::string& text);
  89. /// Get current corner annotation
  90. const std::string GetCornerAnnotationText()const;
  91. /// Get corner annotation actor
  92. /// The same annotation is associated with all renderers managed by the light box
  93. vtkCornerAnnotation * GetCornerAnnotation()const;
  94. void SetCornerAnnotation(vtkCornerAnnotation* annotation);
  95. /// Set background color
  96. void SetBackgroundColor(const double newBackgroundColor[3]);
  97. /// Get background color
  98. double* GetBackgroundColor()const;
  99. /// Set color level
  100. void SetColorLevel(double colorLevel);
  101. /// Get color level
  102. double GetColorLevel()const;
  103. /// Set color window
  104. void SetColorWindow(double colorWindow);
  105. /// Get color window
  106. double GetColorWindow()const;
  107. /// Set color Window and color level
  108. void SetColorWindowAndLevel(double colorWindow, double colorLevel);
  109. protected:
  110. vtkLightBoxRendererManager();
  111. ~vtkLightBoxRendererManager();
  112. private:
  113. vtkLightBoxRendererManager(const vtkLightBoxRendererManager&); // Not implemented.
  114. void operator=(const vtkLightBoxRendererManager&); // Not implemented.
  115. //BTX
  116. class vtkInternal;
  117. vtkInternal* Internal;
  118. //ETX
  119. };
  120. #endif