UsTK : Ultrasound ToolKit  version 2.0.1 under development (2024-12-17)
usNetworkGrabberPostScanBiPlan Class Reference

#include <visp3/ustk_grabber/usNetworkGrabberPostScanBiPlan.h>

+ Inheritance diagram for usNetworkGrabberPostScanBiPlan:

Public Types

enum  usDataPositionInBuffer { OUTPUT_FRAME_POSITION_IN_VEC = 0 , MOST_RECENT_FRAME_POSITION_IN_VEC = 1 , CURRENT_FILLED_FRAME_POSITION_IN_VEC = 2 }
 
enum  usVolumeField { ODD = 0 , EVEN = 1 , ODD_EVEN = 2 }
 

Public Slots

void center3DProbeMotor ()
 
void connected ()
 
void connectToServer ()
 
void connectToServer (QHostAddress address)
 
void disconnected ()
 
void disconnectFromServer ()
 
void handleError (QAbstractSocket::SocketError err)
 
void initAcquisitionSlot (usNetworkGrabber::usInitHeaderSent header)
 
void processConnectionToServer ()
 
void runAcquisition ()
 
void stopAcquisition ()
 

Signals

void newFrameAvailable ()
 
void serverUpdateEnded (bool success)
 
void endBlockingLoop ()
 
void runAcquisitionSignal (bool run)
 
void sendAcquisitionParametersSignal ()
 
void endConnection ()
 
void acquisitionInitialized (bool)
 

Public Member Functions

 usNetworkGrabberPostScanBiPlan (usNetworkGrabber *parent=0)
 
 ~usNetworkGrabberPostScanBiPlan ()
 
std::vector< usFrameGrabbedInfo< usImagePostScan2D< unsigned char > > * > acquire ()
 
void dataArrived ()
 
bool isFirstFrameAvailable ()
 
void disconnect ()
 
bool initAcquisition (const usNetworkGrabber::usInitHeaderSent &header)
 
bool getMotorActivation ()
 
usAcquisitionParameters::usMotorStep getStepsPerFrame ()
 
int getFramesPerVolume ()
 
int getImageDepth ()
 
int getImagingMode ()
 
int getMotorPosition ()
 
int getPostScanHeigh ()
 
bool getPostScanMode ()
 
int getPostScanWidth ()
 
int getSamplingFrequency ()
 
int getSector ()
 
int getTransmitFrequency ()
 
void readAcquisitionParameters (QDataStream &stream)
 
bool sendAcquisitionParameters ()
 
void setIPAddress (const std::string &s_ip)
 
void setMotorActivation (bool activateMotor)
 
void setStepsPerFrame (usAcquisitionParameters::usMotorStep stepsPerFrame)
 
void setFramesPerVolume (int framesPerVolume)
 
void setImageDepth (int imageDepth)
 
void setImagingMode (int imagingMode)
 
void setMotorPosition (int motorPosition)
 
void setPostScanHeigh (int postScanHeigh)
 
void setPostScanMode (bool postScanMode)
 
void setPostScanWidth (int postScanWidth)
 
void setSamplingFrequency (int samplingFrequency)
 
void setSector (int sector)
 
void setTransmitFrequency (int transmitFrequency)
 
void setVerbose (bool verbose)
 

Protected Slots

void serverUpdated (bool sucess)
 
void sendRunSignal (bool run)
 
void sendAcquisitionParametersSlot ()
 

Protected Attributes

bool m_verbose
 
QTcpSocket * m_tcpSocket
 
bool m_connect
 
std::string m_ip
 
int m_bytesLeftToRead
 
usAcquisitionParameters m_acquisitionParameters
 
bool m_updateParametersSucess
 
usInitHeaderConfirmation m_confirmHeader
 
us::usImageHeader m_imageHeader
 
bool m_isInit
 
bool m_isRunning
 
QThread * m_thread
 

Detailed Description

Specific class to grab post-scan frames from the ultrasound station on the network with the bi-plane probe.

The following figure details the network communication process and summarizes the steps to follow to acquire ultrasound images :

