ctkVTKSliceView.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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 __ctkVTKSliceView_h
  15. #define __ctkVTKSliceView_h
  16. // CTK includes
  17. #include "ctkVTKAbstractView.h"
  18. #include "vtkVersion.h"
  19. class vtkLightBoxRendererManager;
  20. class ctkVTKSliceViewPrivate;
  21. class vtkCamera;
  22. class vtkImageData;
  23. class vtkRenderer;
  24. class vtkAlgorithmOutput;
  25. /// \ingroup Visualization_VTK_Widgets
  26. /// Specific implementation for a 2D view that supports lightbox display.
  27. /// \note There is no support for gradient background yet.
  28. class CTK_VISUALIZATION_VTK_WIDGETS_EXPORT ctkVTKSliceView : public ctkVTKAbstractView
  29. {
  30. Q_OBJECT
  31. Q_ENUMS(RenderWindowLayoutType)
  32. Q_PROPERTY(RenderWindowLayoutType renderWindowLayoutType
  33. READ renderWindowLayoutType WRITE setRenderWindowLayoutType)
  34. Q_PROPERTY(QColor highlightedBoxColor READ highlightedBoxColor WRITE setHighlightedBoxColor)
  35. Q_PROPERTY(double colorLevel READ colorLevel WRITE setColorLevel)
  36. Q_PROPERTY(double colorWindow READ colorWindow WRITE setColorWindow)
  37. public:
  38. /// Constructors
  39. typedef ctkVTKAbstractView Superclass;
  40. explicit ctkVTKSliceView(QWidget* parent = 0);
  41. virtual ~ctkVTKSliceView();
  42. /// The layout type determines how the image slices should be displayed
  43. /// within the different render view items.
  44. /// \sa setRenderWindowLayout() renderWindowLayoutType()
  45. enum RenderWindowLayoutType{LeftRightTopBottom = 0, LeftRightBottomTop};
  46. /// Set active camera
  47. void setActiveCamera(vtkCamera * newActiveCamera);
  48. /// Get lightBoxRendererManager
  49. Q_INVOKABLE vtkLightBoxRendererManager* lightBoxRendererManager() const;
  50. /// Get overlay renderer
  51. vtkRenderer* overlayRenderer() const;
  52. /// Get overlay corner annotation actor
  53. /// This corresponds to the cornerAnnotation associated added in the single overlay renderer
  54. vtkCornerAnnotation* overlayCornerAnnotation()const;
  55. /// Set background color
  56. /// \sa vtkLightBoxRendererManager::SetBackgroundColor
  57. virtual void setBackgroundColor(const QColor& newBackgroundColor);
  58. /// Get background color
  59. /// \sa setBackgroundColor();
  60. virtual QColor backgroundColor()const;
  61. /// Get highlightedBox color
  62. /// \sa setHighlightedBoxColor();
  63. QColor highlightedBoxColor()const;
  64. /// Get renderWindow layout type
  65. /// \sa setRenderWindowLayoutType();
  66. RenderWindowLayoutType renderWindowLayoutType()const;
  67. /// Get color level
  68. /// \sa setColorLevel();
  69. double colorLevel()const;
  70. /// Get color window
  71. /// \sa setColorWindow();
  72. double colorWindow()const;
  73. public Q_SLOTS:
  74. /// Reset cameras associated with all renderWindowItem
  75. /// \sa vtkLightBoxRendererManager::ResetCamera
  76. void resetCamera();
  77. /// Set image data
  78. /// \sa vtkLightBoxRendererManager::SetImageData
  79. #if (VTK_MAJOR_VERSION <= 5)
  80. void setImageData(vtkImageData* newImageData);
  81. #else
  82. void setImageDataConnection(vtkAlgorithmOutput* newImageDataPort);
  83. #endif
  84. /// Set highlightedBox color
  85. /// \sa vtkLightBoxRendererManager::SetHighlightedBoxColor
  86. void setHighlightedBoxColor(const QColor& newHighlightedBoxColor);
  87. /// Set RenderWindow layout type
  88. /// \sa vtkLightBoxRendererManager::SetRenderWindowLayoutType
  89. void setRenderWindowLayoutType(RenderWindowLayoutType layoutType);
  90. /// Set color level
  91. /// \sa vtkLightBoxRendererManager::SetColorLevel
  92. void setColorLevel(double newColorLevel);
  93. /// Set color window
  94. /// \sa vtkLightBoxRendererManager::SetColorWindow
  95. void setColorWindow(double newColorWindow);
  96. /// Change the number of row of the associated lightBox
  97. /// \sa lightBoxRendererManager()
  98. /// \sa vtkLightBoxRendererManager::SetRenderWindowRowCount
  99. void setLightBoxRendererManagerRowCount(int newRowCount);
  100. /// Change the number of column of the associated lightBox
  101. /// \sa lightBoxRendererManager()
  102. /// \sa vtkLightBoxRendererManager::SetRenderWindowColumnCount
  103. void setLightBoxRendererManagerColumnCount(int newColumnCount);
  104. Q_SIGNALS:
  105. void resized(const QSize& size);
  106. protected:
  107. virtual bool eventFilter(QObject *object, QEvent *event);
  108. private:
  109. Q_DECLARE_PRIVATE(ctkVTKSliceView);
  110. Q_DISABLE_COPY(ctkVTKSliceView);
  111. };
  112. #endif