38 #include <visp3/ustk_gui/usConfidenceMapController.h>
40 #if (defined(USTK_HAVE_VTK_QT) || defined(USTK_HAVE_QT5)) && defined(VISP_HAVE_MODULE_USTK_CONFIDENCE_MAP)
45 usConfidenceMapController::usConfidenceMapController(QObject *parent)
46 : QObject(parent), m_confidenceProcessor(), m_confidenceMap(), m_gain(5), m_activated(false)
50 usConfidenceMapController::~usConfidenceMapController() {}
54 m_confidenceProcessor.run(m_confidenceMap, image);
60 for (
unsigned int i = 0; i < m_confidenceMap.getHeight(); ++i)
61 for (
unsigned int j = 0; j < m_confidenceMap.getWidth(); ++j)
62 I_sum +=
static_cast<double>(m_confidenceMap[i][j]);
65 for (
unsigned int x = 0; x < m_confidenceMap.getHeight(); ++x)
66 for (
unsigned int y = 0; y < m_confidenceMap.getWidth(); ++y) {
67 yc += y * m_confidenceMap[x][y];
72 double thetaError = yc * m_confidenceMap.getScanLinePitch() - m_confidenceMap.getFieldOfView() / 2.0;
76 emit(confidenceMap(m_confidenceMap));
77 emit(confidenceBarycenterAngle(yc));
81 emit(updateProbeOrientation(vpMath::deg(m_gain * thetaError) * 10));
84 void usConfidenceMapController::setPropotionnalControlGain(
const double gain) { m_gain = gain; }
86 double usConfidenceMapController::getPropotionnalControlGain()
const {
return m_gain; }
88 void usConfidenceMapController::activateController(
bool activate) { m_activated = activate; }