ctkVTKSliceView.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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.commontk.org/LICENSE
  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. // Qt includes
  17. #include <QWidget>
  18. // CTK includes
  19. #include <ctkPimpl.h>
  20. #include "ctkVisualizationVTKWidgetsExport.h"
  21. class ctkVTKSliceViewPrivate;
  22. class vtkLightBoxRendererManager;
  23. class vtkInteractorObserver;
  24. class vtkRenderWindowInteractor;
  25. class vtkRenderWindow;
  26. class vtkRenderer;
  27. class vtkCamera;
  28. class vtkImageData;
  29. class vtkCornerAnnotation;
  30. class CTK_VISUALIZATION_VTK_WIDGETS_EXPORT ctkVTKSliceView : public QWidget
  31. {
  32. Q_OBJECT
  33. Q_ENUMS(RenderWindowLayoutType)
  34. Q_PROPERTY(RenderWindowLayoutType renderWindowLayoutType
  35. READ renderWindowLayoutType WRITE setRenderWindowLayoutType)
  36. Q_PROPERTY(QString cornerAnnotationText READ cornerAnnotationText WRITE setCornerAnnotationText)
  37. Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor)
  38. Q_PROPERTY(QColor highlightedBoxColor READ highlightedBoxColor WRITE setHighlightedBoxColor)
  39. Q_PROPERTY(bool renderEnabled READ renderEnabled WRITE setRenderEnabled)
  40. Q_PROPERTY(double colorLevel READ colorLevel WRITE setColorLevel)
  41. Q_PROPERTY(double colorWindow READ colorWindow WRITE setColorWindow)
  42. public:
  43. /// Constructors
  44. typedef QWidget Superclass;
  45. explicit ctkVTKSliceView(QWidget* parent = 0);
  46. virtual ~ctkVTKSliceView();
  47. /// The layout type determines how the image slices should be displayed
  48. /// within the different render view items.
  49. /// \sa setRenderWindowLayout() renderWindowLayoutType()
  50. enum RenderWindowLayoutType{LeftRightTopBottom = 0, LeftRightBottomTop};
  51. /// Return if rendering is enabled
  52. bool renderEnabled() const;
  53. /// Convenient method to get the underlying RenderWindow
  54. vtkRenderWindow* renderWindow() const;
  55. /// Set active camera
  56. void setActiveCamera(vtkCamera * newActiveCamera);
  57. /// Get lightBoxRendererManager
  58. vtkLightBoxRendererManager* lightBoxRendererManager() const;
  59. /// Get overlay renderer
  60. vtkRenderer* overlayRenderer() const;
  61. /// Set/Get window interactor
  62. vtkRenderWindowInteractor* interactor() const;
  63. void setInteractor(vtkRenderWindowInteractor* newInteractor);
  64. /// Get current interactor style
  65. vtkInteractorObserver* interactorStyle()const;
  66. /// Get corner annotation text
  67. /// \sa setCornerAnnotationText();
  68. QString cornerAnnotationText()const;
  69. /// Get corner annotation actor
  70. /// This is the corner annotation associated with all renderers managed
  71. /// by the lightBoxManager
  72. /// \sa vtkLightBoxRendererManager::GetCornerAnnotation()
  73. vtkCornerAnnotation * cornerAnnotation()const;
  74. /// Get overlay corner annotation actor
  75. /// This corresponds to the cornerAnnotation associated added in the single overlay renderer
  76. vtkCornerAnnotation* overlayCornerAnnotation()const;
  77. /// Get background color
  78. /// \sa setBackgroundColor();
  79. QColor backgroundColor()const;
  80. /// Get highlightedBox color
  81. /// \sa setHighlightedBoxColor();
  82. QColor highlightedBoxColor()const;
  83. /// Get renderWindow layout type
  84. /// \sa setRenderWindowLayoutType();
  85. RenderWindowLayoutType renderWindowLayoutType()const;
  86. /// Get color level
  87. /// \sa setColorLevel();
  88. double colorLevel()const;
  89. /// Get color window
  90. /// \sa setColorWindow();
  91. double colorWindow()const;
  92. public slots:
  93. /// If a render has already been scheduled, this called is a no-op
  94. void scheduleRender();
  95. /// Force a render even if a render is already ocurring
  96. void forceRender();
  97. /// Reset cameras associated with all renderWindowItem
  98. /// \sa vtkLightBoxRendererManager::ResetCamera
  99. void resetCamera();
  100. /// Set image data
  101. /// \sa vtkLightBoxRendererManager::SetImageData
  102. void setImageData(vtkImageData* newImageData);
  103. /// Set corner annotation \a text
  104. /// \sa vtkLightBoxRendererManager::SetCornerAnnotationText
  105. void setCornerAnnotationText(const QString& text);
  106. /// Set background color
  107. /// \sa vtkLightBoxRendererManager::SetBackgroundColor
  108. void setBackgroundColor(const QColor& newBackgroundColor);
  109. /// Set highlightedBox color
  110. /// \sa vtkLightBoxRendererManager::SetHighlightedBoxColor
  111. void setHighlightedBoxColor(const QColor& newHighlightedBoxColor);
  112. /// Enable/Disable rendering
  113. void setRenderEnabled(bool value);
  114. /// Set RenderWindow layout type
  115. /// \sa vtkLightBoxRendererManager::SetRenderWindowLayoutType
  116. void setRenderWindowLayoutType(RenderWindowLayoutType layoutType);
  117. /// Set color level
  118. /// \sa vtkLightBoxRendererManager::SetColorLevel
  119. void setColorLevel(double newColorLevel);
  120. /// Set color window
  121. /// \sa vtkLightBoxRendererManager::SetColorWindow
  122. void setColorWindow(double newColorWindow);
  123. /// Change the number of row of the associated lightBox
  124. /// \sa lightBoxRendererManager()
  125. /// \sa vtkLightBoxRendererManager::SetRenderWindowRowCount
  126. void setLightBoxRendererManagerRowCount(int newRowCount);
  127. /// Change the number of column of the associated lightBox
  128. /// \sa lightBoxRendererManager()
  129. /// \sa vtkLightBoxRendererManager::SetRenderWindowColumnCount
  130. void setLightBoxRendererManagerColumnCount(int newColumnCount);
  131. signals:
  132. void resized(const QSize& size, const QSize& oldSize);
  133. protected:
  134. virtual void resizeEvent(QResizeEvent * event);
  135. protected:
  136. QScopedPointer<ctkVTKSliceViewPrivate> d_ptr;
  137. private:
  138. Q_DECLARE_PRIVATE(ctkVTKSliceView);
  139. Q_DISABLE_COPY(ctkVTKSliceView);
  140. };
  141. #endif