ctkVTKSliceView.h 4.7 KB

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