ctkVTKSliceView.h 5.6 KB

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