34 #include <visp3/ustk_grabber/usNetworkGrabberPreScan3D.h>
36 #if defined(USTK_HAVE_QT5) || defined(USTK_HAVE_VTK_QT)
38 #include <QtCore/QDataStream>
39 #include <QtCore/QEventLoop>
46 m_grabbedImage.init(0, 0);
53 m_firstFrameAvailable =
false;
54 m_firstVolumeAvailable =
false;
56 m_recordingOn =
false;
57 m_firstImageTimestamp = 0;
78 #if (defined(USTK_HAVE_QT5) || defined(USTK_HAVE_VTK_QT5))
79 in.setVersion(QDataStream::Qt_5_0);
80 #elif defined(USTK_HAVE_VTK_QT4)
81 in.setVersion(QDataStream::Qt_4_8);
83 throw(vpException(vpException::fatalError,
"your Qt version is not managed in ustk"));
90 std::cout <<
"header received, type = " << headerType << std::endl;
102 throw(vpException(vpException::fatalError,
"porta initialisation error closing connection."));
122 m_firstImageTimestamp = timestamp;
205 std::cout <<
"Bytes left to read for whole frame = " <<
m_bytesLeftToRead << std::endl;
212 std::cout <<
"reading following part of the frame" << std::endl;
213 std::cout <<
"local image size = " << m_grabbedImage.getSize() << std::endl;
230 if (m_firstFrameAvailable) {
239 m_grabbedImage.getHeight()) {
240 throw(vpException(vpException::badValue,
"Transducer settings changed during acquisition, somethink went wrong"));
243 throw(vpException(vpException::badValue,
"Motor settings changed during acquisition, somethink went wrong"));
258 ->resize(m_grabbedImage.getWidth(), m_grabbedImage.getHeight(), m_motorSettings.
getFrameNumber());
262 bool motorSweepingInZDirection = (volumeIndex % 2 != 0);
266 if (!motorSweepingInZDirection)
272 for (
unsigned int i = 0; i < m_grabbedImage.getHeight(); i++)
273 for (
unsigned int j = 0; j < m_grabbedImage.getWidth(); j++) {
278 if (m_firstFrameAvailable &&
279 ((framePosition == 0 && !motorSweepingInZDirection) ||
281 motorSweepingInZDirection))) {
290 std::vector<uint64_t> timestampsToWrite;
293 m_firstImageTimestamp);
297 m_firstVolumeAvailable =
true;
301 m_firstFrameAvailable =
true;
315 if (!m_firstVolumeAvailable ||
325 bool parityControl =
false;
326 if (m_volumeField ==
ODD) {
328 parityControl =
true;
330 }
else if (m_volumeField ==
EVEN) {
332 parityControl =
true;
335 parityControl =
true;
339 if (!parityControl) {
359 m_recordingOn =
true;
374 m_volumeField = volumeField;
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)
Settings associated to ultrasound pre-scan images implemented in usImageRF2D, usImageRF3D,...
double getAxialResolution() const
void setAxialResolution(const double axialResolution)
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 setVolumeField(usVolumeField volumeField)
void includeFrameInVolume()
void newVolumeAvailable()
~usNetworkGrabberPreScan3D()
usVolumeGrabbedInfo< usImagePreScan3D< unsigned char > > * acquire()
void activateRecording(std::string path)
usNetworkGrabberPreScan3D(usNetworkGrabber *parent=0)
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,...