#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)) && \
defined(USTK_HAVE_FFTW)
#include <QApplication>
#include <QtCore/QThread>
#include <visp3/ustk_core/usRFToPreScan2DConverter.h>
#include <visp3/ustk_elastography/usElastography.h>
#include <visp3/ustk_grabber/usNetworkGrabberRF2D.h>
#include <visp3/gui/vpDisplayGDI.h>
#include <visp3/gui/vpDisplayX.h>
#include <visp3/io/vpImageIo.h>
int main(int argc, char **argv)
{
QApplication app(argc, argv);
elastography->
setROI(40, 3200, 50, 500);
vpImage<unsigned char> strainImage;
#if defined(VISP_HAVE_X11)
vpDisplayX *displayEcho = NULL;
vpDisplayX *displayElas = NULL;
#elif defined(VISP_HAVE_GDI)
vpDisplayGDI *displayEcho = NULL;
vpDisplayGDI *displayElas = 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->
getFrameCount() << std::endl;
strainImage = elastography->
run();
converter.
convert(*grabbedFrame, preScanImage);
if (!displayInit && strainImage.getHeight() != 0 && strainImage.getWidth() != 0) {
#if defined(VISP_HAVE_X11)
displayEcho = new vpDisplayX(preScanImage);
displayElas = new vpDisplayX(strainImage);
#elif defined(VISP_HAVE_GDI)
displayEcho = new vpDisplayGDI(preScanImage);
displayElas = new vpDisplayGDI(strainImage);
#endif
displayInit = true;
}
if (displayInit) {
vpDisplay::display(preScanImage);
vpDisplay::displayRectangle(preScanImage, 320, 40, 50, 50, vpColor::red);
vpDisplay::display(strainImage);
vpDisplay::flush(preScanImage);
vpDisplay::flush(strainImage);
}
}
else {
vpTime::wait(10);
}
} while (captureRunning);
if (displayInit) {
delete displayElas;
delete displayEcho;
}
return app.exec();
}
#else
int main()
{
std::cout << "You should intall Qt5 (with wigdets and network modules), FFTW and a display graphic system (GDI or "
"X11) to run this tutorial"
<< std::endl;
return 0;
}
#endif
Computation of a strain map using two sucessive RF images acquired at different compressions of the p...
vpImage< unsigned char > run()
void setROI(int tx, int ty, int tw, int th)
void updateRF(const usImageRF2D< short int > &image)
Class to store additionnal informations arriving on the network with ultrasound images grabbed,...
quint32 getFrameCount() const
Specific class to grab RF frames from the ultrasound station on the network.
bool isFirstFrameAvailable()
usFrameGrabbedInfo< usImageRF2D< short int > > * acquire()
bool initAcquisition(const usNetworkGrabber::usInitHeaderSent &header)
void setIPAddress(const std::string &s_ip)
2D conversion from RF signal to pre-scan image
void convert(const usImageRF2D< short int > &rfImage, usImagePreScan2D< unsigned char > &preScanImage)