ctkVTKSliceView.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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 background color
  65. /// \sa setBackgroundColor();
  66. QColor backgroundColor()const;
  67. /// Get highlightedBox color
  68. /// \sa setHighlightedBoxColor();
  69. QColor highlightedBoxColor()const;
  70. /// Get renderWindow layout type
  71. /// \sa setRenderWindowLayoutType();
  72. RenderWindowLayoutType renderWindowLayoutType()const;
  73. /// Get color level
  74. /// \sa setColorLevel();
  75. double colorLevel()const;
  76. /// Get color window
  77. /// \sa setColorWindow();
  78. double colorWindow()const;
  79. public slots:
  80. /// If a render has already been scheduled, this called is a no-op
  81. void scheduleRender();
  82. /// Force a render even if a render is already ocurring
  83. void forceRender();
  84. /// Reset cameras associated with all renderWindowItem
  85. /// \sa vtkLightBoxRendererManager::ResetCamera
  86. void resetCamera();
  87. /// Set image data
  88. /// \sa vtkLightBoxRendererManager::SetImageData
  89. void setImageData(vtkImageData* newImageData);
  90. /// Set corner annotation \a text
  91. /// \sa vtkLightBoxRendererManager::SetCornerAnnotationText
  92. void setCornerAnnotationText(const QString& text);
  93. /// Set background color
  94. /// \sa vtkLightBoxRendererManager::SetBackgroundColor
  95. void setBackgroundColor(const QColor& newBackgroundColor);
  96. /// Set highlightedBox color
  97. /// \sa vtkLightBoxRendererManager::SetHighlightedBoxColor
  98. void setHighlightedBoxColor(const QColor& newHighlightedBoxColor);
  99. /// Enable/Disable rendering
  100. void setRenderEnabled(bool value);
  101. /// Set RenderWindow layout type
  102. /// \sa vtkLightBoxRendererManager::SetRenderWindowLayoutType
  103. void setRenderWindowLayoutType(RenderWindowLayoutType layoutType);
  104. /// Set color level
  105. /// \sa vtkLightBoxRendererManager::SetColorLevel
  106. void setColorLevel(double newColorLevel);
  107. /// Set color window
  108. /// \sa vtkLightBoxRendererManager::SetColorWindow
  109. void setColorWindow(double newColorWindow);
  110. /// Change the number of row of the associated lightBox
  111. /// \sa lightBoxRendererManager()
  112. /// \sa vtkLightBoxRendererManager::SetRenderWindowRowCount
  113. void setLightBoxRendererManagerRowCount(int newRowCount);
  114. /// Change the number of column of the associated lightBox
  115. /// \sa lightBoxRendererManager()
  116. /// \sa vtkLightBoxRendererManager::SetRenderWindowColumnCount
  117. void setLightBoxRendererManagerColumnCount(int newColumnCount);
  118. signals:
  119. void resized(const QSize& size, const QSize& oldSize);
  120. protected:
  121. virtual void resizeEvent(QResizeEvent * event);
  122. protected:
  123. QScopedPointer<ctkVTKSliceViewPrivate> d_ptr;
  124. private:
  125. Q_DECLARE_PRIVATE(ctkVTKSliceView);
  126. Q_DISABLE_COPY(ctkVTKSliceView);
  127. };
  128. #endif