19 #include "PlusConfigure.h" 25 #include <ImagingModes.h> 26 #include <ulterius_def.h> 29 #include <vtkImageData.h> 30 #include <vtkInformation.h> 31 #include <vtkInformationVector.h> 32 #include <vtkMultiThreader.h> 33 #include <vtkObjectFactory.h> 34 #include <vtkStreamingDemandDrivenPipeline.h> 35 #include <vtkTimerLog.h> 36 #include <vtkUnsignedCharArray.h> 38 #include <vtksys/SystemTools.hxx> 57 #if ( _MSC_VER >= 1300 ) // Visual studio .NET 58 #pragma warning ( disable : 4311 ) 59 #pragma warning ( disable : 4312 ) 60 #define vtkGetWindowLong GetWindowLongPtr 61 #define vtkSetWindowLong SetWindowLongPtr 62 #define vtkGWL_USERDATA GWLP_USERDATA 63 #else // regular Visual studio 64 #define vtkGetWindowLong GetWindowLong 65 #define vtkSetWindowLong SetWindowLong 66 #define vtkGWL_USERDATA GWL_USERDATA 76 , AcquisitionDataType(udtBPost)
79 , CompressionStatus(0)
81 , ConnectionSetupDelayMs(3000)
82 , SharedMemoryStatus(0)
83 , RfAcquisitionMode(RF_ACQ_RF_ONLY)
84 , ImageGeometryChanged(false)
86 , UlteriusConnected(false)
87 , AutoClipEnabled(false)
88 , ImageGeometryOutputEnabled(false)
89 , ImagingParameterChanged(false)
98 if (vtkPlusSonixVideoSource::ActiveSonixDevice != NULL)
100 LOG_WARNING(
"There is already an active vtkPlusSonixVideoSource device. Ultrasonix SDK only supports one connection at a time, so the existing device is now deactivated and the newly created class is activated instead.");
102 vtkPlusSonixVideoSource::ActiveSonixDevice =
this;
108 vtkPlusSonixVideoSource::ActiveSonixDevice = NULL;
118 std::ostringstream version;
119 version <<
"UltrasonixSDK-" << PLUS_ULTRASONIX_SDK_MAJOR_VERSION <<
"." << PLUS_ULTRASONIX_SDK_MINOR_VERSION <<
"." << PLUS_ULTRASONIX_SDK_PATCH_VERSION;
120 return version.str();
131 bool vtkPlusSonixVideoSource::vtkPlusSonixVideoSourceNewFrameCallback(
void*
data,
int type,
int sz,
bool cine,
int frmnum)
133 if (
data == NULL || sz == 0)
135 LOG_DEBUG(
"vtkPlusSonixVideoSourceNewFrameCallback: called without data");
139 if (vtkPlusSonixVideoSource::ActiveSonixDevice != NULL)
145 LOG_ERROR(
"vtkPlusSonixVideoSource data callback but the ActiveSonixDevice is NULL. Disconnect between device and SDK.");
154 bool vtkPlusSonixVideoSource::vtkPlusSonixVideoSourceParamCallback(
void* paramId,
int ptX,
int ptY)
156 char* paramName = (
char*)paramId;
158 if (vtkPlusSonixVideoSource::ActiveSonixDevice == NULL)
160 LOG_ERROR(
"vtkPlusSonixVideoSource data callback but the ActiveSonixDevice is NULL. Disconnect between device and SDK.");
167 if (STRCASECMP(paramName,
"b-depth") == 0)
174 else if (STRCASECMP(paramName,
"probe id") == 0)
176 char probeName[200] = {0};
177 if (!vtkPlusSonixVideoSource::ActiveSonixDevice->
Ult->getActiveProbe(probeName, 200))
179 LOG_ERROR(
"Unable to retrieve probe name: " << vtkPlusSonixVideoSource::ActiveSonixDevice->
GetLastUlteriusError());
182 std::string probeString(probeName);
185 else if (STRCASECMP(paramName,
"") == 0)
199 bool parameterChanged = changedParameterIt->second;
200 if (!parameterChanged)
204 changedParameterIt->second =
false;
206 std::string parameterName = changedParameterIt->first;
207 if (parameterName ==
"b-freq")
212 else if (parameterName ==
"b-depth")
217 else if (parameterName ==
"b-gain")
222 else if (parameterName ==
"b-dyn log factor")
227 else if (parameterName ==
"b-initial zoom")
232 else if (parameterName ==
"sector")
237 else if (parameterName ==
"b-tgc")
242 else if (parameterName ==
"soundvelocity")
255 #if (PLUS_ULTRASONIX_SDK_MAJOR_VERSION < 4) 256 LOG_ERROR(
"Minimum required Ultasonix SDK version is 5.x");
266 std::vector<vtkPlusDataSource*> sources;
268 US_IMAGE_TYPE imgType = US_IMG_TYPE_XX;
272 pixelType = VTK_UNSIGNED_CHAR;
273 imgType = US_IMG_BRIGHTNESS;
277 pixelType = VTK_SHORT;
278 imgType = US_IMG_RF_I_LINE_Q_LINE;
282 LOG_ERROR(
"Received data type \'" << type <<
"\' is unsupported. Please report this to the PLUS team.");
294 const unsigned int frameSizeInBytes = frameSize[0] * frameSize[1] * frameBufferBytesPerPixel;
297 int numberOfBytesToSkip = 0;
298 #if (PLUS_ULTRASONIX_SDK_MAJOR_VERSION < 5) || (PLUS_ULTRASONIX_SDK_MAJOR_VERSION == 5 && PLUS_ULTRASONIX_SDK_MINOR_VERSION < 7) 299 if ((type == udtBPre) || (type == udtRF)
300 || (type == udtMPre) || (type == udtPWRF)
301 || (type == udtColorRF)
304 numberOfBytesToSkip = 4;
309 if ((type == udtBPre)
310 || (type == udtMPre) || (type == udtPWRF)
311 || (type == udtColorRF)
314 numberOfBytesToSkip = 4;
318 if (sz != frameSizeInBytes + numberOfBytesToSkip)
321 LOG_ERROR(
"Received frame size (" << sz <<
" bytes) doesn't match the buffer size (" << frameSizeInBytes + numberOfBytesToSkip <<
" bytes). Make sure the Ultrasonix SDK version used in Plus (" <<
GetSdkVersion() <<
") is compatible with the Exam software running on the ultrasound device.");
328 int currentDepth = -1;
329 if (!vtkPlusSonixVideoSource::ActiveSonixDevice->
Ult->getParamValue(
"b-depth", currentDepth))
331 LOG_WARNING(
"Failed to retrieve b-depth parameter");
333 uPoint currentPixelSpacingMicron;
334 currentPixelSpacingMicron.x = -1;
335 currentPixelSpacingMicron.y = -1;
336 if (!vtkPlusSonixVideoSource::ActiveSonixDevice->
Ult->getParamValue(
"microns", currentPixelSpacingMicron))
338 LOG_WARNING(
"Failed to retrieve bb-microns parameter");
340 uPoint currentTransducerOriginPixels;
341 currentTransducerOriginPixels.x = -1;
342 currentTransducerOriginPixels.y = -1;
343 if (!vtkPlusSonixVideoSource::ActiveSonixDevice->
Ult->getParamValue(
"origin", currentTransducerOriginPixels))
345 LOG_WARNING(
"Failed to retrieve bb-origin parameter");
369 igsioFieldMapType customFields;
373 std::ostringstream depthStr;
375 customFields[
"DepthMm"].first = FRAMEFIELD_FORCE_SERVER_SEND;
376 customFields[
"DepthMm"].second = depthStr.str();
378 std::ostringstream pixelSpacingStr;
380 customFields[
"PixelSpacingMm"].first = FRAMEFIELD_FORCE_SERVER_SEND;
381 customFields[
"PixelSpacingMm"].second = pixelSpacingStr.str();
383 std::ostringstream transducerOriginStr;
386 customFields[
"TransducerOriginPix"].first = FRAMEFIELD_FORCE_SERVER_SEND;
387 customFields[
"TransducerOriginPix"].second = transducerOriginStr.str();
391 unsigned char* deviceDataPtr = static_cast<unsigned char*>(dataPtr);
393 PlusStatus status = this->
AddVideoItemToVideoSources(sources, deviceDataPtr, aSource->
GetInputImageOrientation(), frameSize, pixelType, 1, imgType, numberOfBytesToSkip, this->
FrameNumber, UNDEFINED_TIMESTAMP, UNDEFINED_TIMESTAMP, &customFields);
402 this->
Ult->setMessaging(
false);
404 int requestedImagingDataType = 0;
407 LOG_ERROR(
"Failed to connect to sonix video device");
411 switch (requestedImagingDataType)
414 LOG_DEBUG(
"Imaging mode set: BMode");
420 LOG_DEBUG(
"Imaging mode set: RfMode");
421 #if (PLUS_ULTRASONIX_SDK_MAJOR_VERSION < 6) 430 LOG_DEBUG(
"Imaging mode set: BAndRfMode");
431 #if (PLUS_ULTRASONIX_SDK_MAJOR_VERSION < 6) 440 LOG_ERROR(
"Unsupported imaging data types are requested: " << requestedImagingDataType);
446 int connectionTried = 0;
447 bool initializationCompleted =
false;
448 while (!initializationCompleted)
454 this->
Ult->setDataToAcquire(0);
455 this->
Ult->disconnect();
456 vtkIGSIOAccurateTimer::Delay(0.5);
459 if (connectionTried > 0)
464 LOG_ERROR(
"Failed to connect to sonix video device");
467 LOG_DEBUG(
"Failed to connect to sonix video device, retry (" << connectionTried <<
")");
474 LOG_ERROR(
"Sonix host IP address is undefined");
479 if (!this->
Ult->connect(this->SonixIP))
481 LOG_ERROR(
"Initialize: couldn't connect to Ultrasonix at " << this->
SonixIP <<
" address (error message: " <<
GetLastUlteriusError() <<
")");
493 int actualImagingMode = -1;
496 LOG_ERROR(
"Initialize: Cannot check actual imaging mode");
501 LOG_ERROR(
"Initialize: Requested imaging mode could not be selected (requested: " << this->
ImagingMode <<
", actual: " << actualImagingMode);
520 if (this->
Ult->getParamValue(
"frame rate", aFrameRate))
528 #if (PLUS_ULTRASONIX_SDK_MAJOR_VERSION < 6) 534 LOG_ERROR(
"Initialize: Cannot set RF acquisition mode");
540 LOG_ERROR(
"Initialize: Cannot check actual RF acquisition mode");
545 LOG_ERROR(
"Initialize: Requested RF acquisition mode could not be selected (requested: " << this->
RfAcquisitionMode <<
", actual: " << actualRfAcquisitionMode);
561 LOG_ERROR(
"No B-mode data is available. Make sure the Ultrasonix SDK version used in Plus (" <<
GetSdkVersion() <<
") is compatible with the Exam software running on the ultrasound device.");
566 LOG_ERROR(
"Unable to configure B-mode video source");
574 LOG_ERROR(
"No Rf-mode data is available");
579 LOG_ERROR(
"Unable to configure Rf-mode video source");
585 if (!this->
Ult->setDataToAcquire(this->AcquisitionDataType))
592 this->
Ult->setCallback(vtkPlusSonixVideoSourceNewFrameCallback);
599 this->
Ult->setParamCallback(vtkPlusSonixVideoSourceParamCallback);
601 initializationCompleted =
true;
614 LOG_DEBUG(
"Successfully connected to sonix video device");
622 this->
Ult->setDataToAcquire(0);
623 this->
Ult->disconnect();
624 vtkIGSIOAccurateTimer::Delay(0.5);
632 if (this->
Ult->getFreezeState())
634 this->
Ult->toggleFreeze();
644 if (!this->
Ult->getFreezeState())
646 this->
Ult->toggleFreeze();
655 LOG_TRACE(
"vtkPlusSonixVideoSource::ReadConfiguration");
658 if (deviceConfig == NULL)
660 LOG_ERROR(
"Unable to continue configuration of " << this->
GetClassName() <<
". Could not find corresponding element.");
664 const char* ipAddress = deviceConfig->GetAttribute(
"IP");
665 if (ipAddress != NULL)
668 LOG_DEBUG(
"Sonix Video IP: " << ipAddress);
672 LOG_WARNING(
"Ultrasonix IP address is not defined. Defaulting to " << this->
GetSonixIP());
681 XML_READ_SCALAR_ATTRIBUTE_NONMEMBER_OPTIONAL(
int,
"Depth", depth, deviceConfig);
684 XML_READ_VECTOR_ATTRIBUTE_NONMEMBER_OPTIONAL(
int, 8,
"TimeGainCompensation", tgc, deviceConfig);
685 std::vector<double> tgcVec(tgc, tgc + 8);
688 XML_READ_SCALAR_ATTRIBUTE_NONMEMBER_OPTIONAL(
int,
"Sector", sector, deviceConfig);
691 XML_READ_SCALAR_ATTRIBUTE_NONMEMBER_OPTIONAL(
int,
"Gain", gain, deviceConfig);
694 XML_READ_SCALAR_ATTRIBUTE_NONMEMBER_OPTIONAL(
int,
"DynRange", dynRange, deviceConfig);
697 XML_READ_SCALAR_ATTRIBUTE_NONMEMBER_OPTIONAL(
int,
"Zoom", zoom, deviceConfig);
700 XML_READ_SCALAR_ATTRIBUTE_NONMEMBER_OPTIONAL(
int,
"Frequency", freq, deviceConfig);
703 XML_READ_SCALAR_ATTRIBUTE_NONMEMBER_OPTIONAL(
int,
"SoundVelocity", soundVel, deviceConfig);
709 XML_READ_SCALAR_ATTRIBUTE_OPTIONAL(
int,
Timeout, deviceConfig);
714 LOG_ERROR(
"Failed to change imaging parameters in the device");
728 deviceConfig->SetAttribute(
"ImagingMode",
"BMode");
730 #if (PLUS_ULTRASONIX_SDK_MAJOR_VERSION < 6) // RF acquisition mode is not supported on Ultrasonix SDK 6.x and above - see #489 in https://plustoolkit.github.io/legacytickets 733 deviceConfig->SetAttribute(
"ImagingMode",
"RfMode");
738 LOG_ERROR(
"Saving of unsupported ImagingMode requested!");
741 deviceConfig->SetAttribute(
"IP", this->
SonixIP);
743 deviceConfig->SetIntAttribute(
"Timeout", this->
Timeout);
757 const unsigned int MAX_ULTERIUS_ERROR_MSG_LENGTH = 256;
758 char err[MAX_ULTERIUS_ERROR_MSG_LENGTH + 1];
759 err[MAX_ULTERIUS_ERROR_MSG_LENGTH] = 0;
760 this->
Ult->getLastError(err, MAX_ULTERIUS_ERROR_MSG_LENGTH);
771 validatedParamValue = paramValue;
774 if (!this->
Ult->setParamValue(paramId, paramValue))
776 LOG_ERROR(
"vtkPlusSonixVideoSource::SetParamValue failed (paramId=" << paramId <<
", paramValue=" << paramValue <<
") " <<
GetLastUlteriusError());
779 validatedParamValue = paramValue;
789 validatedParamValue = paramValue;
792 if (!this->
Ult->setParamValue(paramId, paramValue))
794 std::stringstream ss;
795 ss << paramValue.v1 <<
", " << paramValue.v2 <<
", " << paramValue.v3 <<
", " << paramValue.v4 <<
", " << paramValue.v5 <<
", " <<
796 paramValue.v6 <<
", " << paramValue.v7 <<
", " << paramValue.v8;
797 LOG_ERROR(
"vtkPlusSonixVideoSource::SetParamValue failed (paramId=" << paramId <<
", paramValue=" << ss.str() <<
") " <<
GetLastUlteriusError());
800 validatedParamValue = paramValue;
810 paramValue = validatedParamValue;
814 if (!this->
Ult->getParamValue(paramId, paramValue))
816 LOG_ERROR(
"vtkPlusSonixVideoSource::GetParamValue failed (paramId=" << paramId <<
", paramValue=" << paramValue <<
") " <<
GetLastUlteriusError());
819 validatedParamValue = paramValue;
829 paramValue = validatedParamValue;
832 if (!this->
Ult->getParamValue(paramId, paramValue))
834 std::stringstream ss;
835 ss << paramValue.v1 <<
", " << paramValue.v2 <<
", " << paramValue.v3 <<
", " << paramValue.v4 <<
", " << paramValue.v5 <<
", " <<
836 paramValue.v6 <<
", " << paramValue.v7 <<
", " << paramValue.v8;
837 LOG_ERROR(
"vtkPlusSonixVideoSource::GetParamValue failed (paramId=" << paramId <<
", paramValue=" << ss.str() <<
") " <<
GetLastUlteriusError());
840 validatedParamValue = paramValue;
848 int frequencyHz = aFrequencyMHz * 1000000;
850 aFrequencyMHz = frequencyHz / 1000000.0;
863 int frequencyHz = aFrequencyMHz * 1000000;
865 aFrequencyMHz = frequencyHz / 1000000.0;
903 int gainUltrasonixUnits = 6000 * (aGainPercent / 100.0) - 3000;
905 aGainPercent = ((gainUltrasonixUnits + 3000.0) / 6000.0) * 100.0;
919 int gainUltrasonixUnits = 6000 * (aGainPercent / 100.0) - 3000;
921 aGainPercent = ((gainUltrasonixUnits + 3000.0) / 6000.0) * 100.0;
1005 Plus_uTGC tgcStruct;
1006 tgcStruct.v1 = tgc[0];
1007 tgcStruct.v2 = tgc[1];
1008 tgcStruct.v3 = tgc[2];
1009 tgcStruct.v4 = tgc[3];
1010 tgcStruct.v5 = tgc[4];
1011 tgcStruct.v6 = tgc[5];
1012 tgcStruct.v7 = tgc[6];
1013 tgcStruct.v8 = tgc[7];
1018 std::vector<int> vec = tgcStruct.toVector();
1019 std::vector<double> vecDouble(vec.begin(), vec.end());
1029 Plus_uTGC local = tgc;
1033 std::vector<int> vec = local.toVector();
1034 std::vector<double> vecDouble(vec.begin(), vec.end());
1044 Plus_uTGC tgcStruct;
1049 std::vector<int> vec = tgcStruct.toVector();
1050 std::vector<double> vecDouble(vec.begin(), vec.end());
1053 std::copy(tgcStruct.toVector().begin(), tgcStruct.toVector().end(), tgc);
1065 std::vector<int> vec = tgc.toVector();
1066 std::vector<double> vecDouble(vec.begin(), vec.end());
1076 int soundVelocity =
int(_arg);
1093 soundVelocity = float(soundVel);
1109 if (!this->
Ult->setCompressionStatus(aCompressionStatus))
1111 LOG_ERROR(
"vtkPlusSonixVideoSource::SetCompressionStatus failed: (compressionStatus=" << aCompressionStatus <<
") " <<
GetLastUlteriusError());
1128 aCompressionStatus = this->
Ult->getCompressionStatus();
1144 LOG_ERROR(
"vtkPlusSonixVideoSource::setTimeout failed: (aTimeout=" << aTimeout <<
") " <<
GetLastUlteriusError());
1147 this->
Ult->setTimeout(aTimeout);
1162 if (!this->
Ult->isDataAvailable((uData)(aAcquisitionDataType)))
1164 LOG_ERROR(
"vtkPlusSonixVideoSource::SetAcquisitionDataType failed: Requested the data aquisition type not available for selected imaging mode(" <<
GetLastUlteriusError() <<
")");
1168 if (!this->
Ult->setDataToAcquire(aAcquisitionDataType))
1170 LOG_ERROR(
"vtkPlusSonixVideoSource::SetAcquisitionDataType failed: couldn't request the data aquisition type " << aAcquisitionDataType <<
", " <<
GetLastUlteriusError());
1185 acquisitionDataType = this->
Ult->getDataToAcquire();
1199 if (!this->
Ult->selectMode(mode))
1201 LOG_ERROR(
"vtkPlusSonixVideoSource::SetImagingMode failed: couldn't select imaging mode " <<
mode <<
", " <<
GetLastUlteriusError());
1217 mode = this->
Ult->getActiveImagingMode();
1227 LOG_ERROR(
"vtkPlusSonixVideoSource::PrintListOfParameters failed: not connected");
1230 uParam prmDescriptor;
1231 LOG_INFO(
"Index; Id; Name; Source; Type; Unit");
1232 for (
int paramId = 0; this->
Ult->getParam(paramId, prmDescriptor); paramId++)
1234 LOG_INFO(paramId <<
"; " << prmDescriptor.id <<
"; " << prmDescriptor.name <<
"; " << prmDescriptor.source
1235 <<
"; " << prmDescriptor.type <<
"; " << prmDescriptor.unit);
1245 LOG_ERROR(
"vtkPlusSonixVideoSource::GetDisplayedFrameRate failed: not connected");
1249 if (!this->
Ult->getParamValue(
"frame rate", aFrameRate))
1251 LOG_ERROR(
"vtkPlusSonixVideoSource::GetDisplayedFrameRate failed: cannot retrieve displayed frame rate.");
1262 LOG_ERROR(
"vtkPlusSonixVideoSource::SetRFDecimation failed: not connected");
1265 if (!this->
Ult->setParamValue(
"rf-rf decimation", decimation))
1267 LOG_ERROR(
"vtkPlusSonixVideoSource::SetRFDecimation failed: cannot set decimation value.");
1278 LOG_ERROR(
"vtkPlusSonixVideoSource::SetPPFilter failed: not connected");
1281 if (!this->
Ult->setParamValue(
"b-filter type", filterIndex))
1283 LOG_ERROR(
"vtkPlusSonixVideoSource::SetPPFilter failed: cannot set filter value.");
1294 LOG_ERROR(
"vtkPlusSonixVideoSource::SetFrameRateLimit failed: not connected");
1297 if (!this->
Ult->setParamValue(
"max fr", frLimit))
1299 LOG_ERROR(
"vtkPlusSonixVideoSource::SetFrameRateLimit failed: cannot set maximum frame rate limit value.");
1314 if (!this->
Ult->setParamValue(
"rf-mode", mode))
1316 LOG_ERROR(
"vtkPlusSonixVideoSource::SetRfAcquisitionMode failed (paramId=rf-mode, paramValue=" <<
mode <<
") " <<
GetLastUlteriusError());
1328 if (!this->
Ult->getParamValue(
"rf-mode", iMode))
1354 LOG_WARNING(
"Unknown RF acquisition mode type: " << iMode);
1366 LOG_WARNING(
"vtkPlusSonixVideoSource is expecting at most two output channels and their are " << this->
OutputChannels.size() <<
" channels. First output channel will be used.");
1371 LOG_ERROR(
"No output channels defined for vtkPlusSonixVideoSource. Cannot proceed.");
1383 bool success = this->
Ult->getDataDescriptor(aValue, someVal);
1397 std::vector<vtkPlusDataSource*> sources;
1398 if ((aValue & udtBPost) > 0)
1401 if (!sources.empty())
1403 aSource = sources[0];
1406 else if ((aValue & udtRF) > 0)
1409 if (!sources.empty())
1411 aSource = sources[0];
1416 LOG_ERROR(
"Unsupported uData requested of Sonix video source.");
1420 if (aSource == NULL)
1422 LOG_ERROR(
"Unable to locate the video source for uData: " << aValue);
1426 if (!this->
Ult->isDataAvailable(aValue))
1428 LOG_ERROR(
"Data type is not available. " << aValue);
1433 uDataDesc aDataDescriptor;
1434 if (!this->
Ult->getDataDescriptor(aValue, aDataDescriptor))
1436 LOG_WARNING(
"Initialize: couldn't retrieve data descriptor (" <<
GetLastUlteriusError() <<
")");
1440 switch (aDataDescriptor.ss)
1453 std::swap(aDataDescriptor.h, aDataDescriptor.w);
1454 std::swap(aDataDescriptor.roi.ulx, aDataDescriptor.roi.uly);
1455 std::swap(aDataDescriptor.roi.urx, aDataDescriptor.roi.ury);
1456 std::swap(aDataDescriptor.roi.blx, aDataDescriptor.roi.bly);
1457 std::swap(aDataDescriptor.roi.brx, aDataDescriptor.roi.bry);
1460 LOG_ERROR(
"Unsupported Ulterius bit depth: " << aDataDescriptor.ss);
1466 std::array<int, 3> clipRectangleOrigin = {0, 0, 0};
1467 clipRectangleOrigin[0] = std::min(aDataDescriptor.roi.ulx, aDataDescriptor.roi.blx);
1468 clipRectangleOrigin[1] = std::min(aDataDescriptor.roi.uly, aDataDescriptor.roi.ury);
1469 std::array<int, 3> clipRectangleSize = {0, 0, 1};
1470 clipRectangleSize[0] = std::max(aDataDescriptor.roi.urx - aDataDescriptor.roi.ulx, aDataDescriptor.roi.brx - aDataDescriptor.roi.blx);
1471 clipRectangleSize[1] = std::max(aDataDescriptor.roi.bly - aDataDescriptor.roi.uly, aDataDescriptor.roi.bry - aDataDescriptor.roi.ury);
1484 requestedImagingDataType = 0;
1485 std::vector<vtkPlusDataSource*> sources;
1490 if (!sources.empty())
1498 if (!sources.empty())
1506 std::vector<int> vtkPlusSonixVideoSource::Plus_uTGC::toVector()
1508 std::vector<int> result;
1509 result.push_back(this->v1);
1510 result.push_back(this->v2);
1511 result.push_back(this->v3);
1512 result.push_back(this->v4);
1513 result.push_back(this->v5);
1514 result.push_back(this->v6);
1515 result.push_back(this->v7);
1516 result.push_back(this->v8);
1521 void vtkPlusSonixVideoSource::Plus_uTGC::fromVector(
const std::vector<int> input)
1523 if (input.size() != 8)
1527 this->v1 = input[0];
1528 this->v2 = input[1];
1529 this->v3 = input[2];
1530 this->v4 = input[3];
1531 this->v5 = input[4];
1532 this->v6 = input[5];
1533 this->v7 = input[6];
1534 this->v8 = input[7];
1538 std::string vtkPlusSonixVideoSource::Plus_uTGC::toString(
char separator)
1540 std::stringstream ss;
1541 ss << v1 << separator << v2 << separator << v3 << separator << v4 << separator << v5 << separator << v6 << separator << v7 << separator << v8;
1546 void vtkPlusSonixVideoSource::Plus_uTGC::fromString(
const std::string& input,
char separator)
1548 std::vector<int> vect;
1549 std::stringstream ss(input);
1555 if (ss.peek() == separator)
1560 this->fromVector(vect);
1573 LOG_ERROR(
"Failed to set frequency imaging parameter");
1582 LOG_ERROR(
"Failed to set depth imaging parameter");
1591 LOG_ERROR(
"Failed to set sector imaging parameter");
1600 LOG_ERROR(
"Failed to set gain imaging parameter");
1609 LOG_ERROR(
"Failed to set dynamic range imaging parameter");
1618 LOG_ERROR(
"Failed to set zoom imaging parameter");
1627 LOG_ERROR(
"Failed to set sound velocity imaging parameter");
static const char * KEY_DYNRANGE
virtual PlusStatus SetInputFrameSize(vtkPlusDataSource &aSource, unsigned int x, unsigned int y, unsigned int z)
PlusStatus GetDynRangeDevice(int &aDynRange)
vtkStandardNewMacro(vtkPlusSonixVideoSource)
static const std::string RFMODE_PORT_NAME
virtual const char * GetClassName()
PlusStatus GetSoundVelocityDevice(float &soundVelocity)
bool IsPending(const std::string ¶mName) const
int CurrentTransducerOriginPixels[3]
Values used in calculation of image to transducer matrix.
virtual PlusStatus SetOutputImageOrientation(US_IMAGE_ORIENTATION imageOrientation)
virtual PlusStatus WriteConfiguration(vtkXMLDataElement *config)
PlusStatus GetTimeGainCompensationDevice(int tgc[8])
PlusStatus SetDynRangeDevice(int aDynRange)
static const char * KEY_DEPTH
virtual void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
#define XML_FIND_DEVICE_ELEMENT_REQUIRED_FOR_WRITING(deviceConfig, rootConfigElement)
PlusStatus SetFrameRateLimitDevice(int frLimit)
static const char * KEY_FREQUENCY
static const std::string BMODE_PORT_NAME
PlusStatus GetDepthMm(double &aDepthMm) const
virtual PlusStatus GetRequestedImagingDataTypeFromSources(int &requestedImagingDataType)
PlusStatus GetSoundVelocity(float &aSoundVelocity) const
PlusStatus SetAcquisitionDataTypeDevice(int aAcquisitionDataType)
vtkPlusUsImagingParameters * ImagingParameters
Store the current imaging parameters.
bool RequireImageOrientationInConfiguration
PlusStatus SetImageType(US_IMAGE_TYPE imageType)
static const int CONNECT_RETRY_DELAY_SEC
PlusStatus PrintListOfImagingParametersFromDevice()
PlusStatus SetPending(const std::string ¶mName, bool pending)
virtual PlusStatus AddVideoItemToVideoSources(const std::vector< vtkPlusDataSource * > &videoSources, const igsioVideoFrame &frame, long frameNumber, double unfilteredTimestamp=UNDEFINED_TIMESTAMP, double filteredTimestamp=UNDEFINED_TIMESTAMP, const igsioFieldMapType *customFields=NULL) override
RfAcquisitionModeType
Defines RF acquisition mode types (0=B only, 1=RF only, 2=B and RF, 3=ChRF, 4=B and ChRF)
double CurrentPixelSpacingMm[3]
Values used in calculation of image to transducer matrix.
PlusStatus SetImagingModeDevice(int mode)
static const char * KEY_GAIN
virtual PlusStatus ReadConfiguration(vtkXMLDataElement *config)
RfAcquisitionModeType RfAcquisitionMode
void UpdateImagingParametersFromDevice()
PlusStatus GetVideoSourcesByPortName(const char *aPortName, std::vector< vtkPlusDataSource * > &sources)
PlusStatus SetPixelType(igsioCommon::VTKScalarPixelType pixelType)
PlusStatus SetTimeGainCompensation(const std::vector< double > &tgc)
PlusStatus SetGainDevice(int aGain)
PlusStatus SetSectorDevice(int aSector)
std::array< int, 3 > GetClipRectangleOrigin() const
PlusStatus GetGainPercent(double aGainPercent) const
PlusStatus GetRfAcquisitionModeDevice(RfAcquisitionModeType &mode)
virtual PlusStatus InternalDisconnect()
virtual PlusStatus WriteConfiguration(vtkXMLDataElement *)
std::map< std::string, bool > ChangedImagingParameters
PlusStatus SetRfAcquisitionModeDevice(RfAcquisitionModeType mode)
PlusStatus SetFrequencyDevice(double aFrequency)
virtual void SetCorrectlyConfigured(bool)
bool ImageGeometryOutputEnabled
unsigned long FrameNumber
virtual PlusStatus InternalConnect()
virtual void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
PlusStatus GetSectorPercent(double &aSectorPercent) const
virtual std::string GetSdkVersion()
PlusStatus GetFrequencyDevice(double &aFrequency)
virtual PlusStatus InternalApplyImagingParameterChange()
vtkXMLDataElement * FindThisDeviceElement(vtkXMLDataElement *rootXMLElement)
PlusStatus GetAcquisitionDataTypeDevice(int &acquisitionDataType)
int GetNumberOfBytesPerPixel()
PlusStatus GetDisplayedFrameRateDevice(int &aFrameRate)
virtual PlusStatus ReadConfiguration(vtkXMLDataElement *)
PlusStatus GetGainDevice(int &aGain)
void SetClipRectangleOrigin(const std::array< int, 3 > _arg)
PlusStatus GetDynRangeDb(double &aDynRangeDb) const
PlusStatus SetGainPercent(double aGainPercent)
static const char * KEY_SECTOR
vtkPlusSonixVideoSource()
PlusStatus SetDynRangeDb(double aDynRangeDb)
VTK interface for video input from Ultrasonix machine.
PlusStatus SetSectorPercent(double aSectorPercent)
virtual PlusStatus InternalStartRecording()
PlusStatus GetCompressionStatus(int &aCompressionStatus)
PlusStatus SetPPFilterDevice(int filterIndex)
PlusStatus GetParamValueDevice(char *paramId, int ¶mValue, int &validatedParamValue)
static const char * KEY_SOUNDVELOCITY
PlusStatus GetZoomFactor(double &aZoomFactor) const
virtual char * GetSonixIP()
PlusStatus GetDepthDevice(int &aDepth)
PlusStatus SetSoundVelocityDevice(float _arg)
virtual US_IMAGE_ORIENTATION GetInputImageOrientation()
PlusStatus AddFrameToBuffer(void *data, int type, int sz, bool cine, int frmnum)
PlusStatus SetRFDecimationDevice(int decimation)
virtual PlusStatus InternalStopRecording()
static const char * KEY_ZOOM
bool StartThreadForInternalUpdates
PlusStatus GetZoomDevice(int &aZoom)
PlusStatus SetTimeGainCompensationDevice(int tgc[8])
void SetClipRectangleSize(const std::array< int, 3 > _arg)
PlusStatus GetImagingModeDevice(int &mode)
PlusStatus SetFrequencyMhz(double aFrequencyMhz)
PlusStatus ConfigureVideoSource(uData aValue)
ChannelContainer OutputChannels
PlusStatus SetParamValueDevice(char *paramId, int paramValue, int &validatedParamValue)
PlusStatus GetFrequencyMhz(double &aFrequencyMhz) const
PlusStatus SetZoomFactor(double aZoomFactor)
virtual PlusStatus NotifyConfigured()
PlusStatus SetZoomDevice(int aZoom)
PlusStatus SetDepthDevice(int aDepth)
bool IsSet(const std::string ¶mName) const
PlusStatus SetTimeout(int aTimeout)
PlusStatus SetCompressionStatus(int aCompressionStatus)
virtual void SetSonixIP(const char *)
Abstract interface for ultrasound video devices.
FrameSizeType GetInputFrameSize() const
bool ImageGeometryChanged
bool HasDataType(uData aValue)
PlusStatus SetDepthMm(double aDepthMm)
bool WantDataType(uData aValue)
PlusStatus SetSoundVelocity(float aSoundVelocity)
virtual ~vtkPlusSonixVideoSource()
static const char * KEY_TGC
PlusStatus GetSectorDevice(int &aSector)
std::string GetLastUlteriusError()
virtual PlusStatus NotifyConfigured()
bool ImagingParameterChanged
static const int CONNECT_RETRY
int ConnectionSetupDelayMs
Interface to a 3D positioning tool, video source, or generalized data stream.