UsTK : Ultrasound ToolKit  version 2.0.1 under development (2024-12-03)
usMedicalImageViewer.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 __usMedicalImageViewer_h_
39 #define __usMedicalImageViewer_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 #include <visp3/ustk_gui/usViewerWidget.h>
51 
52 // VTK includes
53 #include <vtkDistanceWidget.h>
54 #include <vtkImageMapper3D.h>
55 #include <vtkImagePlaneWidget.h>
56 #include <vtkPlane.h>
57 #include <vtkResliceImageViewer.h>
58 #include <vtkResliceImageViewerMeasurements.h>
59 #include <vtkSmartPointer.h>
60 
61 // Qt includes
62 #if defined(USTK_HAVE_VTK_QT4)
63 #include <QtGui/QApplication>
64 #include <QtGui/QGridLayout>
65 #include <QtGui/QMainWindow>
66 #include <QtGui/QPushButton>
67 #elif defined(USTK_HAVE_VTK_QT4) // QT 5 ?
68 #include <QtWidgets/QApplication>
69 #include <QtWidgets/QGridLayout>
70 #include <QtWidgets/QMainWindow>
71 #include <QtWidgets/QPushButton>
72 #endif
73 
80 class VISP_EXPORT usMedicalImageViewer : public QMainWindow
81 {
82  Q_OBJECT
83 public:
84  // Constructor/Destructor
85  usMedicalImageViewer(std::string imageFileName);
87 
88  void resizeEvent(QResizeEvent *event);
89 
90 public slots:
91 
92  virtual void ResetViews();
93  virtual void ResetColorMap();
94  virtual void Render();
95  virtual void AddDistanceMeasurementToView1();
96  virtual void AddDistanceMeasurementToView(int);
97  virtual void slotExit();
98 
99 protected:
100  vtkSmartPointer<vtkResliceImageViewer> riw[3];
101  vtkSmartPointer<vtkImagePlaneWidget> planeWidget[3];
102  vtkSmartPointer<vtkDistanceWidget> DistanceWidget[3];
103  vtkSmartPointer<vtkResliceImageViewerMeasurements> ResliceMeasurements[3];
104 
105 protected slots:
106 
107 private:
108  void setupUi();
109 
110  QAction *actionOpenFile;
111  QAction *actionExit;
112  QAction *actionPrint;
113  QAction *actionHelp;
114  QAction *actionSave;
115  QWidget *centralwidget;
116  QWidget *gridLayoutWidget;
117  QGridLayout *gridLayout_2;
118  usViewerWidget *view2;
119  us3DSceneWidget *view4;
120  usViewerWidget *view3;
121  usViewerWidget *view1;
122  QPushButton *resetButton;
123  QPushButton *resetColorsButton;
124  QPushButton *AddDistance1Button;
125 
126  // VTK planes
127  vtkPlane *plane1;
128  vtkPlane *plane2;
129  vtkPlane *plane3;
130 
131  // mappers (views2D)
132  vtkImageResliceMapper *imageMapper1;
133  vtkImageResliceMapper *imageMapper2;
134  vtkImageResliceMapper *imageMapper3;
135 
136  // image
137  usImagePostScan3D<unsigned char> postScanImage;
138  vtkSmartPointer<vtkImageData> vtkImage;
139 };
140 #endif
141 #endif // __usMedicalImageViewer_h_
Class used to render a 3D vtk scene containing a vtkImageData in a QWidget (based on QVTKWidget).
Graphical main window containing 4 vtk views.
View used to render a vtk scene in a QWidget (based on QVTKWidget for Qt4, QVTKOpenGLWidget for Qt5)