This grabber manages a buffer system to avoid multiple copy of the frames. The acquire() method returns a pointer on a new frame, you can acess and modify the frame (it is thread-safe). Acquire() can be blocking, the behaviour depends on how often you call it :

  • If you call acquire() faster than the frames are arriving on the network, it is blocking to wait next frame coming.
  • If you call it slower you will loose frames, but you will get the last frame available.
Examples
tutorial-ultrasonix-qt-grabbing-post-scan-bi-plan.cpp.

Definition at line 66 of file usNetworkGrabberPostScanBiPlan.h.

Member Enumeration Documentation

◆ usDataPositionInBuffer

Enumerator
OUTPUT_FRAME_POSITION_IN_VEC 
MOST_RECENT_FRAME_POSITION_IN_VEC 
CURRENT_FILLED_FRAME_POSITION_IN_VEC 

Definition at line 75 of file usNetworkGrabber.h.

◆ usVolumeField

Enum to specify types of volumes to grab

Enumerator
ODD 

Grab only odd volumes

EVEN 

Grab only even volumes

ODD_EVEN 

Grab every volumes

Definition at line 82 of file usNetworkGrabber.h.

Constructor & Destructor Documentation

◆ usNetworkGrabberPostScanBiPlan()

usNetworkGrabberPostScanBiPlan::usNetworkGrabberPostScanBiPlan ( usNetworkGrabber parent = 0)
explicit

Constructor. Inititializes the image, and manages Qt signal.

Definition at line 44 of file usNetworkGrabberPostScanBiPlan.cpp.

References dataArrived(), and usNetworkGrabber::m_tcpSocket.

◆ ~usNetworkGrabberPostScanBiPlan()

usNetworkGrabberPostScanBiPlan::~usNetworkGrabberPostScanBiPlan ( )

Destructor.

Definition at line 64 of file usNetworkGrabberPostScanBiPlan.cpp.

Member Function Documentation

◆ acquire()

std::vector< usFrameGrabbedInfo< usImagePostScan2D< unsigned char > > * > usNetworkGrabberPostScanBiPlan::acquire ( )

Method to get the last frame received. The grabber is designed to avoid data copy (it is why you get a pointer on the data).

Note
This method is designed to be thread-safe, you can call it from another thread.
Returns
Pointer to the last frame acquired.
Examples
tutorial-ultrasonix-qt-grabbing-post-scan-bi-plan.cpp.

Definition at line 268 of file usNetworkGrabberPostScanBiPlan.cpp.

References usNetworkGrabber::MOST_RECENT_FRAME_POSITION_IN_VEC, newFrameAvailable(), and usNetworkGrabber::OUTPUT_FRAME_POSITION_IN_VEC.

◆ acquisitionInitialized

void usNetworkGrabber::acquisitionInitialized ( bool  )
signalinherited

◆ center3DProbeMotor

void usNetworkGrabber::center3DProbeMotor ( )
slotinherited

Sets the motor position of 4DC7 probe to the middle.

Definition at line 768 of file usNetworkGrabber.cpp.

References usNetworkGrabber::sendAcquisitionParameters(), and usNetworkGrabber::setMotorPosition().

◆ connected

void usNetworkGrabber::connected ( )
slotinherited

Slot called when the grabber is connected to the server. Prints connection informations.

Definition at line 165 of file usNetworkGrabber.cpp.

References usNetworkGrabber::m_tcpSocket, and usNetworkGrabber::m_verbose.

Referenced by usNetworkGrabber::processConnectionToServer().

◆ connectToServer [1/2]

◆ connectToServer [2/2]

void usNetworkGrabber::connectToServer ( QHostAddress  address)
slotinherited

Method used to connect to the server.

Definition at line 105 of file usNetworkGrabber.cpp.

References usNetworkGrabber::m_connect, usNetworkGrabber::processConnectionToServer(), and usNetworkGrabber::setIPAddress().

◆ dataArrived()

void usNetworkGrabberPostScanBiPlan::dataArrived ( )
virtual

Slot called when data is coming on the network. Manages the type of data is coming and read it. Emits newFrameArrived signal when a whole frame is available.

Implements usNetworkGrabber.

