GOFIGURE2  0.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
QGoImageView3D.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 
35 #ifndef __QGoImageView3D_h
36 #define __QGoImageView3D_h
37 
38 #include "QGoImageView.h"
39 #include "SnapshotHelper.h"
40 
41 #include <QtCore/QVariant>
42 #include <QtGui/QAction>
43 #include <QtGui/QApplication>
44 #include <QtGui/QButtonGroup>
45 #include <QtGui/QGridLayout>
46 #include <QSplitter>
47 #include <QSlider>
48 
49 #include <map>
50 
52 #include "QGoGUILibConfigure.h"
53 
54 #include "vtkCommand.h"
55 
56 class QVTKWidget;
57 class vtkEventQtSlotConnect;
58 class QSplitterChild;
59 
60 class vtkProp3D;
61 class vtkProperty;
62 class vtkImageData;
63 class vtkViewImage2D;
64 class vtkViewImage3D;
66 
67 // For the box widget
69 
70 // For the plane widget
71 class vtkImplicitPlaneWidget;
72 
73 // volumre rendering
74 class vtkPiecewiseFunction;
75 
81 class QGOGUILIB_EXPORT QGoImageView3D:public QGoImageView
82 {
83  Q_OBJECT
84 public:
86  explicit QGoImageView3D(QWidget *parent = 0);
87 
89  virtual ~QGoImageView3D();
90 
91  void Update();
92 
93  vtkViewImage3D * GetImageViewer3D();
94 
95  QVTKInteractor * GetInteractor(const int &);
96 
98  virtual void SetImage(vtkImageData *iImage);
99 
100  virtual void RemoveActor(const int & iId, vtkActor *iActor);
101 
102  virtual void AddActor(const int & iId, vtkActor *iActor);
103 
104 // std::vector< vtkQuadricLODActor* >
105  std::vector< vtkActor * > AddContour(vtkPolyData *iDataset,
106  vtkProperty *iProperty = NULL);
107 
108  virtual void setupUi(QWidget *parent);
109 
110  virtual void retranslateUi(QWidget *parent);
111 
112  int GetFullScreenView() const;
113 
114  void SaveStateSplitters();
115 
116  int GetSliceViewXY() const;
117 
118  int GetSliceViewXZ() const;
119 
120  int GetSliceViewYZ() const;
121 
122  // MODES
126  void DefaultMode();
127 
131  void ZoomMode();
132 
136  void PanMode();
137 
141  void ActorPickingMode();
142 
143  // WIDGETS
147  void EnableSeedWidget(bool iActivate);
148 
152  void EnableBoxWidget(bool);
153 
157  void EnablePlaneWidget(bool);
158 
162  vtkProp * GetPickedActor();
163 
164  vtkActor * GetCurrentActor();
165 
166  bool GetCurrentState();
167 
168  void ChangeCursorShape(QCursor iCursorShape);
169 
170 signals:
171  void SliceViewXYChanged(int Slice);
172 
173  void SliceViewXZChanged(int Slice);
174 
175  void SliceViewYZChanged(int Slice);
176 
177  void FullScreenViewChanged(int View);
178 
179  void SelectionChanged();
180 
181  void VisibilityChanged();
182 
183  void CurrentActorUpdated();
184 
185  void UpdateRenderEvent();
186 
187  void NewWindowLevel(double, double);
188 
189 public slots:
190  QString SnapshotViewXY( const GoFigure::FileType & iType,
191  const QString & iBaseName = QString("snapshot-xy-") );
192 
193  QString SnapshotViewXZ( const GoFigure::FileType & iType,
194  const QString & iBaseName = QString("snapshot-xz-") );
195 
196  QString SnapshotViewYZ( const GoFigure::FileType & iType,
197  const QString & iBaseName = QString("snapshot-yz") );
198 
199  QString SnapshotViewXYZ( const GoFigure::FileType & iType,
200  const QString & iBaseName = QString("snapshot-xyz-") );
201 
202  void SetSliceViewXY(const int &);
203 
204  void SetSliceViewXZ(const int &);
205 
206  void SetSliceViewYZ(const int &);
207 
208  void SetFullScreenView(const int & iS);
209 
210  void SetCamera(int);
211 
212  void UpdateLUT();
213 
214  void ShowSplinePlane();
215 
216  void ShowCube3D();
217 
221  void EnableVolumeRendering(const std::vector<vtkImageData*>& iImages,
222  const std::vector<vtkPiecewiseFunction*>& iOpacities);
223 
224  void DisableVolumeRendering();
225 
226  void UpdateCurrentActorSelection(vtkObject *caller);
227 
228  void UpdateCurrentActorVisibility(vtkObject *caller);
229 
230  virtual void SetLookupTable(vtkLookupTable *);
231 
232  virtual void ShowScalarBar(const bool &);
233 
234  /*
235  * \brief Synchronize the views
236  * \param[in] iSynchronize Enable/disable synchronization
237  */
238  void SynchronizeViews( bool iSynchronize);
239 
240  /*
241  * \brief Show/hide the planes in the 3d view
242  * \param[in] iSynchronize Enable/disable synchronization
243  */
244  void ShowPlanes( bool iShow);
245 
246 protected:
250 
254  QVTKWidget * QvtkWidget_XY;
255 
259  QVTKWidget * QvtkWidget_XZ;
260 
264  QVTKWidget * QvtkWidget_YZ;
265 
268  QVTKWidget * QvtkWidget_XYZ;
269 
271 
272  vtkEventQtSlotConnect *VtkEventQtConnector;
274 
278 
280 
282  vtkImplicitPlaneWidget *m_PlaneWidget;
283 
284  vtkActor *m_CurrentActor;
286 
287  virtual void resizeEvent(QResizeEvent *event);
288 
289  void SetupVTKtoQtConnections();
290 
291  void UpdateOnFirstRender();
292 
293  void Quadview();
294 
295  void FullScreenViewXY();
296 
297  void FullScreenViewXZ();
298 
299  void FullScreenViewYZ();
300 
301  void FullScreenViewXYZ();
302 
303  void InitializeBoxWidget();
304 
305  void InitializePlaneWidget();
306 
307 protected slots:
308  void MoveSliderXY();
309 
310  void MoveSliderXZ();
311 
312  void MoveSliderYZ();
313 
314 private:
315  Q_DISABLE_COPY(QGoImageView3D);
316 };
317 
318 #endif
QWidget * LayOutWidget3
in the QSplitter class, the method moveSplitter is protected, so it is not possible to use connect be...
QSplitterChild * HtSplitter
virtual void AddActor(const int &iId, vtkActor *iActor)
void ShowScalarBar(const bool &)
Show/hide the scalar bar in the collection.
QSlider * SliderYZ
QHBoxLayout * LayOut3
void PanMode()
Use the pan interactor style.
QSplitterChild * HbSplitter
QSlider * SliderXY
void SetLookupTable(vtkLookupTable *iLut)
Set the lookup table in the collection.
virtual void setupUi(QWidget *parent)=0
vtkViewImage3D * m_View3D
virtual void SetImage(vtkImageData *iImage)=0
Set the image to displaid.
class for the visualization of 3D Image represented by one vtkImageData*.
Abstract class for the visualization of 3D Image represented by one vtkImageData*.
Definition: QGoImageView.h:75
void ZoomMode()
Use the zoom interactor style.
QHBoxLayout * LayOut1
Manage a collection of 2D views.
QVTKWidget * QvtkWidget_XZ
orthogonal hexahedron 3D widget with pre-defined orientation
virtual void ChangeCursorShape(QCursor iCursorShape)=0
Basic class to handle items such as images and polydatas visualization in 3D.
vtkImplicitPlaneWidget * m_PlaneWidget
QVTKWidget * QvtkWidget_YZ
void EnableSeedWidget(bool iEnable)
QSplitter * VSplitter
QSlider * SliderXZ
QWidget * LayOutWidget2
vtkActor * m_CurrentActor
QVTKWidget * QvtkWidget_XYZ
virtual std::vector< vtkActor * > AddContour(vtkPolyData *iDataset, vtkProperty *iProperty=NULL)
Add contour with given property into the visualization.
void ShowSplinePlane()
Invert visibility of the Spline Plane.
QHBoxLayout * LayOut2
virtual QVTKInteractor * GetInteractor(const int &)=0
Returns the interactor for one given view.
vtkOrientedBoxWidget * m_BoxWidget
vtkProperty * m_HighlightedContourProperty
virtual void resizeEvent(QResizeEvent *event)
QWidget * LayOutWidget4
QWidget * LayOutWidget1
QHBoxLayout * LayOut4
virtual void retranslateUi(QWidget *parent)=0
virtual void RemoveActor(const int &iId, vtkActor *iActor)
QVTKWidget * QvtkWidget_XY
void DefaultMode()
Use the default interactor style.
vtkEventQtSlotConnect * VtkEventQtConnector
Basic class to handle 2D/3D items such as images and polydatas visualization in 2D.