UsTK : Ultrasound ToolKit  version 2.0.1 under development (2024-12-11)
usRectangleVisualServoingController.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 
37 #ifndef __usRectangleVisualServoingController_h_
38 #define __usRectangleVisualServoingController_h_
39 
40 // VISP includes
41 #include <visp3/ustk_core/usConfig.h>
42 
43 #if (defined(USTK_HAVE_VTK_QT) || defined(USTK_HAVE_QT5)) && defined(VISP_HAVE_MODULE_USTK_TEMPLATE_TRACKING)
44 
45 #include <QApplication>
46 #include <QObject>
47 #include <visp3/ustk_confidence_map/usScanlineConfidence2D.h>
48 #include <visp3/ustk_core/usImagePostScan2D.h>
49 #include <visp3/ustk_core/usImagePreScan2D.h>
50 #include <visp3/ustk_core/usPixelMeterConversion.h>
51 #include <visp3/ustk_core/usPreScanToPostScan2DConverter.h>
52 #include <visp3/ustk_template_tracking/usDenseTracker2D.h>
53 
59 class VISP_EXPORT usRectangleVisualServoingController : public QObject
60 {
61  Q_OBJECT
62 public:
63  usRectangleVisualServoingController(QObject *parent = NULL);
64  virtual ~usRectangleVisualServoingController();
65 
66 signals:
67  void confidenceBarycenterAngle(double theta);
68  void confidenceMap(usImagePreScan2D<unsigned char>);
69  void updatePobeXVelocity(int linearVelocity);
70  void updateProbeZOrientation(int angularVelocity);
71  void newRectTracked(vpRectOriented rect);
72  void newPostScanFrame(usImagePostScan2D<unsigned char> image);
73  void trackerXError(double error);
74 
75 public slots:
76  void updateImage(usImagePreScan2D<unsigned char> image);
77  void initTracker(vpRectOriented rect);
78  void stopTracking();
79  void activateController(bool activate);
80  void activateController();
81  void disactivateController();
82 
83 private:
84  usDenseTracker2D m_tracker;
85  usScanlineConfidence2D m_confidenceProcess;
87  usImagePreScan2D<unsigned char> m_imagePreScan;
88  usImagePreScan2D<unsigned char> m_confidencePreScan;
89  usImagePostScan2D<unsigned char> m_imagePostScan;
90 
91  bool m_trackerActivated;
92  bool m_controllerActivated;
93 };
94 #endif // Qt & template tracking available
95 #endif // __usRectangleVisualServoingController_h_
2D region tracker
Process a pre-scan image to determine the confidence map.