GOFIGURE2  0.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
QGoImageView.h
Go to the documentation of this file.
1 /*=========================================================================
2  Authors: The GoFigure Dev. Team.
3  at Megason Lab, Systems biology, Harvard Medical school, 2009-11
4 
5  Copyright (c) 2009-11, President and Fellows of Harvard College.
6  All rights reserved.
7 
8  Redistribution and use in source and binary forms, with or without
9  modification, are permitted provided that the following conditions are met:
10 
11  Redistributions of source code must retain the above copyright notice,
12  this list of conditions and the following disclaimer.
13  Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16  Neither the name of the President and Fellows of Harvard College
17  nor the names of its contributors may be used to endorse or promote
18  products derived from this software without specific prior written
19  permission.
20 
21  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
25  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
26  OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
27  OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
28  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
30  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 
33 =========================================================================*/
34 #ifndef __QGoImageView_h
35 #define __QGoImageView_h
36 
37 #include <QWidget>
38 #include "vtkSmartPointer.h"
39 
40 class vtkLookupTable;
41 class vtkImageData;
42 class vtkViewImage2D;
44 class vtkImageActor;
45 class vtkActor;
46 class vtkPolyData;
47 class vtkProperty;
48 class vtkProp3D;
49 class QVTKInteractor;
50 
51 // For the seed widget
52 #include "vtkPoints.h"
53 #include "vtkSeedRepresentation.h"
54 class vtkSeedWidget;
55 class vtkConstrainedPointHandleRepresentation;
56 class vtkImageActorPointPlacer;
57 
58 // For the distance widget...
59 class vtkDistanceWidget;
60 
61 // For the angle widget...
62 class vtkAngleWidget;
63 
64 // For the contour widget
65 class vtkContourWidget;
66 class vtkOrientedGlyphContourRepresentation;
67 class vtkDistanceRepresentation2D;
68 
69 #include "QGoGUILibConfigure.h"
70 
75 class QGOGUILIB_EXPORT QGoImageView:public QWidget
76 {
77  Q_OBJECT
78 public:
80  explicit QGoImageView(QWidget *parent = 0);
81 
83  virtual ~QGoImageView();
84 
86  virtual void SetImage(vtkImageData *iImage) = 0;
87 
89  vtkImageData * GetImage();
90 
92  int *GetImageCoordinatesFromWorldCoordinates(double pos[3]);
93 
94  void Update();
95 
96  void SetIntersectionLineWidth( const float& iWidth );
97 
99  virtual QVTKInteractor * GetInteractor(const int &) = 0;
100 
101  virtual void setupUi(QWidget *parent) = 0;
102 
103  virtual void retranslateUi(QWidget *parent) = 0;
104 
109  void GetBackgroundColor(double & r, double & g, double & b);
110 
112  double * GetBackgroundColor();
113 
119  vtkViewImage2D * GetImageViewer(const int & iId);
120 
121  int GetNumberOfImageViewers();
122 
123  virtual void RemoveActor(const int & iId, vtkActor *iActor);
124 
125  virtual void AddActor(const int & iId, vtkActor *iActor);
126 
127 // virtual std::vector< vtkQuadricLODActor* >
128 
136  virtual std::vector< vtkActor * > AddContour(vtkPolyData *iDataset,
137  vtkProperty *iProperty = NULL);
138 
142  void DefaultMode();
143 
147  void ZoomMode();
148 
152  void PanMode();
153 
157  void EnableContourPickingMode();
158 
162  void ResetWindowLevel();
163 
167  void SetLookupTable(vtkLookupTable *iLut);
168 
172  void ShowScalarBar(const bool &);
173 
177  vtkImageActor * GetImageActor(const int & iId);
178 
182  void ShowSplinePlane();
183 
187  void SetInterpolate(const int & val);
188 
189  virtual void ChangeCursorShape(QCursor iCursorShape) = 0;
190 
194  void InitializeDistanceWidget();
195 
196  void EnableDistanceWidget(bool iEnable);
197 
201  void InitializeAngleWidget();
202 
203  void EnableAngleWidget(bool iActive);
204 
208  void InitializeContourWidget();
209 
210  void EnableContourWidget(bool iActivate);
211 
212  void InitializeContourWidgetNodes(int iDir, vtkPolyData *iNodes);
213 
214  vtkPolyData * GetContourRepresentationAsPolydata(int iDir);
215 
216  vtkPolyData * GetContourRepresentationNodePolydata(int iDir);
217 
221  void InitializeSeedWidget();
222 
223  void EnableSeedWidget(bool iEnable);
224 
225  /*
226  * \brief Get seeds ordered by view in a vector
227  * \param iPoints vector of points containing the seeds
228  */
229  void GetSeeds( std::vector<vtkPoints*>& iPoints );
230 
231 public slots:
236  void SetBackgroundColor(const double & r,
237  const double & g,
238  const double & b);
239 
241  void SetBackgroundColor(double rgb[3]);
243  void SetBackgroundColor(const QColor & iColor);
244 
248  void ShowAnnotations();
249 
253  void ClearAllSeeds();
254 
255  void UpdateContourRepresentationProperties(float linewidth, QColor linecolor,
256  QColor nodecolor, QColor activenodecolor);
257 
258  void ReinitializeContourWidget();
259 
263  void UpdateRenderWindows();
264 
265 protected:
267  vtkImageData * m_Image;
268 
269  // Seed Widget specific members
270  std::vector< vtkSmartPointer< vtkSeedWidget > > m_SeedWidget;
271  std::vector< vtkSmartPointer< vtkConstrainedPointHandleRepresentation > > m_Handle;
272  std::vector< vtkSmartPointer< vtkSeedRepresentation > > m_SeedRep;
273 
274  // Distance Widget specific members
275  std::vector< vtkSmartPointer< vtkDistanceWidget > > m_DistanceWidget;
276 // std::vector< vtkSmartPointer< vtkDistanceRepresentation2D > >
277 // m_DistanceRepresentation;
278 
279  // Angle widget specific members
280  std::vector< vtkSmartPointer< vtkAngleWidget > > m_AngleWidget;
281 
282  // Contour Widget specific members
283  std::vector< vtkSmartPointer< vtkContourWidget > > m_ContourWidget;
284  std::vector< vtkSmartPointer< vtkOrientedGlyphContourRepresentation > > m_ContourRepresentation;
289 
291  unsigned int m_SnapshotId;
294 };
295 
296 #endif
void setupUi(QWidget *widget)
vtkImageData * m_Image
Definition: QGoImageView.h:267
QColor m_LinesColor
Definition: QGoImageView.h:286
Abstract class for the visualization of 3D Image represented by one vtkImageData*.
Definition: QGoImageView.h:75
Manage a collection of 2D views.
QColor m_NodesColor
Definition: QGoImageView.h:287
std::vector< vtkSmartPointer< vtkContourWidget > > m_ContourWidget
Definition: QGoImageView.h:283
bool m_ShowAnnotations
Definition: QGoImageView.h:292
bool m_ShowSplinePlane
Definition: QGoImageView.h:293
std::vector< vtkSmartPointer< vtkSeedWidget > > m_SeedWidget
Definition: QGoImageView.h:270
std::vector< vtkSmartPointer< vtkDistanceWidget > > m_DistanceWidget
Definition: QGoImageView.h:275
std::vector< vtkSmartPointer< vtkAngleWidget > > m_AngleWidget
Definition: QGoImageView.h:280
float m_LinesWidth
Definition: QGoImageView.h:285
unsigned int m_SnapshotId
Definition: QGoImageView.h:291
QColor m_ActiveNodesColor
Definition: QGoImageView.h:288
std::vector< vtkSmartPointer< vtkSeedRepresentation > > m_SeedRep
Definition: QGoImageView.h:272
std::vector< vtkSmartPointer< vtkConstrainedPointHandleRepresentation > > m_Handle
Definition: QGoImageView.h:271
float m_IntersectionLineWidth
Definition: QGoImageView.h:290
vtkViewImage2DCollection * m_Pool
Definition: QGoImageView.h:266
Basic class to handle 2D/3D items such as images and polydatas visualization in 2D.
std::vector< vtkSmartPointer< vtkOrientedGlyphContourRepresentation > > m_ContourRepresentation
Definition: QGoImageView.h:284