ctkVTKSliceView_p.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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_p_h
  15. #define __ctkVTKSliceView_p_h
  16. // Qt includes
  17. #include <QObject>
  18. #include <QColor>
  19. #include <QList>
  20. #include <QSharedPointer>
  21. // CTK includes
  22. #include <ctkPimpl.h>
  23. #include <ctkVTKObject.h>
  24. #include "ctkVTKSliceView.h"
  25. // VTK includes
  26. #include <QVTKWidget.h>
  27. #include <vtkAxesActor.h>
  28. #include <vtkCornerAnnotation.h>
  29. #include <vtkRenderer.h>
  30. #include <vtkRenderWindow.h>
  31. #include <vtkSmartPointer.h>
  32. #include <vtkWeakPointer.h>
  33. #include <vtkImageMapper.h>
  34. #include <vtkOrientationMarkerWidget.h>
  35. class vtkRenderWindowInteractor;
  36. //-----------------------------------------------------------------------------
  37. /// A RenderWindow can be split in 1x1, 2x3, ... grid view, each element of that grid
  38. /// will be identified as RenderWindowItem
  39. class RenderWindowItem
  40. {
  41. public:
  42. RenderWindowItem(const QColor& rendererBackgroundColor, double colorWindow, double colorLevel);
  43. void setViewport(double xMin, double yMin, double viewportWidth, double viewportHeight);
  44. /// Create the actor supporing the image mapper
  45. void setupImageMapperActor(double colorWindow, double colorLevel);
  46. /// Create a box around the renderer.
  47. void setupHighlightBoxActor(bool visible = false);
  48. vtkSmartPointer<vtkRenderer> Renderer;
  49. vtkSmartPointer<vtkImageMapper> ImageMapper;
  50. vtkSmartPointer<vtkActor2D> HighlightBoxActor;
  51. };
  52. //-----------------------------------------------------------------------------
  53. class ctkVTKSliceViewPrivate : public QObject,
  54. public ctkPrivate<ctkVTKSliceView>
  55. {
  56. Q_OBJECT
  57. CTK_DECLARE_PUBLIC(ctkVTKSliceView);
  58. public:
  59. ctkVTKSliceViewPrivate();
  60. /// Convenient setup methods
  61. void setupCornerAnnotation();
  62. void setupRendering();
  63. void setupDefaultInteractor();
  64. /// Update render window ImageMapper Z slice according to \a layoutType
  65. void updateRenderWindowItemsZIndex(ctkVTKSliceView::RenderWindowLayoutType layoutType);
  66. QVTKWidget* VTKWidget;
  67. vtkSmartPointer<vtkRenderWindow> RenderWindow;
  68. bool RenderPending;
  69. bool RenderEnabled;
  70. int RenderWindowRowCount;
  71. int RenderWindowColumnCount;
  72. ctkVTKSliceView::RenderWindowLayoutType RenderWindowLayoutType;
  73. vtkSmartPointer<vtkAxesActor> Axes;
  74. vtkSmartPointer<vtkOrientationMarkerWidget> Orientation;
  75. vtkSmartPointer<vtkCornerAnnotation> CornerAnnotation;
  76. vtkWeakPointer<vtkRenderWindowInteractor> CurrentInteractor;
  77. QList<QSharedPointer<RenderWindowItem> > RenderWindowItemList;
  78. vtkWeakPointer<vtkImageData> ImageData;
  79. double ColorWindow;
  80. double ColorLevel;
  81. QColor RendererBackgroundColor;
  82. };
  83. #endif