ctkVTKSliceView.h 5.9 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.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. /// Get lightBoxRendererManager
  56. vtkLightBoxRendererManager* lightBoxRendererManager() const;
  57. /// Get overlay renderer
  58. vtkRenderer* overlayRenderer() const;
  59. /// Set/Get window interactor
  60. vtkRenderWindowInteractor* interactor() const;
  61. void setInteractor(vtkRenderWindowInteractor* newInteractor);
  62. /// Get current interactor style
  63. vtkInteractorObserver* interactorStyle()const;
  64. /// Get corner annotation text
  65. /// \sa setCornerAnnotationText();
  66. QString cornerAnnotationText()const;
  67. /// Get corner annotation actor
  68. /// This is the corner annotation associated with all renderers managed
  69. /// by the lightBoxManager
  70. /// \sa vtkLightBoxRendererManager::GetCornerAnnotation()
  71. vtkCornerAnnotation * cornerAnnotation()const;
  72. /// Get overlay corner annotation actor
  73. /// This corresponds to the cornerAnnotation associated added in the single overlay renderer
  74. vtkCornerAnnotation* overlayCornerAnnotation()const;
  75. /// Get background color
  76. /// \sa setBackgroundColor();
  77. QColor backgroundColor()const;
  78. /// Get highlightedBox color
  79. /// \sa setHighlightedBoxColor();
  80. QColor highlightedBoxColor()const;
  81. /// Get renderWindow layout type
  82. /// \sa setRenderWindowLayoutType();
  83. RenderWindowLayoutType renderWindowLayoutType()const;
  84. /// Get color level
  85. /// \sa setColorLevel();
  86. double colorLevel()const;
  87. /// Get color window
  88. /// \sa setColorWindow();
  89. double colorWindow()const;
  90. public slots:
  91. /// If a render has already been scheduled, this called is a no-op
  92. void scheduleRender();
  93. /// Force a render even if a render is already ocurring
  94. void forceRender();
  95. /// Reset cameras associated with all renderWindowItem
  96. /// \sa vtkLightBoxRendererManager::ResetCamera
  97. void resetCamera();
  98. /// Set image data
  99. /// \sa vtkLightBoxRendererManager::SetImageData
  100. void setImageData(vtkImageData* newImageData);
  101. /// Set corner annotation \a text
  102. /// \sa vtkLightBoxRendererManager::SetCornerAnnotationText
  103. void setCornerAnnotationText(const QString& text);
  104. /// Set background color
  105. /// \sa vtkLightBoxRendererManager::SetBackgroundColor
  106. void setBackgroundColor(const QColor& newBackgroundColor);
  107. /// Set highlightedBox color
  108. /// \sa vtkLightBoxRendererManager::SetHighlightedBoxColor
  109. void setHighlightedBoxColor(const QColor& newHighlightedBoxColor);
  110. /// Enable/Disable rendering
  111. void setRenderEnabled(bool value);
  112. /// Set RenderWindow layout type
  113. /// \sa vtkLightBoxRendererManager::SetRenderWindowLayoutType
  114. void setRenderWindowLayoutType(RenderWindowLayoutType layoutType);
  115. /// Set color level
  116. /// \sa vtkLightBoxRendererManager::SetColorLevel
  117. void setColorLevel(double newColorLevel);
  118. /// Set color window
  119. /// \sa vtkLightBoxRendererManager::SetColorWindow
  120. void setColorWindow(double newColorWindow);
  121. /// Change the number of row of the associated lightBox
  122. /// \sa lightBoxRendererManager()
  123. /// \sa vtkLightBoxRendererManager::SetRenderWindowRowCount
  124. void setLightBoxRendererManagerRowCount(int newRowCount);
  125. /// Change the number of column of the associated lightBox
  126. /// \sa lightBoxRendererManager()
  127. /// \sa vtkLightBoxRendererManager::SetRenderWindowColumnCount
  128. void setLightBoxRendererManagerColumnCount(int newColumnCount);
  129. signals:
  130. void resized(const QSize& size, const QSize& oldSize);
  131. protected:
  132. virtual void resizeEvent(QResizeEvent * event);
  133. protected:
  134. QScopedPointer<ctkVTKSliceViewPrivate> d_ptr;
  135. private:
  136. Q_DECLARE_PRIVATE(ctkVTKSliceView);
  137. Q_DISABLE_COPY(ctkVTKSliceView);
  138. };
  139. #endif