34 #include <visp3/ustk_grabber/usNetworkGrabberRF3D.h>
36 #if defined(USTK_HAVE_QT5) || defined(USTK_HAVE_VTK_QT)
38 #include <QtCore/QDataStream>
39 #include <QtCore/QEventLoop>
45 m_grabbedImage.
init(0, 0);
52 m_firstFrameAvailable =
false;
53 m_firstVolumeAvailable =
false;
55 m_recordingOn =
false;
56 m_firstImageTimestamp = 0;
77 #if (defined(USTK_HAVE_QT5) || defined(USTK_HAVE_VTK_QT5))
78 in.setVersion(QDataStream::Qt_5_0);
79 #elif defined(USTK_HAVE_VTK_QT4)
80 in.setVersion(QDataStream::Qt_4_8);
82 throw(vpException(vpException::fatalError,
"your Qt version is not managed in ustk"));
89 std::cout <<
"header received, type = " << headerType << std::endl;
101 throw(vpException(vpException::fatalError,
"porta initialisation error closing connection."));
121 m_firstImageTimestamp = timestamp;
194 std::cout <<
"WARNING : new image received with an acquisition timestamp close to previous image (<10ms)"
209 std::cout <<
"Bytes left to read for whole frame = " <<
m_bytesLeftToRead << std::endl;
216 std::cout <<
"reading following part of the frame" << std::endl;
217 std::cout <<
"local image size = " << m_grabbedImage.
getNumberOfPixel() << std::endl;
235 if (m_firstFrameAvailable) {
244 std::cout << m_grabbedImage;
245 std::cout << currentSettings;
247 throw(vpException(vpException::badValue,
"Transducer settings changed during acquisition, somethink went wrong"));
255 if (m_firstFrameAvailable) {
257 throw(vpException(vpException::badValue,
"Motor settings changed during acquisition, somethink went wrong"));
269 bool motorSweepingInZDirection = (volumeIndex % 2 != 0);
273 if (!motorSweepingInZDirection)
279 for (
unsigned int i = 0; i < m_grabbedImage.
getHeight(); i++) {
280 for (
unsigned int j = 0; j < m_grabbedImage.
getWidth(); j++) {
286 if (m_firstFrameAvailable &&
287 ((framePosition == 0 && !motorSweepingInZDirection) ||
289 motorSweepingInZDirection))) {
297 std::vector<uint64_t> timestampsToWrite;
300 m_firstImageTimestamp);
304 m_firstVolumeAvailable =
true;
308 m_firstFrameAvailable =
true;
322 if (!m_firstVolumeAvailable ||
332 bool parityControl =
false;
333 if (m_volumeField ==
ODD) {
335 parityControl =
true;
337 }
else if (m_volumeField ==
EVEN) {
339 parityControl =
true;
342 parityControl =
true;
346 if (!parityControl) {
366 m_recordingOn =
true;
quint64 getTimeStamp() const
quint32 getFrameCount() const
void setFramesPerVolume(int framesPerVolume)
int getFramesPerVolume() const
void setTimeStamp(quint64 timeStamp)
void setFrameCount(quint32 frameCount)
Settings associated to ultrasound pre-scan images implemented in usImageRF2D, usImageRF3D,...
double getAxialResolution() const
void setAxialResolution(const double axialResolution)
unsigned int getNumberOfPixel() const
unsigned int getHeight() const
void resize(const unsigned int height, const unsigned int width)
unsigned int getWidth() const
void init(unsigned int height, unsigned int width)
Set the size of the image.
void setSequenceDirectory(const std::string sequenceDirectory)
void write(const usImageRF2D< short int > &image, const uint64_t timestamp)
unsigned int getFrameNumber() const
void setMotorType(const usMotorType &motorType)
void setMotorRadius(double motorRadius)
void setFrameNumber(unsigned int frameNumber)
void setFramePitch(double framePitch)
void activateRecording(std::string path)
usVolumeGrabbedInfo< usImageRF3D< short int > > * acquire()
usNetworkGrabberRF3D(usNetworkGrabber *parent=0)
void setVolumeField(usVolumeField volumeField)
void includeFrameInVolume()
void newVolumeAvailable()
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)
double getScanLinePitch() const
void setSamplingFrequency(const int samplingFrequency)
void setTransducerRadius(const double transducerRadius)
double getTransducerRadius() const
unsigned int getScanLineNumber() const
Class to store additionnal informations arriving on the network with ultrasound volumes grabbed,...