UsTK : Ultrasound ToolKit  version 2.0.1 under development (2024-12-03)
tutorial-local-grabbing-pre-scan2D-display.cpp
#include <iostream>
#include <visp3/ustk_core/usConfig.h>
#if defined(VISP_HAVE_MODULE_USTK_GUI) && defined(VISP_HAVE_MODULE_USTK_GRABBER)
#include <visp3/ustk_grabber/usNetworkGrabberPreScan2D.h>
#include <visp3/ustk_gui/usImageDisplayWidgetRobotControl.h>
#include <QApplication>
#include <QMainWindow>
int main(int argc, char **argv)
{
QApplication app(argc, argv);
app.setApplicationName(QString("USTK display widget"));
// image
// Qt widgets
widget->updateFrame(*preScan);
QMainWindow window;
window.setCentralWidget(widget);
window.show();
// grabber
QThread *grabbingThread = new QThread();
// qtGrabber->setVerbose(true);
qtGrabber->setIPAddress("127.0.0.1"); // local loop, server must be running on same computer
qtGrabber->connectToServer();
header.probeId = 15; // 4DC7 id = 15
header.slotId = 0; // top slot id = 0
header.imagingMode = 0; // B-mode = 0
qtGrabber->initAcquisition(header);
qtGrabber->runAcquisition();
qtGrabber->moveToThread(grabbingThread);
grabbingThread->start();
// our grabbing loop
do {
if (qtGrabber->isFirstFrameAvailable()) {
preScan = qtGrabber->acquire();
widget->updateFrame(*preScan);
}
} while (window.isVisible());
// disconnect from server
qtGrabber->disconnectFromServer();
grabbingThread->quit();
return 0;
}
#else
int main()
{
std::cout << "You should build ustk_gui and ustk_grabber to run this tutorial" << std::endl;
return 0;
}
#endif
Qt widget class for 2D ultrasound image display, containing robot control tools.
void updateFrame(const vpImage< unsigned char > img)
Specific class to grab pre-scan frames from the ultrasound station on the network.
usFrameGrabbedInfo< usImagePreScan2D< unsigned char > > * acquire()
bool initAcquisition(const usNetworkGrabber::usInitHeaderSent &header)
void setIPAddress(const std::string &s_ip)