UsTK : Ultrasound ToolKit
version 2.0.1 under development (2024-11-21)
|
#include <visp3/ustk_grabber/usNetworkGrabber.h>
Classes | |
struct | usInitHeaderConfirmation |
struct | usInitHeaderSent |
struct | usRunControlHeaderSent |
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) |
virtual void | dataArrived ()=0 |
void | disconnected () |
void | disconnectFromServer () |
void | handleError (QAbstractSocket::SocketError err) |
void | initAcquisitionSlot (usNetworkGrabber::usInitHeaderSent header) |
void | processConnectionToServer () |
void | runAcquisition () |
void | stopAcquisition () |
Signals | |
void | serverUpdateEnded (bool success) |
void | endBlockingLoop () |
void | runAcquisitionSignal (bool run) |
void | sendAcquisitionParametersSignal () |
void | endConnection () |
void | acquisitionInitialized (bool) |
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 |
Generic abstract class to manage tcp connection to grab ultrasound frames (on port 8080).
This class contains all the network process to manage the remote control the acquisition (the code for server side is on lagadic gitlab).
The following figure details the network communication process and summarizes the steps to follow to acquire ultrasound images :
Definition at line 71 of file usNetworkGrabber.h.
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.
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.
|
explicit |
Constructor.
parent | Parent QObject. |
Definition at line 51 of file usNetworkGrabber.cpp.
References m_acquisitionParameters, m_bytesLeftToRead, m_confirmHeader, m_connect, m_imageHeader, m_ip, m_isInit, m_isRunning, m_tcpSocket, m_thread, m_verbose, runAcquisitionSignal(), sendAcquisitionParametersSignal(), sendAcquisitionParametersSlot(), sendRunSignal(), serverUpdated(), and serverUpdateEnded().
usNetworkGrabber::~usNetworkGrabber | ( | ) |
Destructor.
Definition at line 80 of file usNetworkGrabber.cpp.
References m_tcpSocket, m_thread, and stopAcquisition().
|
signal |
Referenced by initAcquisitionSlot().
|
slot |
Sets the motor position of 4DC7 probe to the middle.
Definition at line 768 of file usNetworkGrabber.cpp.
References sendAcquisitionParameters(), and setMotorPosition().
|
slot |
Slot called when the grabber is connected to the server. Prints connection informations.
Definition at line 165 of file usNetworkGrabber.cpp.
References m_tcpSocket, and m_verbose.
Referenced by processConnectionToServer().
|
slot |
Method used to connect to the server.
Definition at line 96 of file usNetworkGrabber.cpp.
References m_connect, and processConnectionToServer().
|
slot |
Method used to connect to the server.
Definition at line 105 of file usNetworkGrabber.cpp.
References m_connect, processConnectionToServer(), and setIPAddress().
|
pure virtualslot |
void usNetworkGrabber::disconnect | ( | ) |
Method to close the connection.
Definition at line 293 of file usNetworkGrabber.cpp.
References m_tcpSocket.
|
slot |
Slot called when the grabber is disconnected from the server. Prints information, and closes socket.
Definition at line 179 of file usNetworkGrabber.cpp.
References m_tcpSocket, and m_verbose.
Referenced by disconnectFromServer(), and processConnectionToServer().
|
slot |
Method used to disconnect from the server.
Definition at line 115 of file usNetworkGrabber.cpp.
References disconnected(), endConnection(), m_connect, and m_tcpSocket.
|
signal |
Referenced by initAcquisition(), initAcquisitionSlot(), sendAcquisitionParametersSlot(), and serverUpdated().
|
signal |
Referenced by disconnectFromServer(), and processConnectionToServer().
int usNetworkGrabber::getFramesPerVolume | ( | ) |
Getter for the number of frames per volume, in 3D acquisition.
Definition at line 718 of file usNetworkGrabber.cpp.
References usAcquisitionParameters::getFramesPerVolume(), and m_acquisitionParameters.
int usNetworkGrabber::getImageDepth | ( | ) |
Getter for image depth (meters).
Definition at line 723 of file usNetworkGrabber.cpp.
References usAcquisitionParameters::getImageDepth(), and m_acquisitionParameters.
int usNetworkGrabber::getImagingMode | ( | ) |
Getter for imaging mode (0 : B-Mode, 12 : RF).
Definition at line 728 of file usNetworkGrabber.cpp.
References usAcquisitionParameters::getImagingMode(), and m_acquisitionParameters.
bool usNetworkGrabber::getMotorActivation | ( | ) |
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 m_acquisitionParameters.
int usNetworkGrabber::getMotorPosition | ( | ) |
Getter for a static motor position (in angle from the beginning position).
Definition at line 733 of file usNetworkGrabber.cpp.
References usAcquisitionParameters::getMotorPosition(), and m_acquisitionParameters.
int usNetworkGrabber::getPostScanHeigh | ( | ) |
Getter for post-scan image height.
Definition at line 738 of file usNetworkGrabber.cpp.
References usAcquisitionParameters::getPostScanHeigh(), and m_acquisitionParameters.
bool usNetworkGrabber::getPostScanMode | ( | ) |
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 m_acquisitionParameters.
int usNetworkGrabber::getPostScanWidth | ( | ) |
Getter for post-scan image width.
Definition at line 748 of file usNetworkGrabber.cpp.
References usAcquisitionParameters::getPostScanWidth(), and m_acquisitionParameters.
int usNetworkGrabber::getSamplingFrequency | ( | void | ) |
Getter for samplingFrequency (Hz).
Definition at line 753 of file usNetworkGrabber.cpp.
References usAcquisitionParameters::getSamplingFrequency(), and m_acquisitionParameters.
int usNetworkGrabber::getSector | ( | ) |
Getter for sector (percentage of the number of transducers to use).
Definition at line 758 of file usNetworkGrabber.cpp.
References usAcquisitionParameters::getSector(), and m_acquisitionParameters.
usAcquisitionParameters::usMotorStep usNetworkGrabber::getStepsPerFrame | ( | ) |
Getter for steps between two sucessive frames (angle). See usAcquisitionParameters::usMotorSteps
Definition at line 710 of file usNetworkGrabber.cpp.
References usAcquisitionParameters::getSepsPerFrame(), and m_acquisitionParameters.
int usNetworkGrabber::getTransmitFrequency | ( | ) |
Getter for transmitFrequency (Hz).
Definition at line 763 of file usNetworkGrabber.cpp.
References usAcquisitionParameters::getTransmitFrequency(), and m_acquisitionParameters.
|
slot |
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 m_tcpSocket.
Referenced by processConnectionToServer().
bool usNetworkGrabber::initAcquisition | ( | const usNetworkGrabber::usInitHeaderSent & | header | ) |
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.
header | Contains acquisition parameters to set up for the acquisition. |
Definition at line 206 of file usNetworkGrabber.cpp.
References endBlockingLoop(), usNetworkGrabber::usInitHeaderSent::headerId, usNetworkGrabber::usInitHeaderSent::imagingMode, m_isInit, m_isRunning, m_tcpSocket, m_updateParametersSucess, m_verbose, usNetworkGrabber::usInitHeaderSent::probeId, usNetworkGrabber::usInitHeaderSent::slotId, and stopAcquisition().
|
slot |
Slot to call 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.
Definition at line 251 of file usNetworkGrabber.cpp.
References acquisitionInitialized(), endBlockingLoop(), usNetworkGrabber::usInitHeaderSent::headerId, usNetworkGrabber::usInitHeaderSent::imagingMode, m_isInit, m_isRunning, m_tcpSocket, m_updateParametersSucess, m_verbose, usNetworkGrabber::usInitHeaderSent::probeId, usNetworkGrabber::usInitHeaderSent::slotId, and stopAcquisition().
|
slot |
Method used to do all the process of the server connection.
Definition at line 129 of file usNetworkGrabber.cpp.
References connected(), disconnected(), endConnection(), handleError(), m_connect, m_ip, m_tcpSocket, and m_verbose.
Referenced by connectToServer().
void usNetworkGrabber::readAcquisitionParameters | ( | QDataStream & | stream | ) |
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 m_acquisitionParameters, 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(), usNetworkGrabberPostScanBiPlan::dataArrived(), usNetworkGrabberPreScan2D::dataArrived(), usNetworkGrabberPreScan3D::dataArrived(), usNetworkGrabberRF2D::dataArrived(), and usNetworkGrabberRF3D::dataArrived().
|
slot |
Sends the command to run the acquisition on the ultrasound station and start a new thread to run the data reception
Definition at line 651 of file usNetworkGrabber.cpp.
References m_thread, and runAcquisitionSignal().
|
signal |
Referenced by runAcquisition(), stopAcquisition(), and usNetworkGrabber().
bool usNetworkGrabber::sendAcquisitionParameters | ( | ) |
Method to send to the server the new acquisition parameters.
Definition at line 298 of file usNetworkGrabber.cpp.
References m_isRunning, m_updateParametersSucess, sendAcquisitionParametersSignal(), and stopAcquisition().
Referenced by center3DProbeMotor().
|
signal |
Referenced by sendAcquisitionParameters(), and usNetworkGrabber().
|
protectedslot |
Slot to send to the server the new acquisition parameters.
Definition at line 312 of file usNetworkGrabber.cpp.
References endBlockingLoop(), usAcquisitionParameters::getActivateMotor(), usAcquisitionParameters::getFramesPerVolume(), usAcquisitionParameters::getImageDepth(), usAcquisitionParameters::getImagingMode(), usAcquisitionParameters::getMotorPosition(), usAcquisitionParameters::getPostScanHeigh(), usAcquisitionParameters::getPostScanMode(), usAcquisitionParameters::getPostScanWidth(), usAcquisitionParameters::getSamplingFrequency(), usAcquisitionParameters::getSector(), usAcquisitionParameters::getSepsPerFrame(), usAcquisitionParameters::getTransmitFrequency(), m_acquisitionParameters, m_tcpSocket, m_updateParametersSucess, and m_verbose.
Referenced by usNetworkGrabber().
|
protectedslot |
Slot called to write on the socket the command run / stop.
run | Boolean to run the acquisition (true), or stop it (false). |
Definition at line 680 of file usNetworkGrabber.cpp.
References usNetworkGrabber::usRunControlHeaderSent::headerId, m_isRunning, m_tcpSocket, and usNetworkGrabber::usRunControlHeaderSent::run.
Referenced by usNetworkGrabber().
|
protectedslot |
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 endBlockingLoop(), and m_updateParametersSucess.
Referenced by usNetworkGrabber().
|
signal |
void usNetworkGrabber::setFramesPerVolume | ( | int | framesPerVolume | ) |
Setter for the number of frames per volume, in 3D acquisition.
Definition at line 558 of file usNetworkGrabber.cpp.
References usAcquisitionParameters::getFramesPerVolumeMax(), usAcquisitionParameters::getFramesPerVolumeMin(), m_acquisitionParameters, and usAcquisitionParameters::setFramesPerVolume().
void usNetworkGrabber::setImageDepth | ( | int | imageDepth | ) |
Setter for image depth (millimeters).
Definition at line 571 of file usNetworkGrabber.cpp.
References usAcquisitionParameters::getImageDepthMax(), usAcquisitionParameters::getImageDepthMin(), m_acquisitionParameters, and usAcquisitionParameters::setImageDepth().
void usNetworkGrabber::setImagingMode | ( | int | imagingMode | ) |
Setter for imaging mode (0 : B-Mode, 12 : RF).
Definition at line 581 of file usNetworkGrabber.cpp.
References usAcquisitionParameters::getImagingModeMax(), usAcquisitionParameters::getImagingModeMin(), m_acquisitionParameters, and usAcquisitionParameters::setImagingMode().
|
inline |
Definition at line 155 of file usNetworkGrabber.h.
Referenced by connectToServer().
void usNetworkGrabber::setMotorActivation | ( | bool | activateMotor | ) |
Setter for motor activation : true to sweep the motor the motor during the acquisition, false to let it static.
Definition at line 542 of file usNetworkGrabber.cpp.
References m_acquisitionParameters, and usAcquisitionParameters::setActivateMotor().
void usNetworkGrabber::setMotorPosition | ( | int | motorPosition | ) |
Setter for a static motor position (in angle from the beginning position).
Definition at line 592 of file usNetworkGrabber.cpp.
References usAcquisitionParameters::getMotorPositionMax(), usAcquisitionParameters::getMotorPositionMin(), m_acquisitionParameters, and usAcquisitionParameters::setMotorPosition().
Referenced by center3DProbeMotor().
void usNetworkGrabber::setPostScanHeigh | ( | int | postScanHeigh | ) |
Setter for post-scan image height.
Definition at line 603 of file usNetworkGrabber.cpp.
References m_acquisitionParameters, and usAcquisitionParameters::setPostScanHeigh().
void usNetworkGrabber::setPostScanMode | ( | bool | postScanMode | ) |
Setter for post-scan mode : true for post-scan, false for pre-scan.
Definition at line 608 of file usNetworkGrabber.cpp.
References m_acquisitionParameters, and usAcquisitionParameters::setPostScanMode().
void usNetworkGrabber::setPostScanWidth | ( | int | postScanWidth | ) |
Setter for post-scan image width.
Definition at line 613 of file usNetworkGrabber.cpp.
References m_acquisitionParameters, and usAcquisitionParameters::setPostScanWidth().
void usNetworkGrabber::setSamplingFrequency | ( | int | samplingFrequency | ) |
Setter for samplingFrequency (Hz).
Definition at line 618 of file usNetworkGrabber.cpp.
References usAcquisitionParameters::getSamplingFrequencyMax(), usAcquisitionParameters::getSamplingFrequencyMin(), m_acquisitionParameters, and usAcquisitionParameters::setSamplingFrequency().
void usNetworkGrabber::setSector | ( | int | sector | ) |
Setter for sector (percentage of the number of transducers to use).
Definition at line 629 of file usNetworkGrabber.cpp.
References usAcquisitionParameters::getSectorMax(), usAcquisitionParameters::getSectorMin(), m_acquisitionParameters, and usAcquisitionParameters::setSector().
void usNetworkGrabber::setStepsPerFrame | ( | usAcquisitionParameters::usMotorStep | stepsPerFrame | ) |
Setter for steps between two sucessive frames (angle). See usAcquisitionParameters::usMotorSteps
Definition at line 550 of file usNetworkGrabber.cpp.
References m_acquisitionParameters, and usAcquisitionParameters::setSepsPerFrame().
void usNetworkGrabber::setTransmitFrequency | ( | int | transmitFrequency | ) |
Setter for transmitFrequency (Hz).
Definition at line 639 of file usNetworkGrabber.cpp.
References usAcquisitionParameters::getTransmitFrequencyMax(), usAcquisitionParameters::getTransmitFrequencyMin(), m_acquisitionParameters, and usAcquisitionParameters::setTransmitFrequency().
|
inline |
Definition at line 170 of file usNetworkGrabber.h.
|
slot |
Sends the command to stop the acquisition on the ulstrasound station. The server will stop to send data, but the grabber is still connected : you can then perform a runAcquisition() to tell the server to restart sending frames. The acquisition parameters will be kept.
Definition at line 669 of file usNetworkGrabber.cpp.
References runAcquisitionSignal().
Referenced by initAcquisition(), initAcquisitionSlot(), sendAcquisitionParameters(), and ~usNetworkGrabber().
|
protected |
Definition at line 211 of file usNetworkGrabber.h.
Referenced by getFramesPerVolume(), getImageDepth(), getImagingMode(), getMotorActivation(), getMotorPosition(), getPostScanHeigh(), getPostScanMode(), getPostScanWidth(), getSamplingFrequency(), getSector(), getStepsPerFrame(), getTransmitFrequency(), readAcquisitionParameters(), sendAcquisitionParametersSlot(), setFramesPerVolume(), setImageDepth(), setImagingMode(), setMotorActivation(), setMotorPosition(), setPostScanHeigh(), setPostScanMode(), setPostScanWidth(), setSamplingFrequency(), setSector(), setStepsPerFrame(), setTransmitFrequency(), and usNetworkGrabber().
|
protected |
Definition at line 208 of file usNetworkGrabber.h.
Referenced by usNetworkGrabberPostScan2D::dataArrived(), usNetworkGrabberPostScanBiPlan::dataArrived(), usNetworkGrabberPreScan2D::dataArrived(), usNetworkGrabberPreScan3D::dataArrived(), usNetworkGrabberRF2D::dataArrived(), usNetworkGrabberRF3D::dataArrived(), and usNetworkGrabber().
|
protected |
Definition at line 217 of file usNetworkGrabber.h.
Referenced by usNetworkGrabberPostScan2D::dataArrived(), usNetworkGrabberPostScanBiPlan::dataArrived(), usNetworkGrabberPreScan2D::dataArrived(), usNetworkGrabberPreScan3D::dataArrived(), usNetworkGrabberRF2D::dataArrived(), usNetworkGrabberRF3D::dataArrived(), and usNetworkGrabber().
|
protected |
Definition at line 204 of file usNetworkGrabber.h.
Referenced by connectToServer(), disconnectFromServer(), processConnectionToServer(), and usNetworkGrabber().
|
protected |
Definition at line 218 of file usNetworkGrabber.h.
Referenced by usNetworkGrabberPostScan2D::dataArrived(), usNetworkGrabberPostScanBiPlan::dataArrived(), usNetworkGrabberPreScan2D::dataArrived(), usNetworkGrabberPreScan3D::dataArrived(), usNetworkGrabberRF2D::dataArrived(), usNetworkGrabberRF3D::dataArrived(), and usNetworkGrabber().
|
protected |
Definition at line 205 of file usNetworkGrabber.h.
Referenced by processConnectionToServer(), and usNetworkGrabber().
|
protected |
Definition at line 221 of file usNetworkGrabber.h.
Referenced by initAcquisition(), initAcquisitionSlot(), and usNetworkGrabber().
|
protected |
Definition at line 222 of file usNetworkGrabber.h.
Referenced by initAcquisition(), initAcquisitionSlot(), sendAcquisitionParameters(), sendRunSignal(), and usNetworkGrabber().
|
protected |
Definition at line 203 of file usNetworkGrabber.h.
Referenced by connected(), usNetworkGrabberPostScan2D::dataArrived(), usNetworkGrabberPostScanBiPlan::dataArrived(), usNetworkGrabberPreScan2D::dataArrived(), usNetworkGrabberPreScan3D::dataArrived(), usNetworkGrabberRF2D::dataArrived(), usNetworkGrabberRF3D::dataArrived(), disconnect(), disconnected(), disconnectFromServer(), handleError(), initAcquisition(), initAcquisitionSlot(), processConnectionToServer(), sendAcquisitionParametersSlot(), sendRunSignal(), usNetworkGrabber(), usNetworkGrabberPostScan2D::usNetworkGrabberPostScan2D(), usNetworkGrabberPostScanBiPlan::usNetworkGrabberPostScanBiPlan(), usNetworkGrabberPreScan2D::usNetworkGrabberPreScan2D(), usNetworkGrabberPreScan3D::usNetworkGrabberPreScan3D(), usNetworkGrabberRF2D::usNetworkGrabberRF2D(), usNetworkGrabberRF3D::usNetworkGrabberRF3D(), and ~usNetworkGrabber().
|
protected |
Definition at line 225 of file usNetworkGrabber.h.
Referenced by runAcquisition(), usNetworkGrabber(), and ~usNetworkGrabber().
|
protected |
Definition at line 214 of file usNetworkGrabber.h.
Referenced by initAcquisition(), initAcquisitionSlot(), sendAcquisitionParameters(), sendAcquisitionParametersSlot(), and serverUpdated().
|
protected |
Definition at line 200 of file usNetworkGrabber.h.
Referenced by connected(), usNetworkGrabberPostScan2D::dataArrived(), usNetworkGrabberPostScanBiPlan::dataArrived(), usNetworkGrabberPreScan2D::dataArrived(), usNetworkGrabberPreScan3D::dataArrived(), usNetworkGrabberRF2D::dataArrived(), usNetworkGrabberRF3D::dataArrived(), disconnected(), initAcquisition(), initAcquisitionSlot(), processConnectionToServer(), readAcquisitionParameters(), sendAcquisitionParametersSlot(), and usNetworkGrabber().