34 #include <visp3/ustk_grabber/usNetworkGrabberPreScan2D.h>
36 #if defined(USTK_HAVE_QT5) || defined(USTK_HAVE_VTK_QT)
38 #include <QtCore/QDataStream>
39 #include <QtCore/QEventLoop>
40 #include <visp3/ustk_core/usImageIo.h>
47 m_grabbedImage.init(0, 0);
54 m_firstFrameAvailable =
false;
56 m_recordingOn =
false;
57 m_firstImageTimestamp = 0;
76 #if (defined(USTK_HAVE_QT5) || defined(USTK_HAVE_VTK_QT5))
77 in.setVersion(QDataStream::Qt_5_0);
78 #elif defined(USTK_HAVE_VTK_QT4)
79 in.setVersion(QDataStream::Qt_4_8);
81 throw(vpException(vpException::fatalError,
"your Qt version is not managed in ustk"));
88 std::cout <<
"header received, type = " << headerType << std::endl;
100 throw(vpException(vpException::fatalError,
"porta initialisation error closing connection."));
120 m_firstImageTimestamp = timestamp;
183 std::cout <<
"WARNING : new image received with an acquisition timestamp close to previous image" << std::endl;
196 std::cout <<
"Bytes left to read for whole frame = " <<
m_bytesLeftToRead << std::endl;
203 std::cout <<
"reading following part of the frame" << std::endl;
204 std::cout <<
"local image size = " << m_grabbedImage.getSize() << std::endl;
228 ->resize(m_grabbedImage.getWidth(), m_grabbedImage.getHeight());
230 for (
unsigned int i = 0; i < m_grabbedImage.getHeight(); i++)
231 for (
unsigned int j = 0; j < m_grabbedImage.getWidth(); j++)
243 m_firstImageTimestamp);
245 m_firstFrameAvailable =
true;
259 if (!m_firstFrameAvailable ||
283 for (
unsigned int i = 0; i < m_outputBuffer.size(); i++)
284 m_outputBuffer.at(i)->display = display;
293 m_recordingOn =
true;
Class to store additionnal informations arriving on the network with ultrasound images grabbed,...
quint64 getTimeStamp() const
quint32 getFrameCount() const
void setFramesPerVolume(int framesPerVolume)
int getFramesPerVolume() const
void setTimeStamp(quint64 timeStamp)
void setFrameCount(quint32 frameCount)
void resize(const unsigned int h, const unsigned int w)
void setAxialResolution(const double axialResolution)
void setSequenceDirectory(const std::string sequenceDirectory)
void write(const usImageRF2D< short int > &image, const uint64_t timestamp)
void activateRecording(std::string path)
usNetworkGrabberPreScan2D(usNetworkGrabber *parent=0)
usFrameGrabbedInfo< usImagePreScan2D< unsigned char > > * acquire()
void useVpDisplay(vpDisplay *display)
~usNetworkGrabberPreScan2D()
void newFrame(usImagePreScan2D< unsigned char > image)
Generic abstract class to manage tcp connection to grab ultrasound frames (on port 8080).
usInitHeaderConfirmation m_confirmHeader
@ CURRENT_FILLED_FRAME_POSITION_IN_VEC
@ OUTPUT_FRAME_POSITION_IN_VEC
@ MOST_RECENT_FRAME_POSITION_IN_VEC
void readAcquisitionParameters(QDataStream &stream)
void serverUpdateEnded(bool success)
us::usImageHeader m_imageHeader
void setTransducerConvexity(const bool isTransducerConvex)
void setDepth(double depth)
void setScanLinePitch(const double scanLinePitch)
void setTransmitFrequency(const int transmitFrequency)
void setSamplingFrequency(const int samplingFrequency)
void setTransducerRadius(const double transducerRadius)