ctkVTKSliceView_p.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. class vtkRenderWindowInteractor;
  35. //-----------------------------------------------------------------------------
  36. /// A RenderWindow can be split in 1x1, 2x3, ... grid view, each element of that grid
  37. /// will be identified as RenderWindowItem
  38. class RenderWindowItem
  39. {
  40. public:
  41. RenderWindowItem(const QColor& rendererBackgroundColor, double colorWindow, double colorLevel);
  42. void setViewport(double xMin, double yMin, double viewportWidth, double viewportHeight);
  43. vtkSmartPointer<vtkRenderer> Renderer;
  44. vtkSmartPointer<vtkImageMapper> ImageMapper;
  45. };
  46. //-----------------------------------------------------------------------------
  47. class ctkVTKSliceViewPrivate : public QObject,
  48. public ctkPrivate<ctkVTKSliceView>
  49. {
  50. Q_OBJECT
  51. CTK_DECLARE_PUBLIC(ctkVTKSliceView);
  52. public:
  53. ctkVTKSliceViewPrivate();
  54. /// Convenient setup methods
  55. void setupCornerAnnotation();
  56. void setupRendering();
  57. void setupDefaultInteractor();
  58. /// Update render window ImageMapper Z slice according to \a layoutType
  59. void updateRenderWindowItemZIndex(ctkVTKSliceView::RenderWindowLayoutType layoutType);
  60. QVTKWidget* VTKWidget;
  61. vtkSmartPointer<vtkRenderWindow> RenderWindow;
  62. bool RenderPending;
  63. bool RenderEnabled;
  64. int RenderWindowRowCount;
  65. int RenderWindowColumnCount;
  66. ctkVTKSliceView::RenderWindowLayoutType RenderWindowLayoutType;
  67. vtkSmartPointer<vtkAxesActor> Axes;
  68. vtkSmartPointer<vtkCornerAnnotation> CornerAnnotation;
  69. vtkWeakPointer<vtkRenderWindowInteractor> CurrentInteractor;
  70. QList<QSharedPointer<RenderWindowItem> > RenderWindowItemList;
  71. vtkWeakPointer<vtkImageData> ImageData;
  72. double ColorWindow;
  73. double ColorLevel;
  74. QColor RendererBackgroundColor;
  75. };
  76. #endif