4 #include <visp3/ustk_core/usConfig.h>
6 #if (defined(USTK_HAVE_QT5) || defined(USTK_HAVE_VTK_QT)) && (defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI)) && \
7 defined(USTK_HAVE_FFTW)
9 #include <QApplication>
10 #include <QStringList>
11 #include <QtCore/QThread>
13 #include <visp3/ustk_core/usRFToPreScan2DConverter.h>
14 #include <visp3/ustk_core/usSequenceWriter.h>
15 #include <visp3/ustk_elastography/usElastography.h>
16 #include <visp3/ustk_elastography/usImageElastography.h>
17 #include <visp3/ustk_grabber/usNetworkGrabberRF2D.h>
19 #include <visp3/gui/vpDisplayGDI.h>
20 #include <visp3/gui/vpDisplayX.h>
21 #include <visp3/io/vpImageIo.h>
23 int main(
int argc,
char **argv)
26 QApplication app(argc, argv);
29 if (app.arguments().contains(QString(
"--ip")))
30 ip = app.arguments().at(qApp->arguments().indexOf(QString(
"--ip")) + 1);
32 ip = QString(
"127.0.0.1");
35 elastography->
setROI(40, 2700, 50, 500);
54 vpImage<unsigned char> strainImage;
56 vpImage<vpRGBa> elastoToDisplay;
61 #if defined(VISP_HAVE_X11)
62 vpDisplayX *displayElasto = NULL;
63 #elif defined(VISP_HAVE_GDI)
64 vpDisplayGDI *displayElasto = NULL;
66 bool displayInit =
false;
67 bool captureRunning =
true;
76 std::cout <<
"waiting ultrasound initialisation..." << std::endl;
81 grabbedFrame = qtGrabber->
acquire();
83 std::cout <<
"MAIN THREAD received frame No : " << grabbedFrame->
getFrameCount() << std::endl;
85 elastography->
updateRF(*grabbedFrame);
86 strainImage = elastography->
run();
87 std::cout <<
"strain image size : " << strainImage.getHeight() <<
", " << strainImage.getWidth() << std::endl;
89 converter.
convert(*grabbedFrame, preScanImage);
97 if (!displayInit && strainImage.getHeight() != 0 && strainImage.getWidth() != 0) {
98 #if defined(VISP_HAVE_X11)
99 displayElasto =
new vpDisplayX(elastoToDisplay);
100 #elif defined(VISP_HAVE_GDI)
101 displayElasto =
new vpDisplayGDI(elastoToDisplay);
108 vpDisplay::display(elastoToDisplay);
109 vpDisplay::display(strainImage);
110 vpDisplay::flush(elastoToDisplay);
111 vpDisplay::flush(strainImage);
118 }
while (captureRunning);
121 delete displayElasto;
129 std::cout <<
"You should intall Qt5 (with wigdets and network modules), FFTW and a display graphic system (GDI or "
130 "X11) to run this tutorial"
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
Elastography image : contains a 2D B-Mode image (pre-scan or post-scan), with an overlaying colored s...
vpImage< vpRGBa > getElastoImage()
void setUltrasoundImage(const vpImage< unsigned char > &ultrasoundImage)
void setStrainMap(const vpImage< unsigned char > &strainMap, unsigned int heightPosition, unsigned int widthPosition)
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)
Writing of sequences of ultrasound images.
void setImageFileName(const std::string &imageFileName)
void saveImage(const ImageType &image, uint64_t timestamp=0)
void setSequenceFileName(const std::string &sequenceFileName)