Definition at line 70 of file usNetworkGrabberPostScanBiPlan.cpp.

References us::usImageHeader::anglePerFr, usNetworkGrabber::CURRENT_FILLED_FRAME_POSITION_IN_VEC, us::usImageHeader::dataLength, us::usImageHeader::dataRate, us::usImageHeader::frameCount, us::usImageHeader::frameHeight, us::usImageHeader::framesPerVolume, us::usImageHeader::frameWidth, us::usImageHeader::headerId, usNetworkGrabber::usInitHeaderConfirmation::headerId, us::usImageHeader::imageDepth, us::usImageHeader::imageType, usNetworkGrabber::usInitHeaderConfirmation::initOk, usNetworkGrabber::m_bytesLeftToRead, usNetworkGrabber::m_confirmHeader, usNetworkGrabber::m_imageHeader, usNetworkGrabber::m_tcpSocket, usNetworkGrabber::m_verbose, usNetworkGrabber::MOST_RECENT_FRAME_POSITION_IN_VEC, us::usImageHeader::motorRadius, us::usImageHeader::motorType, newFrameAvailable(), us::usImageHeader::pixelHeight, us::usImageHeader::pixelWidth, usNetworkGrabber::usInitHeaderConfirmation::probeId, usNetworkGrabber::readAcquisitionParameters(), us::usImageHeader::samplingFrequency, us::usImageHeader::scanLineNumber, us::usImageHeader::scanLinePitch, usNetworkGrabber::serverUpdateEnded(), us::usImageHeader::ss, us::usImageHeader::timeStamp, us::usImageHeader::transducerRadius, and us::usImageHeader::transmitFrequency.

Referenced by usNetworkGrabberPostScanBiPlan().

◆ disconnect()

void usNetworkGrabber::disconnect ( )
inherited

Method to close the connection.

Examples
tutorial-ultrasonix-qt-grabbing-pre-scan-confidence-control.cpp.

Definition at line 293 of file usNetworkGrabber.cpp.

References usNetworkGrabber::m_tcpSocket.

◆ disconnected

void usNetworkGrabber::disconnected ( )
slotinherited

Slot called when the grabber is disconnected from the server. Prints information, and closes socket.

Definition at line 179 of file usNetworkGrabber.cpp.

References usNetworkGrabber::m_tcpSocket, and usNetworkGrabber::m_verbose.

Referenced by usNetworkGrabber::disconnectFromServer(), and usNetworkGrabber::processConnectionToServer().

◆ disconnectFromServer

◆ endBlockingLoop

◆ endConnection

void usNetworkGrabber::endConnection ( )
signalinherited

◆ getFramesPerVolume()

int usNetworkGrabber::getFramesPerVolume ( )
inherited

Getter for the number of frames per volume, in 3D acquisition.

Definition at line 718 of file usNetworkGrabber.cpp.

References usAcquisitionParameters::getFramesPerVolume(), and usNetworkGrabber::m_acquisitionParameters.

◆ getImageDepth()

int usNetworkGrabber::getImageDepth ( )
inherited

Getter for image depth (meters).

Definition at line 723 of file usNetworkGrabber.cpp.

References usAcquisitionParameters::getImageDepth(), and usNetworkGrabber::m_acquisitionParameters.

◆ getImagingMode()

int usNetworkGrabber::getImagingMode ( )
inherited

Getter for imaging mode (0 : B-Mode, 12 : RF).

Definition at line 728 of file usNetworkGrabber.cpp.

References usAcquisitionParameters::getImagingMode(), and usNetworkGrabber::m_acquisitionParameters.

◆ getMotorActivation()

bool usNetworkGrabber::getMotorActivation ( )
inherited

Getter for motor activation : true to sweep the motor the motor during the acquisition, false to let it static.

Definition at line 705 of file usNetworkGrabber.cpp.

References usAcquisitionParameters::getActivateMotor(), and usNetworkGrabber::m_acquisitionParameters.

◆ getMotorPosition()

int usNetworkGrabber::getMotorPosition ( )
inherited

Getter for a static motor position (in angle from the beginning position).

