ctkVTKSliceView.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /*=========================================================================
  2. Library: CTK
  3. Copyright (c) 2010 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(bool renderEnabled READ renderEnabled WRITE setRenderEnabled)
  38. Q_PROPERTY(double ColorLevel READ colorLevel WRITE setColorLevel)
  39. Q_PROPERTY(double ColorWindow READ colorWindow WRITE setColorWindow)
  40. public:
  41. /// Constructors
  42. typedef QWidget Superclass;
  43. explicit ctkVTKSliceView(QWidget* parent = 0);
  44. virtual ~ctkVTKSliceView();
  45. /// The layout type determines how the image slices should be displayed
  46. /// within the different render view items.
  47. /// \sa setRenderWindowLayout() renderWindowLayoutType()
  48. enum RenderWindowLayoutType{LeftRightTopBottom = 0, LeftRightBottomTop};
  49. /// Return if rendering is enabled
  50. bool renderEnabled() const;
  51. /// Convenient method to get the underlying RenderWindow
  52. vtkRenderWindow* renderWindow() const;
  53. /// Get lightBoxRendererManager
  54. vtkLightBoxRendererManager* lightBoxRendererManager() const;
  55. /// Set/Get window interactor
  56. vtkRenderWindowInteractor* interactor() const;
  57. void setInteractor(vtkRenderWindowInteractor* newInteractor);
  58. /// Get current interactor style
  59. vtkInteractorObserver* interactorStyle()const;
  60. /// Get corner annotation text
  61. /// \sa setCornerAnnotationText();
  62. QString cornerAnnotationText()const;
  63. /// Get background color
  64. /// \sa setBackgroundColor();
  65. QColor backgroundColor()const;
  66. /// Get renderWindow layout type
  67. /// \sa setRenderWindowLayoutType();
  68. RenderWindowLayoutType renderWindowLayoutType()const;
  69. /// Get color level
  70. double colorLevel()const;
  71. /// Get color window
  72. double colorWindow()const;
  73. public slots:
  74. /// If a render has already been scheduled, this called is a no-op
  75. void scheduleRender();
  76. /// Force a render even if a render is already ocurring
  77. void forceRender();
  78. /// Reset cameras associated with all renderWindowItem
  79. void resetCamera();
  80. /// Set image data
  81. void setImageData(vtkImageData* newImageData);
  82. /// Set corner annotation \a text
  83. void setCornerAnnotationText(const QString& text);
  84. /// Set background color
  85. void setBackgroundColor(const QColor& newBackgroundColor);
  86. /// Enable/Disable rendering
  87. void setRenderEnabled(bool value);
  88. /// Set RenderWindow layout type
  89. void setRenderWindowLayoutType(RenderWindowLayoutType layoutType);
  90. /// Set color level
  91. void setColorLevel(double newColorLevel);
  92. /// Set color window
  93. void setColorWindow(double newColorWindow);
  94. /// Change the number of row of the associated lightBox
  95. /// \sa lightBoxRendererManager()
  96. void setLightBoxRendererManagerRowCount(int newRowCount);
  97. /// Change the number of column of the associated lightBox
  98. /// \sa lightBoxRendererManager()
  99. void setLightBoxRendererManagerColumnCount(int newColumnCount);
  100. signals:
  101. void resized(const QSize& size, const QSize& oldSize);
  102. protected:
  103. virtual void resizeEvent(QResizeEvent * event);
  104. private:
  105. CTK_DECLARE_PRIVATE(ctkVTKSliceView);
  106. };
  107. #endif