7 #include "PlusConfigure.h" 17 static const std::string WINPROBE_CMD =
"WinProbeCommand";
23 : ResponseExpected(true)
25 this->SetName(WINPROBE_CMD);
26 this->RequestedParameters.clear();
32 this->RequestedParameters.clear();
44 this->SetName(WINPROBE_CMD);
51 cmdNames.push_back(WINPROBE_CMD);
58 if (commandName.empty() || igsioCommon::IsEqualInsensitive(commandName, WINPROBE_CMD))
61 desc +=
": Send text data to WinProbe device.";
69 return this->DeviceId;
75 this->DeviceId = deviceId;
81 return this->CommandName;
87 this->CommandName =
text;
93 return this->CommandValue;
99 this->CommandValue =
text;
105 return this->CommandIndex;
111 this->CommandIndex = index;
117 this->RequestedParameters.clear();
123 this->
SetDeviceId(aConfig->GetAttribute(
"DeviceId"));
124 LOG_INFO(aConfig->GetNumberOfNestedElements());
126 for(
int elemIndex = 0; elemIndex < aConfig->GetNumberOfNestedElements(); ++elemIndex)
128 vtkXMLDataElement* currentElem = aConfig->GetNestedElement(elemIndex);
129 if (igsioCommon::IsEqualInsensitive(currentElem->GetName(),
"Parameter"))
131 const char* parameterName = currentElem->GetAttribute(
"Name");
132 const char* parameterValue = currentElem->GetAttribute(
"Value");
133 const char* parameterIndex = currentElem->GetAttribute(
"Index");
136 LOG_ERROR(
"Unable to find required Name attribute in " << (currentElem->GetName() ? currentElem->GetName() :
"(undefined)") <<
" element in SetUsParameter command");
139 LOG_INFO(
"Adding " << parameterName <<
" to execution list")
141 std::map<std::string, std::string> param_values;
144 param_values[
"Value"] = parameterValue;
148 param_values[
"Index"] = parameterIndex;
150 std::pair<std::string, std::map<std::string, std::string>> parameter;
151 parameter.first = parameterName;
152 parameter.second = param_values;
153 RequestedParameters.push_back(parameter);
167 XML_WRITE_STRING_ATTRIBUTE_IF_NOT_EMPTY(DeviceId, aConfig);
170 std::list<std::pair<std::string, std::map<std::string, std::string>>>::iterator paramIt;
171 for (paramIt = this->RequestedParameters.begin(); paramIt != this->RequestedParameters.end(); ++paramIt)
173 vtkSmartPointer<vtkXMLDataElement> paramElem = vtkSmartPointer<vtkXMLDataElement>::New();
174 paramElem->SetName(
"Parameter");
175 paramElem->SetAttribute(
"Name", paramIt->first.c_str());
176 std::map<std::string, std::string> param_attributes = paramIt->second;
177 std::map<std::string, std::string>::iterator attribIt;
178 for(attribIt = param_attributes.begin(); attribIt != param_attributes.end(); ++attribIt)
180 paramElem->SetAttribute(attribIt->first.c_str(), attribIt->second.c_str());
182 aConfig->AddNestedElement(paramElem);
190 LOG_DEBUG(
"vtkPlusWinProbeCommand::Execute: " << (!this->CommandName.empty() ? this->CommandName :
"(undefined)")
191 <<
", device: " << (this->DeviceId.empty() ?
"(undefined)" : this->DeviceId)
192 <<
", value: " << (this->CommandValue.empty() ?
"(undefined)" : this->CommandValue)
193 <<
", index: " << (this->CommandIndex.empty() ?
"(undefined)" : this->CommandIndex));
197 if (dataCollector == NULL)
204 if (this->DeviceId.empty())
213 + (this->DeviceId.empty() ?
"(undefined)" : this->DeviceId) + std::string(
" is not found."));
219 if (!igsioCommon::IsEqualInsensitive(this->
Name, WINPROBE_CMD))
225 std::map < std::string, std::pair<IANA_ENCODING_TYPE, std::string> > metaData;
226 std::string resultString =
"<CommandReply>";
227 std::string error =
"";
228 std::string res =
"";
230 bool hasFailure =
false;
232 std::list<std::pair<std::string, std::map<std::string, std::string>>>::iterator paramIt;
233 for (paramIt = this->RequestedParameters.begin(); paramIt != this->RequestedParameters.end(); ++paramIt)
235 std::string parameterName = paramIt->first;
239 std::map<std::string, std::string> attribs = paramIt->second;
241 resultString +=
"<Parameter Name=\"" + parameterName +
"\"";
247 std::string
value = attribs[
"Value"];
250 index = std::stoi(attribs[
"Index"]);
252 catch (
const std::invalid_argument& ia) {
307 res = device->
IsFrozen() ?
"True" :
"False";
406 resultString +=
" Success=\"true\"";
409 resultString +=
" Value=\"" + res +
"\"";
410 metaData[parameterName] = std::make_pair(IANA_TYPE_US_ASCII, res);
415 resultString +=
" Success=\"false\"";
466 std::string success =
"false";
467 std::string status_msg =
"MISSING INFO";
468 error +=
"Insufficient information for \"" + parameterName +
"\"\n";
469 resultString +=
" Success=\"" + success +
"\"";
470 metaData[parameterName] = std::make_pair(IANA_TYPE_US_ASCII, status_msg);
476 bool set = igsioCommon::IsEqualInsensitive(
value,
"true") ? true :
false;
481 double tgc_value = stod(
value);
491 float depth_value = stof(
value);
496 float depth_value = stof(
value);
501 double gain_value = stod(
value);
506 double tgc_value = stod(
value);
511 bool set = igsioCommon::IsEqualInsensitive(
value,
"true") ? true :
false;
523 bool set = igsioCommon::IsEqualInsensitive(
value,
"true") ? true :
false;
529 bool set = igsioCommon::IsEqualInsensitive(
value,
"true") ? true :
false;
535 bool set = igsioCommon::IsEqualInsensitive(
value,
"true") ? true :
false;
559 int32_t depth = stoi(
value);
565 int32_t val = stoi(
value);
571 int32_t val = stoi(
value);
577 bool set = igsioCommon::IsEqualInsensitive(
value,
"true") ? true :
false;
583 bool set = igsioCommon::IsEqualInsensitive(
value,
"true") ? true :
false;
589 bool set = igsioCommon::IsEqualInsensitive(
value,
"true") ? true :
false;
595 bool set = igsioCommon::IsEqualInsensitive(
value,
"true") ? true :
false;
601 int val = stoi(
value);
607 uint16_t val = stoi(
value);
613 double val = stod(
value);
619 double val = stod(
value);
625 bool set = igsioCommon::IsEqualInsensitive(
value,
"true") ? true :
false;
631 uint8_t val = stod(
value);
637 int32_t val = stod(
value);
643 bool set = igsioCommon::IsEqualInsensitive(
value,
"true") ? true :
false;
649 int32_t val = stoi(
value);
655 int32_t val = stoi(
value);
661 int32_t val = stoi(
value);
666 int32_t val = stoi(
value);
671 int32_t val = stoi(
value);
676 int32_t val = stoi(
value);
681 int32_t val = stoi(
value);
686 int32_t val = stoi(
value);
691 int32_t val = stoi(
value);
696 int32_t val = stoi(
value);
701 int32_t val = stoi(
value);
712 std::string success =
"true";
713 std::string status_msg =
"SUCCESS";
714 resultString +=
" Success=\"" + success +
"\"";
715 metaData[parameterName] = std::make_pair(IANA_TYPE_US_ASCII, status_msg);
719 std::string success =
"false";
720 std::string status_msg =
"FAIL";
721 resultString +=
" Success=\"" + success +
"\"";
722 metaData[parameterName] = std::make_pair(IANA_TYPE_US_ASCII, status_msg);
731 std::string status_msg =
"SUCCESS";
732 resultString +=
" Success=\"true\"";
733 metaData[parameterName] = std::make_pair(IANA_TYPE_US_ASCII, status_msg);
738 std::istringstream ss(
value);
741 for(
int i = 0;
i < 4;
i++)
747 error +=
"Error setting Focal Depth " +
std::to_string(
i) +
" to " + val +
"\n";
752 std::string success = status ==
PLUS_SUCCESS ?
"true" :
"false";
753 std::string status_msg = status ==
PLUS_SUCCESS ?
"SUCCESS" :
"FAIL";
754 resultString +=
" Success=\"" + success +
"\"";
755 metaData[parameterName] = std::make_pair(IANA_TYPE_US_ASCII, status_msg);
759 std::istringstream ss(
value);
762 for(
int i = 0;
i < 6;
i++)
768 error +=
"Error setting Focal Depth " +
std::to_string(
i) +
" to " + val +
"\n";
773 std::string success = status ==
PLUS_SUCCESS ?
"true" :
"false";
774 std::string status_msg = status ==
PLUS_SUCCESS ?
"SUCCESS" :
"FAIL";
775 resultString +=
" Success=\"" + success +
"\"";
776 metaData[parameterName] = std::make_pair(IANA_TYPE_US_ASCII, status_msg);
780 res = device->
IsScanning() ?
"True" :
"False";
783 resultString +=
" Success=\"true\"";
784 resultString +=
" Value=\"" + res +
"\"";
785 metaData[parameterName] = std::make_pair(IANA_TYPE_US_ASCII, res);
791 std::string success = status ==
PLUS_SUCCESS ?
"true" :
"false";
792 std::string status_msg = status ==
PLUS_SUCCESS ?
"SUCCESS" :
"FAIL";
793 resultString +=
" Success=\"" + success +
"\"";
794 metaData[parameterName] = std::make_pair(IANA_TYPE_US_ASCII, success);
799 resultString +=
" Success=\"false\"";
800 error +=
"No parameter named \"" + parameterName +
"\"\n";
801 metaData[parameterName] = std::make_pair(IANA_TYPE_US_ASCII,
"Unknown Parameter");
805 resultString +=
"/>\n";
807 resultString +=
"</CommandReply>";
811 vtkSmartPointer<vtkPlusCommandRTSCommandResponse> commandResponse = vtkSmartPointer<vtkPlusCommandRTSCommandResponse>::New();
812 commandResponse->UseDefaultFormatOff();
813 commandResponse->SetClientId(this->
ClientId);
814 commandResponse->SetOriginalId(this->
Id);
815 commandResponse->SetDeviceName(this->
DeviceName);
816 commandResponse->SetCommandName(this->GetName());
817 commandResponse->SetStatus(status);
819 commandResponse->SetErrorString(error);
820 commandResponse->SetResultString(resultString);
821 commandResponse->SetParameters(metaData);
void SetARFIPushConfigurationString(std::string pushConfiguration)
bool GetSpatialCompoundEnabled()
void SetMWidth(int value)
static const char * SET_SPATIAL_COMPOUND_COUNT
void SetNameToWinProbeDevice()
void SetBHarmonicEnabled(bool value)
int32_t GetARFIInterPushDelay()
static const char * SET_M_LINE_COUNT
int GetBTransmitCurrent()
static const char * GET_B_TRANSMIT_CURRENT
static const char * GET_RF_MODE_ENABLED
static const char * SET_B_TRANSMIT_LOCKED
static const char * GET_B_BUBBLE_CONTRAST_ENABLED
static const char * SET_ARFI_TX_TX_CYCLE_WIDTH
virtual void PrintSelf(ostream &os, vtkIndent indent)
static const char * GET_ARFI_POST_PUSH_LINE_REPEAT_COUNT
float GetFocalPointDepth(int index)
static const char * SET_B_AMPLITUDE_MODULATION_ENABLED
Abstract interface for tracker and video devices.
static const char * SET_ARFI_ENABLED
virtual void PrintSelf(ostream &os, vtkIndent indent)
static const char * GET_SPATIAL_COMPOUND_ANGLE
virtual PlusStatus WriteConfiguration(vtkXMLDataElement *aConfig)
static const char * SET_ARFI_PUSH_CONFIG
PlusStatus SetARFITxTxCycleWidth(uint8_t propertyValue)
int16_t GetBBubbleDestructionCycleCount()
PlusStatus GetDevice(vtkPlusDevice *&aDevice, const std::string &aDeviceId) const
PlusStatus SetARFITxCycleCount(uint16_t propertyValue)
PlusStatus SendCommand(const char *command)
bool GetBBubbleContrastEnabled()
PlusStatus FreezeDevice(bool freeze)
static const char * GET_SPATIAL_COMPOUND_COUNT
bool GetBAmplitudeModulationEnabled()
void SetBTXFilterCoefficientSet(int32_t value)
static const char * SET_B_TX_FILTER_COEFFICIENT_SET
static const char * GET_B_FRAME_RATE_LIMIT
void SetBApodizationFNumber(double value)
int32_t GetSpatialCompoundCount()
int32_t GetBTXFilterCoefficientSet()
void SetCommandName(const std::string &text)
void SetCommandValue(const std::string &text)
static const char * GET_B_TRANSMIT_LOCKED
static const char * GET_B_HARMONIC_ENABLED
static const char * GET_FOCAL_DEPTH
static const char * GET_M_WIDTH
static const char * SET_ARFI_TX_TX_CYCLE_COUNT
double GetFirstGainValue()
static const char * GET_B_MULTIFOCAL_ZONE_COUNT
int32_t GetARFIPrePushLineRepeatCount()
void SetMDepth(int32_t value)
virtual PlusStatus ReadConfiguration(vtkXMLDataElement *aConfig)
static const char * SET_SPATIAL_COMPOUND_ENABLED
PlusStatus SetFocalPointDepth(int index, float depth)
static const char * GET_M_LINE_COUNT
int32_t GetARFIStopSample()
std::string to_string(ClariusAvailability avail)
std::string GetFPGARevDateString()
bool GetBHarmonicEnabled()
PlusStatus SetTimeGainCompensation(int index, double value)
static const char * GET_MPR_FREQUENCY
void SetMRevolvingEnabled(bool value)
static const char * SET_B_TRANSMIT_CURRENT
uint8_t GetARFITxCycleWidth()
static const char * GET_B_BUBBLE_DESTRUCTION_ENABLED
static const char * GET_B_APODIZATION_FNUMBER
vtkStandardNewMacro(vtkPlusWinProbeCommand)
static const char * GET_ARFI_TX_TX_CYCLE_WIDTH
uint8_t GetARFITxTxCycleWidth()
static const char * GET_ARFI_TX_CYCLE_COUNT
static const char * SET_ARFI_TX_CYCLE_WIDTH
static const char * UV_SEND_COMMAND
static const char * GET_B_BUBBLE_DESTRUCTION_CYCLE_COUNT
static const char * SET_FREEZE
void SetARFIStopSample(int32_t value)
void SetBTransmitFNumber(double value)
void SetMModeEnabled(bool value)
void SetBTransmitCurrent(int value)
static const char * GET_SPATIAL_COMPOUND_ENABLED
static const char * SET_ALL_FOCAL_DEPTHS
static const char * SET_ARFI_PRE_PUSH_LINE_REPEAT_COUNT
This command is for communicating with vtkPlusWinProbeDevices.This command is used for communicating ...
void SetSpatialCompoundCount(int32_t value)
static const char * SET_B_BUBBLE_CONTRAST_ENABLED
void SetBBubbleDestructionCycleCount(int16_t value)
void SetMPRFrequency(int32_t value)
static const char * SET_M_WIDTH
Class for acquiring ultrasound images from WinProbe ultrasound systems.
bool GetBBubbleDestructionEnabled()
virtual std::string GetDeviceId() const
PhidgetLCD_Font int int const char * text
uint8_t GetSSDecimation()
static const char * GET_ARFI_INTER_PUSH_DELAY
virtual std::string GetDescription(const std::string &commandName)
bool GetBTransmitLocked()
static const char * SET_M_LINE_INDEX
int32_t GetARFIInterSetDelay()
static const char * SET_ARFI_START_SAMPLE
PlusStatus SetBMultiFocalZoneCount(int32_t count)
static const char * SET_TGC_OVERALL_GAIN
PlusStatus SetARFIPrePushLineRepeatCount(int32_t propertyValue)
static const char * GET_M_LINE_INDEX
static const char * GET_M_DEPTH
Manages devices that record image or positional data.
static const char * GET_TGC_OVERALL_GAIN
PlusStatus SetFirstGainValue(double value)
double GetBTransmitFNumber()
int32_t GetARFIStartSample()
PlusStatus SetARFIPostPushLineRepeatCount(int32_t propertyValue)
bool GetARFIIsX8BFEnabled()
int32_t GetBMultiFocalZoneCount()
static const char * GET_FPGA_REV_DATE_STRING
virtual void SetDeviceId(const std::string &deviceId)
static const char * SET_ARFI_FOCAL_DEPTH
PlusStatus SetARFITxTxCycleCount(uint16_t propertyValue)
int GetTransducerInternalID()
static const char * SET_MMODE_ENABLED
bool RespondWithCommandMessage
static const char * GET_B_TRANSMIT_CYCLE_COUNT
void SetARFIEnabled(bool value)
uint16_t GetARFITxTxCycleCount()
int32_t GetARFIPostPushLineRepeatCount()
PlusStatus SetARFIInterPushDelay(int32_t propertyValue)
bool GetMRevolvingEnabled()
static const char * GET_FIRST_GAIN_VALUE
PlusStatus SetSSDecimation(uint8_t value)
int32_t GetBFrameRateLimit()
PlusStatus SetARFIFocalPointDepth(int index, float depth)
void SetBTransmitLocked(bool value)
static const char * IS_SCANNING
std::string GetCommandValue() const
PhidgetLCD_Font int * width
std::string GetCommandIndex() const
void QueueCommandResponse(PlusStatus status, const std::string &message, const std::string &error="", const igtl::MessageBase::MetaDataMap *metaData=nullptr)
virtual vtkPlusDataCollector * GetDataCollector()
static const char * SET_FIRST_GAIN_VALUE
static const char * SET_B_BUBBLE_DESTRUCTION_CYCLE_COUNT
static const char * GET_ARFI_TX_CYCLE_WIDTH
static const char * SET_MPR_FREQUENCY
static const char * GET_DECIMATION
const char const char * value
Phidget_ChannelClass uint32_t * count
static const char * GET_FREEZE
static const char * GET_ARFI_PUSH_CONFIG
PlusStatus SetARFIInterSetDelay(int32_t propertyValue)
void SetBTransmitCycleCount(uint16_t value)
static const char * SET_B_BUBBLE_DESTRUCTION_ENABLED
void SetARFIStartSample(int32_t value)
static const char * SET_B_MULTIFOCAL_ZONE_COUNT
PlusStatus SetARFITxCycleWidth(uint8_t propertyValue)
static const char * SET_ALL_ARFI_FOCAL_DEPTHS
double GetOverallTimeGainCompensation()
static const char * GET_B_AMPLITUDE_MODULATION_ENABLED
void SetBFrameRateLimit(int32_t value)
static const char * GET_B_TRANSMIT_FNUMBER
virtual ~vtkPlusWinProbeCommand()
static const char * SET_ARFI_INTER_SET_DELAY
static const char * GET_M_REVOLVING_ENABLED
static const char * SET_M_DEPTH
static const char * SET_RF_MODE_ENABLED
static const char * SET_B_TRANSMIT_CYCLE_COUNT
static const char * SET_ARFI_TX_CYCLE_COUNT
static const char * GET_X8BF_ENABLED
static const char * SET_ARFI_LINE_TIMER
int32_t GetMAcousticLineCount()
set(gca, 'XTick', axisXRange(1):1:axisXRange(2))
static const char * GET_ARFI_LINE_TIMER
void SetCommandIndex(const std::string &text)
static const char * GET_TGC
static const char * SET_FOCAL_DEPTH
uint16_t GetARFITxCycleCount()
PlusStatus SetOverallTimeGainCompensation(double value)
static const char * SET_ARFI_POST_PUSH_LINE_REPEAT_COUNT
static const char * SET_ARFI_INTER_PUSH_DELAY
int32_t GetMPRFrequency()
float GetSpatialCompoundAngle()
static const char * GET_B_PRF
double GetBApodizationFNumber()
static const char * GET_ARFI_STOP_SAMPLE
void SetMAcousticLineCount(int32_t value)
static const char * GET_B_TX_FILTER_COEFFICIENT_SET
void SetSpatialCompoundEnabled(bool value)
static const char * SET_B_HARMONIC_ENABLED
virtual PlusStatus WriteConfiguration(vtkXMLDataElement *aConfig)
PlusCommandResponseList CommandResponseQueue
static const char * SET_B_FRAME_RATE_LIMIT
static const char * GET_MMODE_ENABLED
static const char * SET_ARFI_STOP_SAMPLE
static const char * GET_ARFI_START_SAMPLE
std::string GetCommandName() const
void SetBAmplitudeModulationEnabled(bool value)
static const char * SET_TGC
float GetARFIFocalPointDepth(int index)
virtual PlusStatus ReadConfiguration(vtkXMLDataElement *aConfig)
void SetBRFEnabled(bool value)
static const char * SET_B_TRANSMIT_FNUMBER
uint16_t GetBTransmitCycleCount()
PlusStatus SetARFILineTimer(uint16_t propertyValue)
static const char * GET_ARFI_PRE_PUSH_LINE_REPEAT_COUNT
static const char * SET_DECIMATION
static const char * GET_ARFI_ENABLED
static const char * GET_ARFI_FOCAL_DEPTH
void SetBBubbleContrastEnabled(bool value)
static const char * SET_M_REVOLVING_ENABLED
static const char * GET_ARFI_INTER_SET_DELAY
double GetTimeGainCompensation(int index)
std::string GetARFIPushConfigurationString()
void SetBBubbleDestructionEnabled(bool value)
void SetMLineIndex(int32_t value)
virtual PlusStatus Execute()
static const char * GET_ARFI_TX_TX_CYCLE_COUNT
virtual void GetCommandNames(std::list< std::string > &cmdNames)
static const char * SET_B_APODIZATION_FNUMBER
uint16_t GetARFILineTimer()
static const char * GET_TRANSDUCER_INTERNAL_ID