#include <iostream>
#include <visp3/ustk_core/usConfig.h>
#if (defined(USTK_HAVE_QT5) || defined(USTK_HAVE_VTK_QT)) && (defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI))
#include <QApplication>
#include <QtCore/QThread>
#include <visp3/ustk_grabber/usNetworkGrabberPostScanBiPlan.h>
#include <visp3/gui/vpDisplayGDI.h>
#include <visp3/gui/vpDisplayX.h>
int main(int argc, char **argv)
{
QApplication app(argc, argv);
std::vector<usFrameGrabbedInfo<usImagePostScan2D<unsigned char> > *> grabbedFrame;
#if defined(VISP_HAVE_X11)
vpDisplayX *display1 = NULL;
vpDisplayX *display2 = NULL;
#elif defined(VISP_HAVE_GDI)
vpDisplayGDI *display1 = NULL;
vpDisplayGDI *display2 = NULL;
#endif
bool displayInit = false;
bool captureRunning = true;
std::cout << "waiting ultrasound initialisation..." << std::endl;
do {
grabbedFrame = qtGrabber->
acquire();
std::cout << "MAIN THREAD received frame No : " << grabbedFrame[0]->getFrameCount() << " and "
<< grabbedFrame[1]->getFrameCount() << std::endl;
if (!displayInit && grabbedFrame[0]->getHeight() != 0 && grabbedFrame[0]->getWidth() != 0) {
#if defined(VISP_HAVE_X11)
display1 = new vpDisplayX(*(grabbedFrame[0]));
display2 = new vpDisplayX(*(grabbedFrame[1]));
#elif defined(VISP_HAVE_GDI)
display1 = new vpDisplayGDI(*(grabbedFrame[0]));
display2 = new vpDisplayGDI(*(grabbedFrame[1]));
#endif
displayInit = true;
}
if (displayInit) {
if (vpDisplay::getClick(*grabbedFrame[0], false) || vpDisplay::getClick(*grabbedFrame[1], false))
captureRunning = false;
vpDisplay::display(*(grabbedFrame[0]));
vpDisplay::display(*(grabbedFrame[1]));
vpDisplay::displayText(*grabbedFrame[0], 20, 20, std::string("Click to exit..."), vpColor::red);
vpDisplay::displayText(*grabbedFrame[1], 20, 20, std::string("Click to exit..."), vpColor::red);
vpDisplay::flush(*(grabbedFrame[0]));
vpDisplay::flush(*(grabbedFrame[1]));
}
} while (captureRunning);
if (displayInit) {
delete display1;
delete display2;
}
return 0;
}
#else
int main()
{
std::cout << "You should intall Qt5 (with wigdets and network modules), and display X to run this tutorial"
<< std::endl;
return 0;
}
#endif
Specific class to grab post-scan frames from the ultrasound station on the network with the bi-plane ...
std::vector< usFrameGrabbedInfo< usImagePostScan2D< unsigned char > > * > acquire()
bool initAcquisition(const usNetworkGrabber::usInitHeaderSent &header)
bool sendAcquisitionParameters()
void setPostScanWidth(int postScanWidth)
void setPostScanHeigh(int postScanHeigh)
void setPostScanMode(bool postScanMode)