Definition at line 733 of file usNetworkGrabber.cpp.

References usAcquisitionParameters::getMotorPosition(), and usNetworkGrabber::m_acquisitionParameters.

◆ getPostScanHeigh()

int usNetworkGrabber::getPostScanHeigh ( )
inherited

Getter for post-scan image height.

Definition at line 738 of file usNetworkGrabber.cpp.

References usAcquisitionParameters::getPostScanHeigh(), and usNetworkGrabber::m_acquisitionParameters.

◆ getPostScanMode()

bool usNetworkGrabber::getPostScanMode ( )
inherited

Getter for post-scan mode : true for post-scan, false for pre-scan.

Definition at line 743 of file usNetworkGrabber.cpp.

References usAcquisitionParameters::getPostScanMode(), and usNetworkGrabber::m_acquisitionParameters.

◆ getPostScanWidth()

int usNetworkGrabber::getPostScanWidth ( )
inherited

Getter for post-scan image width.

Definition at line 748 of file usNetworkGrabber.cpp.

References usAcquisitionParameters::getPostScanWidth(), and usNetworkGrabber::m_acquisitionParameters.

◆ getSamplingFrequency()

int usNetworkGrabber::getSamplingFrequency ( void  )
inherited

Getter for samplingFrequency (Hz).

Definition at line 753 of file usNetworkGrabber.cpp.

References usAcquisitionParameters::getSamplingFrequency(), and usNetworkGrabber::m_acquisitionParameters.

◆ getSector()

int usNetworkGrabber::getSector ( )
inherited

Getter for sector (percentage of the number of transducers to use).

Definition at line 758 of file usNetworkGrabber.cpp.

References usAcquisitionParameters::getSector(), and usNetworkGrabber::m_acquisitionParameters.

◆ getStepsPerFrame()

usAcquisitionParameters::usMotorStep usNetworkGrabber::getStepsPerFrame ( )
inherited

Getter for steps between two sucessive frames (angle). See usAcquisitionParameters::usMotorSteps

Definition at line 710 of file usNetworkGrabber.cpp.

References usAcquisitionParameters::getSepsPerFrame(), and usNetworkGrabber::m_acquisitionParameters.

◆ getTransmitFrequency()

int usNetworkGrabber::getTransmitFrequency ( )
inherited

Getter for transmitFrequency (Hz).

Definition at line 763 of file usNetworkGrabber.cpp.

References usAcquisitionParameters::getTransmitFrequency(), and usNetworkGrabber::m_acquisitionParameters.

◆ handleError

void usNetworkGrabber::handleError ( QAbstractSocket::SocketError  err)
slotinherited

Slot called if there is an error (or disruption) in the connection. Throws an exception and prints the error.

Definition at line 189 of file usNetworkGrabber.cpp.

References usNetworkGrabber::m_tcpSocket.

Referenced by usNetworkGrabber::processConnectionToServer().

◆ initAcquisition()

bool usNetworkGrabber::initAcquisition ( const usNetworkGrabber::usInitHeaderSent header)
inherited

Method called to init the ultrasonix station, by passing acquisition parameters. It is a blocking method : we wait the answer of the server to know if init was sucessfull.

Parameters
headerContains acquisition parameters to set up for the acquisition.
Returns
Boolean to say if init was sucessfull (true) or not (false).
See also
usNetworkGrabber::usInitHeaderSent
Examples
tutorial-elastography-2D-separate-displays.cpp, tutorial-elastography-2D.cpp, tutorial-elastography-3D-acquisition.cpp, tutorial-elastography-BMA-2D.cpp, tutorial-local-grabbing-elastography-display.cpp, tutorial-local-grabbing-pre-scan2D-display.cpp, tutorial-ultrasonix-qt-grabbing-RF-scan-conversion.cpp, tutorial-ultrasonix-qt-grabbing-RF.cpp, tutorial-ultrasonix-qt-grabbing-RF3D.cpp, tutorial-ultrasonix-qt-grabbing-post-scan-bi-plan.cpp, tutorial-ultrasonix-qt-grabbing-post-scan.cpp, tutorial-ultrasonix-qt-grabbing-post-scan3D.cpp, tutorial-ultrasonix-qt-grabbing-pre-scan-confidence-control.cpp, tutorial-ultrasonix-qt-grabbing-pre-scan-confidence.cpp, tutorial-ultrasonix-qt-grabbing-pre-scan.cpp, tutorial-ultrasonix-qt-grabbing-pre-scan3D-display.cpp, tutorial-ultrasonix-qt-grabbing-pre-scan3D.cpp, tutorial-ultrasonix-servo-target-confidence.cpp, tutorial-ustk-virtual-server-RF2D.cpp, tutorial-ustk-virtual-server-RF3D.cpp, tutorial-ustk-virtual-server-postScan2D.cpp, tutorial-ustk-virtual-server-preScan2D.cpp, and tutorial-ustk-virtual-server-preScan3D.cpp.

