vtkLightBoxRendererManager.h 5.8 KB

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