ctkVTKSliceView.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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.apache.org/licenses/LICENSE-2.0.txt
  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. // CTK includes
  17. #include "ctkVTKAbstractView.h"
  18. class vtkLightBoxRendererManager;
  19. class ctkVTKSliceViewPrivate;
  20. class vtkCamera;
  21. class vtkImageData;
  22. class vtkRenderer;
  23. /// Specific implementation for a 2D view that supports lightbox display.
  24. /// \note There is no support for gradient background yet.
  25. class CTK_VISUALIZATION_VTK_WIDGETS_EXPORT ctkVTKSliceView : public ctkVTKAbstractView
  26. {
  27. Q_OBJECT
  28. Q_ENUMS(RenderWindowLayoutType)
  29. Q_PROPERTY(RenderWindowLayoutType renderWindowLayoutType
  30. READ renderWindowLayoutType WRITE setRenderWindowLayoutType)
  31. Q_PROPERTY(QColor highlightedBoxColor READ highlightedBoxColor WRITE setHighlightedBoxColor)
  32. Q_PROPERTY(double colorLevel READ colorLevel WRITE setColorLevel)
  33. Q_PROPERTY(double colorWindow READ colorWindow WRITE setColorWindow)
  34. public:
  35. /// Constructors
  36. typedef ctkVTKAbstractView Superclass;
  37. explicit ctkVTKSliceView(QWidget* parent = 0);
  38. virtual ~ctkVTKSliceView();
  39. /// The layout type determines how the image slices should be displayed
  40. /// within the different render view items.
  41. /// \sa setRenderWindowLayout() renderWindowLayoutType()
  42. enum RenderWindowLayoutType{LeftRightTopBottom = 0, LeftRightBottomTop};
  43. /// Set active camera
  44. void setActiveCamera(vtkCamera * newActiveCamera);
  45. /// Get lightBoxRendererManager
  46. vtkLightBoxRendererManager* lightBoxRendererManager() const;
  47. /// Get overlay renderer
  48. vtkRenderer* overlayRenderer() const;
  49. /// Get overlay corner annotation actor
  50. /// This corresponds to the cornerAnnotation associated added in the single overlay renderer
  51. vtkCornerAnnotation* overlayCornerAnnotation()const;
  52. /// Set background color
  53. /// \sa vtkLightBoxRendererManager::SetBackgroundColor
  54. virtual void setBackgroundColor(const QColor& newBackgroundColor);
  55. /// Get background color
  56. /// \sa setBackgroundColor();
  57. virtual QColor backgroundColor()const;
  58. /// Get highlightedBox color
  59. /// \sa setHighlightedBoxColor();
  60. QColor highlightedBoxColor()const;
  61. /// Get renderWindow layout type
  62. /// \sa setRenderWindowLayoutType();
  63. RenderWindowLayoutType renderWindowLayoutType()const;
  64. /// Get color level
  65. /// \sa setColorLevel();
  66. double colorLevel()const;
  67. /// Get color window
  68. /// \sa setColorWindow();
  69. double colorWindow()const;
  70. public slots:
  71. /// Reset cameras associated with all renderWindowItem
  72. /// \sa vtkLightBoxRendererManager::ResetCamera
  73. void resetCamera();
  74. /// Set image data
  75. /// \sa vtkLightBoxRendererManager::SetImageData
  76. void setImageData(vtkImageData* newImageData);
  77. /// Set highlightedBox color
  78. /// \sa vtkLightBoxRendererManager::SetHighlightedBoxColor
  79. void setHighlightedBoxColor(const QColor& newHighlightedBoxColor);
  80. /// Set RenderWindow layout type
  81. /// \sa vtkLightBoxRendererManager::SetRenderWindowLayoutType
  82. void setRenderWindowLayoutType(RenderWindowLayoutType layoutType);
  83. /// Set color level
  84. /// \sa vtkLightBoxRendererManager::SetColorLevel
  85. void setColorLevel(double newColorLevel);
  86. /// Set color window
  87. /// \sa vtkLightBoxRendererManager::SetColorWindow
  88. void setColorWindow(double newColorWindow);
  89. /// Change the number of row of the associated lightBox
  90. /// \sa lightBoxRendererManager()
  91. /// \sa vtkLightBoxRendererManager::SetRenderWindowRowCount
  92. void setLightBoxRendererManagerRowCount(int newRowCount);
  93. /// Change the number of column of the associated lightBox
  94. /// \sa lightBoxRendererManager()
  95. /// \sa vtkLightBoxRendererManager::SetRenderWindowColumnCount
  96. void setLightBoxRendererManagerColumnCount(int newColumnCount);
  97. signals:
  98. void resized(const QSize& size);
  99. protected:
  100. virtual void resizeEvent(QResizeEvent * event);
  101. private:
  102. Q_DECLARE_PRIVATE(ctkVTKSliceView);
  103. Q_DISABLE_COPY(ctkVTKSliceView);
  104. };
  105. #endif