Definition at line 206 of file usNetworkGrabber.cpp.

References usNetworkGrabber::endBlockingLoop(), usNetworkGrabber::usInitHeaderSent::headerId, usNetworkGrabber::usInitHeaderSent::imagingMode, usNetworkGrabber::m_isInit, usNetworkGrabber::m_isRunning, usNetworkGrabber::m_tcpSocket, usNetworkGrabber::m_updateParametersSucess, usNetworkGrabber::m_verbose, usNetworkGrabber::usInitHeaderSent::probeId, usNetworkGrabber::usInitHeaderSent::slotId, and usNetworkGrabber::stopAcquisition().

◆ initAcquisitionSlot

void usNetworkGrabber::initAcquisitionSlot ( usNetworkGrabber::usInitHeaderSent  header)
slotinherited

◆ isFirstFrameAvailable()

bool usNetworkGrabberPostScanBiPlan::isFirstFrameAvailable ( )
inline

Definition at line 77 of file usNetworkGrabberPostScanBiPlan.h.

◆ newFrameAvailable

void usNetworkGrabberPostScanBiPlan::newFrameAvailable ( )
signal

Referenced by acquire(), and dataArrived().

◆ processConnectionToServer

void usNetworkGrabber::processConnectionToServer ( )
slotinherited

◆ readAcquisitionParameters()

void usNetworkGrabber::readAcquisitionParameters ( QDataStream &  stream)
inherited

Method to read all parameters comming from the server (in answer to an update). It fills the usNetworkGrabber attribute.

Definition at line 383 of file usNetworkGrabber.cpp.

References usNetworkGrabber::m_acquisitionParameters, usNetworkGrabber::m_verbose, usAcquisitionParameters::setActivateMotor(), usAcquisitionParameters::setFramesPerVolume(), usAcquisitionParameters::setFramesPerVolumeMax(), usAcquisitionParameters::setImageDepth(), usAcquisitionParameters::setImageDepthMax(), usAcquisitionParameters::setImageDepthMin(), usAcquisitionParameters::setImagingMode(), usAcquisitionParameters::setImagingModeMax(), usAcquisitionParameters::setImagingModeMin(), usAcquisitionParameters::setMotorPosition(), usAcquisitionParameters::setMotorPositionMax(), usAcquisitionParameters::setMotorPositionMin(), usAcquisitionParameters::setPostScanHeigh(), usAcquisitionParameters::setPostScanMode(), usAcquisitionParameters::setPostScanWidth(), usAcquisitionParameters::setSamplingFrequency(), usAcquisitionParameters::setSamplingFrequencyMax(), usAcquisitionParameters::setSamplingFrequencyMin(), usAcquisitionParameters::setSector(), usAcquisitionParameters::setSectorMax(), usAcquisitionParameters::setSectorMin(), usAcquisitionParameters::setSepsPerFrame(), usAcquisitionParameters::setSepsPerFrameMax(), usAcquisitionParameters::setSepsPerFrameMin(), usAcquisitionParameters::setTransmitFrequency(), usAcquisitionParameters::setTransmitFrequencyMax(), usAcquisitionParameters::setTransmitFrequencyMin(), usAcquisitionParameters::US_ANGLE_PITCH_1, usAcquisitionParameters::US_ANGLE_PITCH_2, usAcquisitionParameters::US_ANGLE_PITCH_3, usAcquisitionParameters::US_ANGLE_PITCH_4, usAcquisitionParameters::US_ANGLE_PITCH_5, and usAcquisitionParameters::US_STATIC_MOTOR.

