vtkLightBoxRendererManager.h 5.8 KB

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