UsTK : Ultrasound ToolKit  version 2.0.1 under development (2024-05-17)
us3DSceneSlicing.h
1 /****************************************************************************
2  *
3  * This file is part of the ustk software.
4  * Copyright (C) 2016 - 2017 by Inria. All rights reserved.
5  *
6  * This software is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * ("GPL") version 2 as published by the Free Software Foundation.
9  * See the file LICENSE.txt at the root directory of this source
10  * distribution for additional information about the GNU GPL.
11  *
12  * For using ustk with software that can not be combined with the GNU
13  * GPL, please contact Inria about acquiring a ViSP Professional
14  * Edition License.
15  *
16  * This software was developed at:
17  * Inria Rennes - Bretagne Atlantique
18  * Campus Universitaire de Beaulieu
19  * 35042 Rennes Cedex
20  * France
21  *
22  * If you have questions regarding the use of this file, please contact
23  * Inria at ustk@inria.fr
24  *
25  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
26  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27  *
28  * Authors:
29  * Marc Pouliquen
30  *
31  *****************************************************************************/
32 
38 #ifndef __us3DSceneSlicing_h_
39 #define __us3DSceneSlicing_h_
40 
41 // VISP includes
42 #include <visp3/ustk_core/usConfig.h>
43 
44 #ifdef USTK_HAVE_VTK_QT
45 
46 // USTK includes
47 
48 #include <visp3/ustk_core/usImageIo.h>
49 #include <visp3/ustk_gui/us3DSceneWidget.h>
50 
51 // VTK includes
52 #include <vtkDistanceWidget.h>
53 #include <vtkImageMapper3D.h>
54 #include <vtkImagePlaneWidget.h>
55 #include <vtkPlane.h>
56 #include <vtkResliceImageViewer.h>
57 #include <vtkResliceImageViewerMeasurements.h>
58 #include <vtkSmartPointer.h>
59 
60 // Qt includes
61 #if defined(USTK_HAVE_VTK_QT4)
62 #include <QtGui/QApplication>
63 #include <QtGui/QGridLayout>
64 #include <QtGui/QMainWindow>
65 #include <QtGui/QPushButton>
66 #include <QtGui/QSlider>
67 #elif defined(USTK_HAVE_VTK_QT5)
68 #include <QtWidgets/QApplication>
69 #include <QtWidgets/QGridLayout>
70 #include <QtWidgets/QMainWindow>
71 #include <QtWidgets/QPushButton>
72 #include <QtWidgets/QSlider>
73 #endif
74 
81 class VISP_EXPORT us3DSceneSlicing : public QMainWindow
82 {
83  Q_OBJECT
84 public:
85  // Constructor/Destructor
86  us3DSceneSlicing(std::string imageFileName);
88 
89  void resizeEvent(QResizeEvent *event);
90 
91 public slots:
92  void updateX(int x);
93  void updateY(int y);
94  void updateZ(int z);
95 
96  void updateRotX(int rx);
97  void updateRotY(int ry);
98  void updateRotZ(int rz);
99 
100  virtual void ResetViews();
101  virtual void Render();
102  virtual void slotExit();
103 
104 private:
105  void setupUi();
106 
107  QWidget *centralwidget;
108  QWidget *gridLayoutWidget;
109  QGridLayout *gridLayout_2;
110  us3DSceneWidget *view;
111 
112  // plane 1 modifiers
113  // translations
114  QSlider *sliderXplane1;
115  QSlider *sliderYplane1;
116  QSlider *sliderZplane1;
117  // rotations
118  QSlider *rotXplane1;
119  QSlider *rotYplane1;
120  QSlider *rotZplane1;
121 
122  // VTK planes
123  vtkPlane *plane1;
124  vtkPlane *plane2;
125  vtkPlane *plane3;
126 
127  // transformation
128  vtkMatrix4x4 *vtkMatrix1;
129  vtkMatrix4x4 *vtkMatrix2;
130  vtkMatrix4x4 *vtkMatrix3;
131 
132  // image
133  usImagePostScan3D<unsigned char> postScanImage;
134  vtkSmartPointer<vtkImageData> vtkImage;
135 };
136 #endif
137 #endif // __us3DSceneSlicing_h_
Graphical main window to move a plane in a 3D view using QSliders for origin and normal components.
Class used to render a 3D vtk scene containing a vtkImageData in a QWidget (based on QVTKWidget).