Referenced by usNetworkGrabberPostScan2D::dataArrived(), dataArrived(), usNetworkGrabberPreScan2D::dataArrived(), usNetworkGrabberPreScan3D::dataArrived(), usNetworkGrabberRF2D::dataArrived(), and usNetworkGrabberRF3D::dataArrived().

◆ runAcquisition

◆ runAcquisitionSignal

void usNetworkGrabber::runAcquisitionSignal ( bool  run)
signalinherited

◆ sendAcquisitionParameters()

◆ sendAcquisitionParametersSignal

void usNetworkGrabber::sendAcquisitionParametersSignal ( )
signalinherited

◆ sendAcquisitionParametersSlot

◆ sendRunSignal

void usNetworkGrabber::sendRunSignal ( bool  run)
protectedslotinherited

Slot called to write on the socket the command run / stop.

Parameters
runBoolean to run the acquisition (true), or stop it (false).

Definition at line 680 of file usNetworkGrabber.cpp.

References usNetworkGrabber::usRunControlHeaderSent::headerId, usNetworkGrabber::m_isRunning, usNetworkGrabber::m_tcpSocket, and usNetworkGrabber::usRunControlHeaderSent::run.

Referenced by usNetworkGrabber::usNetworkGrabber().

◆ serverUpdated

void usNetworkGrabber::serverUpdated ( bool  sucess)
protectedslotinherited

Slot called when we get the answer from the server to our reques to update aquisition parameters.

Definition at line 373 of file usNetworkGrabber.cpp.

References usNetworkGrabber::endBlockingLoop(), and usNetworkGrabber::m_updateParametersSucess.

Referenced by usNetworkGrabber::usNetworkGrabber().

◆ serverUpdateEnded

◆ setFramesPerVolume()

◆ setImageDepth()

◆ setImagingMode()

void usNetworkGrabber::setImagingMode ( int  imagingMode)
inherited

◆ setIPAddress()

◆ setMotorActivation()

void usNetworkGrabber::setMotorActivation ( bool  activateMotor)
inherited

◆ setMotorPosition()

◆ setPostScanHeigh()

void usNetworkGrabber::setPostScanHeigh ( int  postScanHeigh)
inherited

◆ setPostScanMode()

void usNetworkGrabber::setPostScanMode ( bool  postScanMode)
inherited

◆ setPostScanWidth()

void usNetworkGrabber::setPostScanWidth ( int  postScanWidth)
inherited

◆ setSamplingFrequency()

void usNetworkGrabber::setSamplingFrequency ( int  samplingFrequency)
inherited

◆ setSector()

void usNetworkGrabber::setSector ( int  sector)
inherited

Setter for sector (percentage of the number of transducers to use).

Definition at line 629 of file usNetworkGrabber.cpp.

References usAcquisitionParameters::getSectorMax(), usAcquisitionParameters::getSectorMin(), usNetworkGrabber::m_acquisitionParameters, and usAcquisitionParameters::setSector().

◆ setStepsPerFrame()

◆ setTransmitFrequency()

void usNetworkGrabber::setTransmitFrequency ( int  transmitFrequency)
inherited

◆ setVerbose()

void usNetworkGrabber::setVerbose ( bool  verbose)
inlineinherited

Definition at line 170 of file usNetworkGrabber.h.

◆ stopAcquisition

Member Data Documentation

◆ m_acquisitionParameters

◆ m_bytesLeftToRead

◆ m_confirmHeader

◆ m_connect

◆ m_imageHeader

◆ m_ip

std::string usNetworkGrabber::m_ip
protectedinherited

◆ m_isInit

bool usNetworkGrabber::m_isInit
protectedinherited

◆ m_isRunning

◆ m_tcpSocket

◆ m_thread

QThread* usNetworkGrabber::m_thread
protectedinherited

◆ m_updateParametersSucess

◆ m_verbose