8 #include <PlusConfigure.h> 15 #include <vtkImageData.h> 16 #include <vtkObjectFactory.h> 20 #include <usbProbeDLL_net.h> 23 #define OEM_ID_INTERSON 0x00 24 #define TOLERANCE 0.001 32 class vtkPlusIntersonVideoSource::vtkInternal
39 bool BidirectionalScan;
43 double ClockFrequencyMHz;
44 int PulseFrequencyDivider;
51 int ProbeButtonPressCount;
52 bool EnableProbeButtonMonitoring;
54 HWND ImageWindowHandle;
57 std::vector<unsigned char> MemoryBitmapBuffer;
59 bmBITMAPINFO BitmapInfo;
61 static const int samplesPerLine = 2048;
73 virtual vtkPlusIntersonVideoSource::vtkInternal::~vtkInternal()
78 void vtkPlusIntersonVideoSource::vtkInternal::PrintSelf(ostream& os, vtkIndent indent)
82 os << indent <<
"Interpolate: " << this->Interpolate << std::endl;
83 os << indent <<
"BidirectionalScan: " << this->BidirectionalScan << std::endl;
84 os << indent <<
"Frozen: " << this->Frozen << std::endl;
85 os << indent <<
"ClockDivider: " << this->ClockDivider << std::endl;
86 os << indent <<
"ClockFrequencyMHz: " << this->ClockFrequencyMHz << std::endl;
87 os << indent <<
"PulseFrequencyDivider: " << this->PulseFrequencyDivider << std::endl;
88 os << indent <<
"LutCenter: " << this->LutCenter << std::endl;
89 os << indent <<
"LutWindow: " << this->LutWindow << std::endl;
90 os << indent <<
"ProbeButtonPressCount: " << this->ProbeButtonPressCount << std::endl;
91 os << indent <<
"EnableProbeButtonMonitoring: " << this->EnableProbeButtonMonitoring << std::endl;
95 void vtkPlusIntersonVideoSource::vtkInternal::CreateLinearTGC(
int tgcMin,
int tgcMax)
97 int tgc[samplesPerLine] = { 0 };
99 float m = (float)(tgcMax - tgcMin) / samplesPerLine;
100 for (
int x = 0;
x < samplesPerLine;
x++)
102 tgc[
x] = (
int)(m * (
float)
x) +
b;
108 void vtkPlusIntersonVideoSource::vtkInternal::CreateLinearTGC(
int initialTGC,
int midTGC,
int farTGC)
113 int tgc[samplesPerLine] = { 0 };
114 double firstSlope = (double)(midTGC - initialTGC) / (samplesPerLine / 2);
115 double secondSlope = (double)(farTGC - midTGC) / (samplesPerLine / 2);
116 for (
int x = 0;
x < samplesPerLine / 2;
x++)
118 tgc[
x] = (
int)(firstSlope * (
double)
x) + initialTGC;
119 tgc[samplesPerLine / 2 +
x] = (
int)(secondSlope * (
double)
x) + midTGC;
127 vtkPlusIntersonVideoSource::vtkInternal*
self = (vtkPlusIntersonVideoSource::vtkInternal*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
128 return DefWindowProc(hwnd, iMsg, wParam, lParam);
132 PlusStatus vtkPlusIntersonVideoSource::vtkInternal::InitializeDIB(
const FrameSizeType imageSize)
134 this->BitmapInfo.bmiHeader.biSize =
sizeof(BITMAPINFOHEADER);
135 this->BitmapInfo.bmiHeader.biWidth = imageSize[0];
136 this->BitmapInfo.bmiHeader.biHeight = -imageSize[1];
137 this->BitmapInfo.bmiHeader.biPlanes = 1;
138 this->BitmapInfo.bmiHeader.biBitCount = 8;
139 this->BitmapInfo.bmiHeader.biCompression = 0;
140 this->BitmapInfo.bmiHeader.biXPelsPerMeter = 0;
141 this->BitmapInfo.bmiHeader.biYPelsPerMeter = 0;
142 this->BitmapInfo.bmiHeader.biClrUsed = 0;
143 this->BitmapInfo.bmiHeader.biClrImportant = 0;
148 this->BitmapInfo.bmiHeader.biSizeImage = ((imageSize[0] * 8 + 31) & ~31) / 8 * imageSize[1];
150 for (
int i = 0;
i < 256;
i++)
152 this->BitmapInfo.bmiColors[
i].rgbRed =
i;
153 this->BitmapInfo.bmiColors[
i].rgbBlue =
i;
154 this->BitmapInfo.bmiColors[
i].rgbGreen =
i;
155 this->BitmapInfo.bmiColors[
i].rgbReserved = 0;
162 void CreateLinearLUT(
BYTE lut[],
int level,
int window)
164 int center = window / 2;
165 int left =
level - center;
166 int right =
level + center;
169 for (
int x = 0;
x < left;
x++)
175 for (
int x = right + 1;
x < 256;
x++)
181 float m = 255.0f / ((float)window);
193 for (
int x = startX;
x <= endX;
x++)
195 int y = (
int)(m * (
float)(
x - left) + 0.5f);
209 void CreateLUT(
BYTE lut[])
211 int center = this->LutWindow / 2;
212 int left = this->LutCenter - center;
213 int right = this->LutCenter + center;
218 for (
int x = 0;
x <= 255;
x++)
220 int y = (
int)((
float)
contrast / 256.0f * (float)(
x - 128) + brightness);
237 , Internal(new vtkInternal(this))
240 this->
Internal->BidirectionalScan =
true;
246 this->
Internal->PulseFrequencyDivider = 2;
260 this->
Internal->EnableProbeButtonMonitoring =
false;
261 this->
Internal->ProbeButtonPressCount = 0;
280 this->
Internal->PrintSelf(os, indent);
286 LOG_INFO(
"Probe attached");
293 LOG_INFO(
"Probe detached");
300 LOG_TRACE(
"vtkPlusIntersonVideoSource::InternalConnect");
302 LOG_DEBUG(
"Interson Bmode DLL version " << bmDLLVer() <<
", USB probe DLL version " << usbDLLVer());
311 usbErrorString errorStatus = { 0 };
312 ULONG status = usbFindProbes(errorStatus);
313 LOG_DEBUG(
"Find USB probes: status=" << status <<
", details: " << errorStatus);
314 if (status != ERROR_SUCCESS)
316 LOG_ERROR(
"Interson finding probes failed");
320 usbInitializeProbes();
325 int numberOfAttachedProbes = usbNumberAttachedProbes();
326 LOG_DEBUG(
"Number of attached probes: " << numberOfAttachedProbes);
327 if (numberOfAttachedProbes == 0)
329 LOG_ERROR(
"No Interson probes are attached");
332 if (numberOfAttachedProbes > 1)
334 LOG_WARNING(
"Multiple Interson probes are attached, using the first one");
337 FrameSizeType imageSize;
340 PVOID display = bmInitializeDisplay(imageSize[0] * imageSize[1]);
343 LOG_ERROR(
"Could not initialize the display");
347 this->
Internal->InitializeDIB(imageSize);
349 BYTE currentOemId = usbProbeOEMID();
352 LOG_WARNING(
"Probe OEM ID mismatch: " <<
OEM_ID_INTERSON <<
" (Interson) is expected, got " << currentOemId);
356 usbProbeHandle(0, &this->
Internal->ProbeHandle);
358 usbSelectProbe(this->
Internal->ProbeHandle);
360 usbSetWindowDepth(this->
Internal->ProbeHandle, imageSize[1]);
362 float soundVelocity = -1;
364 if (soundVelocity > 0)
376 bmSetDisplayOffset(0);
378 if (usbSetCineBuffers(32) != 32)
380 LOG_ERROR(
"Could not allocate Cine buffers.");
383 this->
Internal->RfDataBuffer = usbCurrentCineFrame();
385 usbSetUnidirectionalMode();
389 ptCenter.x = imageSize[0] / 2;
390 ptCenter.y = imageSize[1] / 2;
393 if (bmCalculateDisplay(imageSize[0], imageSize[1], ptCenter, this->
Internal->ProbeHandle, imageSize[0], rotation) == ERROR)
395 LOG_ERROR(
"CalculateDisplay failed");
398 std::string probeName;
400 LOG_DEBUG(
"Interson probe name: " << probeName <<
", ID: " << usbProbeID(this->
Internal->ProbeHandle));
405 LOG_ERROR(
"Unable to retrieve the video source in the IntersonVideo device.");
414 HINSTANCE hInst = GetModuleHandle(NULL);
417 wndclass.cbSize =
sizeof(wndclass);
418 wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_BYTEALIGNCLIENT;
420 wndclass.cbClsExtra = 0;
421 wndclass.cbWndExtra = 0;
422 wndclass.hInstance = hInst;
423 wndclass.hIcon = NULL;
424 wndclass.hCursor = NULL;
425 wndclass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
426 wndclass.lpszMenuName = NULL;
427 wndclass.lpszClassName = TEXT(
"ImageWindow");
428 wndclass.hIconSm = NULL;
429 RegisterClassEx(&wndclass);
431 int cxFixedFrameSize = GetSystemMetrics(SM_CXFIXEDFRAME);
432 int cyFixedFrameSize = GetSystemMetrics(SM_CYFIXEDFRAME);
433 int cxBorderSize = GetSystemMetrics(SM_CXSIZE);
434 int cyBorderSize = GetSystemMetrics(SM_CYSIZE);
435 int cxSize = GetSystemMetrics(SM_CXBORDER);
436 int cySize = GetSystemMetrics(SM_CYBORDER);
438 this->
Internal->ImageWindowHandle = CreateWindow(TEXT(
"ImageWindow"), TEXT(
"Ultrasound"),
439 WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, 0, 0,
440 imageSize[0] + 2 * cxFixedFrameSize + cxBorderSize + cxSize,
441 imageSize[1] + 2 * cyFixedFrameSize + cyBorderSize + cySize,
442 NULL, NULL, hInst, NULL);
444 if (this->
Internal->ImageWindowHandle == NULL)
446 LOG_ERROR(
"Failed to create capture window");
450 SetWindowLongPtr(this->
Internal->ImageWindowHandle, GWLP_USERDATA, (LONG)this->Internal);
453 HDC hdc = GetDC(this->
Internal->ImageWindowHandle);
455 GetClientRect(this->
Internal->ImageWindowHandle, &rect);
456 int cx = rect.right - rect.left;
457 int cy = rect.bottom - rect.top;
458 this->
Internal->DataHandle = CreateCompatibleBitmap(hdc, cx, cy);
459 GetObject(this->
Internal->DataHandle,
sizeof(BITMAP), (LPVOID) &this->Internal->Bitmap);
461 size_t toAllocate = (this->
Internal->Bitmap.bmWidth + 16) * (this->
Internal->Bitmap.bmHeight + 4);
462 this->
Internal->MemoryBitmapBuffer.resize(toAllocate, 0);
464 std::vector<double> gain;
466 if (gain.size() == 3)
468 double tgc[3] = { gain[0], gain[1], gain[2] };
479 LOG_DEBUG(
"Disconnect from Interson");
490 DeleteObject(this->
Internal->ProbeHandle);
491 DeleteObject(this->
Internal->DataHandle);
492 DeleteObject(this->
Internal->ImageWindowHandle);
514 bool nextFrameReady = (usbWaitFrame() == 1);
515 DWORD usbErrorCode = usbError();
517 switch (usbErrorCode)
522 LOG_ERROR(
"USB: FAILURE. Probe was removed?");
530 LOG_WARNING(
"USB timeout");
534 LOG_ERROR(
"Lost Probe Synchronization. Please check probe cables and restart.");
537 LOG_ERROR(
"USB: Stopped. Check probe and restart.");
540 LOG_ERROR(
"USB: Unknown USB error: " << usbErrorCode);
556 if (usbProbeButtonPressed() && this->
Internal->EnableProbeButtonMonitoring)
558 this->
Internal->ProbeButtonPressCount++;
563 this->
Internal->RfDataBuffer = usbCurrentCineFrame();
565 bmDrawImage(this->
Internal->ImageWindowHandle, this->Internal->RfDataBuffer, this->Internal->Bitmap, &(this->Internal->MemoryBitmapBuffer[0]), &this->Internal->BitmapInfo, this->Internal->Interpolate, this->Internal->BidirectionalScan);
569 std::vector<vtkPlusDataSource*> sources;
573 LOG_ERROR(
"Unable to retrieve the video source in the ICCapturing device.");
576 sources.push_back(aSource);
578 FrameSizeType imageSize;
584 LOG_DEBUG(
"Set up image buffer for Interson");
589 float depthScale = -1;
590 usbProbeDepthScale(this->
Internal->ProbeHandle, &depthScale);
592 std::string probeName;
595 LOG_INFO(
"Frame size: " << imageSize[0] <<
"x" << imageSize[1]
596 <<
", pixel type: " << vtkImageScalarTypeNameMacro(aSource->
GetPixelType())
597 <<
", probe sample frequency (Hz): " << usbProbeSampleFrequency(this->
Internal->ProbeHandle)
598 <<
", probe name: " << probeName
599 <<
", display zoom: " << bmDisplayZoom()
600 <<
", probe depth scale (mm/sample):" << depthScale
601 <<
", buffer image orientation: " << igsioCommon::GetStringFromUsImageOrientation(aSource->
GetInputImageOrientation()));
604 igsioFieldMapType customFields;
606 if (this->
Internal->EnableProbeButtonMonitoring)
608 std::ostringstream probeButtonPressCountString;
609 probeButtonPressCountString << this->
Internal->ProbeButtonPressCount;
610 customFields[
"ProbeButtonToDummyTransform"].second = std::string(
"1 0 0 ") + probeButtonPressCountString.str() +
" 0 1 0 0 0 0 1 0 0 0 0 1";
611 customFields[
"ProbeButtonToDummyTransformStatus"].second =
"OK";
615 imageSize, VTK_UNSIGNED_CHAR, 1, US_IMG_BRIGHTNESS, 0, this->
FrameNumber, UNDEFINED_TIMESTAMP, UNDEFINED_TIMESTAMP, &customFields) !=
PLUS_SUCCESS)
617 LOG_ERROR(
"Error adding item to video source " << aSource->
GetSourceId());
632 if (deviceConfig->GetAttribute(
"TimeGainCompensationPercent") != NULL)
635 deviceConfig->GetVectorAttribute(
"TimeGainCompensationPercent", 3, tgc);
636 std::vector<double> tgcVec;
637 tgcVec.assign(tgc, tgc + 3);
641 if (deviceConfig->GetAttribute(
"Intensity") != NULL)
644 deviceConfig->GetScalarAttribute(
"Intensity", intensity);
648 if (deviceConfig->GetAttribute(
"Contrast") != NULL)
651 deviceConfig->GetScalarAttribute(
"Contrast",
contrast);
655 if (deviceConfig->GetAttribute(
"DepthMm") != NULL)
658 deviceConfig->GetScalarAttribute(
"DepthMm", depthMm);
662 if (deviceConfig->GetAttribute(
"SoundVelocity") != NULL)
665 deviceConfig->GetScalarAttribute(
"SoundVelocity", soundVel);
669 if (deviceConfig->GetAttribute(
"ImageSize") != NULL)
671 int imageSize[2] = { 0,0 };
672 deviceConfig->GetVectorAttribute(
"ImageSize", 2, imageSize);
677 XML_READ_BOOL_ATTRIBUTE_OPTIONAL(EnableProbeButtonMonitoring, deviceConfig);
679 XML_READ_BOOL_ATTRIBUTE_NONMEMBER_OPTIONAL(
"Interpolate", this->
Internal->Interpolate, deviceConfig);
680 XML_READ_BOOL_ATTRIBUTE_NONMEMBER_OPTIONAL(
"BidirectionalScan", this->
Internal->BidirectionalScan, deviceConfig);
681 XML_READ_SCALAR_ATTRIBUTE_NONMEMBER_OPTIONAL(
int,
"ClockDivider", this->
Internal->ClockDivider, deviceConfig);
682 XML_READ_SCALAR_ATTRIBUTE_NONMEMBER_OPTIONAL(
int,
"PulseFrequencyDivider", this->
Internal->PulseFrequencyDivider, deviceConfig);
683 XML_READ_SCALAR_ATTRIBUTE_NONMEMBER_OPTIONAL(
double,
"LutCenter", this->
Internal->LutCenter, deviceConfig);
684 XML_READ_SCALAR_ATTRIBUTE_NONMEMBER_OPTIONAL(
double,
"LutWindow", this->
Internal->LutWindow, deviceConfig);
694 deviceConfig->SetAttribute(
"EnableProbeButtonMonitoring", this->
Internal->EnableProbeButtonMonitoring ?
"true" :
"false");
698 XML_WRITE_BOOL_ATTRIBUTE(EnableProbeButtonMonitoring, deviceConfig);
700 XML_WRITE_BOOL_ATTRIBUTE_NONMEMBER(
"Interpolate", this->
Internal->Interpolate, deviceConfig);
701 XML_WRITE_BOOL_ATTRIBUTE_NONMEMBER(
"BidirectionalScan", this->
Internal->BidirectionalScan, deviceConfig);
702 deviceConfig->SetIntAttribute(
"ClockDivider", this->
Internal->ClockDivider);
703 deviceConfig->SetIntAttribute(
"PulseFrequencyDivider", this->
Internal->PulseFrequencyDivider);
704 deviceConfig->SetDoubleAttribute(
"LutCenter", this->
Internal->LutCenter);
705 deviceConfig->SetDoubleAttribute(
"LutWindow", this->
Internal->LutWindow);
715 LOG_WARNING(
"vtkPlusIntersonVideoSource is expecting one output channel and there are " << this->
OutputChannels.size() <<
" channels. First output channel will be used.");
720 LOG_ERROR(
"No output channels defined for vtkPlusIntersonVideoSource. Cannot proceed.");
731 if (this->
Internal->ProbeHandle == NULL)
733 LOG_ERROR(
"vtkPlusIntersonVideoSource::FreezeDevice failed: device not connected");
736 if (!usbHardwareDetected())
738 LOG_ERROR(
"Freeze failed, no hardware is detected");
748 usbClearCineBuffers();
749 usbSetProbeFrequency(usbProbeScanFrequency(this->
Internal->ProbeHandle));
758 std::ostringstream versionString;
759 versionString <<
"Interson Bmode DLL v" << bmDLLVer() <<
", USB Probe DLL v" << usbDLLVer() << std::ends;
760 return versionString.str();
766 if (this->
Internal->ProbeHandle == NULL)
768 LOG_ERROR(
"vtkPlusIntersonVideoSource::GetSampleFrequencyDevice failed: device not connected");
771 aFreq = usbProbeSampleFrequency(this->
Internal->ProbeHandle);
772 LOG_TRACE(
"Current frequency is " << aFreq);
779 if (this->
Internal->ProbeHandle == NULL)
781 LOG_ERROR(
"vtkPlusIntersonVideoSource::SetWindowDepthDevice failed: device not connected");
784 aVel = usbProbeVelocity(this->
Internal->ProbeHandle);
792 if (this->
Internal->ProbeHandle == NULL)
794 LOG_ERROR(
"vtkPlusIntersonVideoSource::GetProbeVelocityDevice failed: device not connected");
797 aVel = usbProbeVelocity(this->
Internal->ProbeHandle);
798 LOG_TRACE(
"Current velocity is " << aVel);
805 if (this->
Internal->ProbeHandle == NULL)
807 LOG_ERROR(
"vtkPlusIntersonVideoSource::SetWindowDepthDevice failed: device not connected");
810 usbSetWindowDepth(this->
Internal->ProbeHandle, height);
817 if (this->
Internal->ProbeHandle == NULL)
819 LOG_ERROR(
"vtkPlusIntersonVideoSource::SetDepthMmDevice failed: device not connected");
823 std::vector<std::pair<double, double>> allowedModes;
825 int numberOfAllowedModes = allowedModes.size();
826 std::vector<int> possibleModes;
827 double chosenFrequencyMhz = -1;
828 double chosenDepthCm = -1;
829 for (
int i = 0;
i < numberOfAllowedModes;
i++)
831 if (allowedModes[
i].second == depthMm / 10)
833 possibleModes.push_back(
i);
836 if (possibleModes.size() == 1)
838 chosenFrequencyMhz = allowedModes[possibleModes[0]].first;
839 chosenDepthCm = allowedModes[possibleModes[0]].second;
841 else if (possibleModes.size() == 0)
844 double clockDivider = usbClockDivider();
845 double sampleFrequency = usbProbeSampleFrequency(this->
Internal->ProbeHandle);
846 double divider = usbPulseFrequency();
847 chosenFrequencyMhz = sampleFrequency / divider;
848 this->
Internal->PulseFrequencyDivider = sampleFrequency / chosenFrequencyMhz;
849 LOG_INFO(
"The probe does not allow the required depth." << chosenDepthCm <<
" cm depth was chosen instead.");
855 usbSet30MHzClock(this->
Internal->ProbeHandle);
856 this->
Internal->ClockFrequencyMHz = 30;
857 this->
Internal->ClockDivider = chosenDepthCm / 5;
866 usbSet48MHzClock(this->
Internal->ProbeHandle);
867 this->
Internal->ClockFrequencyMHz = 48;
868 this->
Internal->ClockDivider = chosenDepthCm / 3;
871 this->
Internal->PulseFrequencyDivider = this->
Internal->ClockFrequencyMHz / chosenFrequencyMhz;
872 usbSetPulseFrequency(this->
Internal->PulseFrequencyDivider);
873 usbSetClockDivider(this->
Internal->ProbeHandle, this->Internal->ClockDivider);
875 this->
Internal->ClockDivider = usbClockDivider();
884 if (this->
Internal->ProbeHandle == NULL)
886 LOG_ERROR(
"vtkPlusIntersonVideoSource::SetProbeFrequencyDevice failed: device not connected");
891 usbSetProbeFrequency(aFreq);
904 FrameSizeType frameSize = { imageSize[0], imageSize[1], 1 };
911 return this->
Internal->EnableProbeButtonMonitoring;
917 this->
Internal->EnableProbeButtonMonitoring = _arg;
923 if (this->
Internal->ProbeHandle == NULL)
925 LOG_ERROR(
"vtkPlusIntersonVideoSource::GetProbeVelocityDevice failed: device not connected");
930 usbSetVelocity(this->
Internal->ProbeHandle, value);
979 if (gainPercent[0] < 0 || gainPercent[1] < 0 || gainPercent[2] < 0)
981 LOG_ERROR(
"vtkPlusIntersonVideoSource::SetTimeGainCompensationPercent failed: Invalid values sent.")
985 std::vector<double> tgc;
986 tgc.assign(gainPercent, gainPercent + 3);
994 if (this->
Internal->ProbeHandle == NULL)
996 LOG_ERROR(
"vtkPlusIntersonVideoSource::SetTimeGainCompensationPercentDevice failed: device not connected");
1000 if (gainPercent[0] < 0 || gainPercent[1] < 0 || gainPercent[2] < 0)
1002 LOG_ERROR(
"vtkPlusIntersonVideoSource::SetTimeGainCompensationPercentDevice failed: Invalid values sent.");
1024 const double MAX_TGC(512);
1026 int nearGain = -255 + gainPercent[0] * MAX_TGC / 100;
1027 int midGain = -255 + gainPercent[1] * MAX_TGC / 100;
1028 int farGain = -255 + gainPercent[2] * MAX_TGC / 100;
1030 this->
Internal->CreateLinearTGC(nearGain, midGain, farGain);
1047 if (this->
Internal->ProbeHandle == NULL)
1049 LOG_ERROR(
"vtkPlusIntersonVideoSource::SetDisplayZoomDevice failed: device not connected");
1053 bmSetDisplayZoom(zoomFactor);
1054 LOG_TRACE(
"New zoom is " << bmDisplayZoom());
1072 double clockDivider = usbClockDivider();
1073 double sampleFrequency = usbProbeSampleFrequency(this->
Internal->ProbeHandle);
1074 double divider = usbPulseFrequency();
1075 unsigned is24MHz, is15MHz, is12MHz, is8MHz, is7_5MHz, is6MHz, is5MHz, is3_75MHz;
1076 std::pair<double, double> pair;
1077 is24MHz = usbProbeAllowedModes(this->
Internal->ProbeHandle) & P24MHZ;
1078 if (is24MHz & CLKDIV1)
1081 LOG_INFO(
"24 Mhz pulse frequency and 3 cm depth is an allowed mode for this probe");
1084 allowedModes.push_back(pair);
1086 if (is24MHz & CLKDIV2)
1089 LOG_INFO(
"24 Mhz pulse frequency and 6 cm depth is an allwoed mode for this probe");
1091 if (is24MHz & CLKDIV3)
1094 LOG_INFO(
"24 Mhz pulse frequency and 9 cm depth is an allwoed mode for this probe");
1096 if (is24MHz & CLKDIV4)
1099 LOG_INFO(
"24 Mhz pulse frequency and 12 cm depth is an allowed mode for this probe");
1102 is15MHz = usbProbeAllowedModes(this->
Internal->ProbeHandle) & P15MHZ;
1103 if (is15MHz & CLKDIV1)
1106 LOG_INFO(
"15 Mhz pulse frequency and 5 cm depth is an allowed mode for this probe");
1108 if (is15MHz & CLKDIV2)
1111 LOG_INFO(
"15 Mhz pulse frequency and 10 cm depth is an allowed mode for this probe");
1113 if (is15MHz & CLKDIV3)
1116 LOG_INFO(
"15 Mhz pulse frequency and 15 cm depth is an allowed mode for this probe");
1118 if (is15MHz & CLKDIV4)
1121 LOG_INFO(
"15 Mhz pulse frequency and 20 cm depth is an allowed mode for this probe");
1124 is12MHz = usbProbeAllowedModes(this->
Internal->ProbeHandle) & P12MHZ;
1125 if (is12MHz & CLKDIV1)
1128 LOG_INFO(
"12 Mhz pulse frequency and 5 cm depth is an allowed mode for this probe");
1130 if (is12MHz & CLKDIV2)
1133 LOG_INFO(
"12 Mhz pulse frequency and 10 cm depth is an allowed mode for this probe");
1135 if (is12MHz & CLKDIV3)
1138 LOG_INFO(
"12 Mhz pulse frequency and 15 cm depth is an allowed mode for this probe");
1140 if (is12MHz & CLKDIV4)
1143 LOG_INFO(
"12 Mhz pulse frequency and 20 cm depth is an allowed mode for this probe");
1145 is8MHz = usbProbeAllowedModes(this->
Internal->ProbeHandle) & P8MHZ;
1146 if (is8MHz & CLKDIV1)
1149 LOG_INFO(
"8 Mhz pulse frequency and 3 cm depth is an allowed mode for this probe");
1151 if (is8MHz & CLKDIV2)
1154 LOG_INFO(
"8 Mhz pulse frequency and 6 cm depth is an allowed mode for this probe");
1156 if (is8MHz & CLKDIV3)
1159 LOG_INFO(
"8 Mhz pulse frequency and 9 cm depth is an allowed mode for this probe");
1161 if (is8MHz & CLKDIV4)
1164 LOG_INFO(
"8 Mhz pulse frequency and 12 cm depth is an allowed mode for this probe");
1166 is7_5MHz = usbProbeAllowedModes(this->
Internal->ProbeHandle) & P7_5MHZ;
1167 if (is7_5MHz & CLKDIV1)
1170 LOG_INFO(
"7.5 Mhz pulse frequency and 5 cm depth is an allowed mode for this probe");
1172 if (is7_5MHz & CLKDIV2)
1175 LOG_INFO(
"7.5 Mhz pulse frequency and 10 cm depth is an allowed mode for this probe");
1177 if (is7_5MHz & CLKDIV3)
1180 LOG_INFO(
"7.5 Mhz pulse frequency and 15 cm depth is an allowed mode for this probe");
1182 if (is7_5MHz & CLKDIV4)
1185 LOG_INFO(
"7.5 Mhz pulse frequency and 20 cm depth is an allowed mode for this probe");
1187 is6MHz = usbProbeAllowedModes(this->
Internal->ProbeHandle) & P6MHZ;
1188 if (is6MHz & CLKDIV1)
1191 LOG_INFO(
"6 Mhz pulse frequency and 3 cm depth is an allowed mode for this probe");
1193 if (is6MHz & CLKDIV2)
1196 LOG_INFO(
"6 Mhz pulse frequency and 6 cm depth is an allowed mode for this probe");
1198 if (is6MHz & CLKDIV3)
1201 LOG_INFO(
"6 Mhz pulse frequency and 9 cm depth is an allowed mode for this probe");
1203 if (is6MHz & CLKDIV4)
1206 LOG_INFO(
"6 Mhz pulse frequency and 12 cm depth is an allowed mode for this probe");
1208 is5MHz = usbProbeAllowedModes(this->
Internal->ProbeHandle) & P5MHZ;
1209 if (is5MHz & CLKDIV1)
1212 LOG_INFO(
"5 Mhz pulse frequency and 5 cm depth is an allowed mode for this probe");
1214 if (is5MHz & CLKDIV2)
1217 LOG_INFO(
"5 Mhz pulse frequency and 10 cm depth is an allowed mode for this probe");
1219 if (is5MHz & CLKDIV3)
1222 LOG_INFO(
"5 Mhz pulse frequency and 15 cm depth is an allowed mode for this probe");
1224 if (is5MHz & CLKDIV4)
1227 LOG_INFO(
"5 Mhz pulse frequency and 20 cm depth is an allowed mode for this probe");
1229 is3_75MHz = usbProbeAllowedModes(this->
Internal->ProbeHandle) & P3_75MHZ;
1230 if (is3_75MHz & CLKDIV1)
1233 LOG_INFO(
"3.75 Mhz pulse frequency and 5 cm depth is an allowed mode for this probe");
1236 allowedModes.push_back(pair);
1238 if (is3_75MHz & CLKDIV2)
1241 LOG_INFO(
"3.75 Mhz pulse frequency and 10 cm depth is an allowed mode for this probe");
1244 allowedModes.push_back(pair);
1246 if (is3_75MHz & CLKDIV3)
1251 allowedModes.push_back(pair);
1252 LOG_INFO(
"3.75 Mhz pulse frequency and 15 cm depth is an allowed mode for this probe");
1254 if (is3_75MHz & CLKDIV4)
1259 allowedModes.push_back(pair);
1260 LOG_INFO(
"3.75 Mhz pulse frequency and 20 cm depth is an allowed mode for this probe");
1270 if (this->
Internal->ProbeHandle == NULL)
1272 LOG_ERROR(
"vtkPlusIntersonVideoSource::GetProbeNameDevice failed: device not connected");
1279 typedef TCHAR usbProbeNameStringSafe[1000];
1281 usbProbeNameStringSafe probeNameWideStringPtr = { 0 };
1282 usbProbeName(this->
Internal->ProbeHandle, probeNameWideStringPtr);
1285 char probeNamePrintable[usbProbeNameMaxLength + 1] = { 0 };
1286 wcstombs(probeNamePrintable, (
wchar_t*)probeNameWideStringPtr, usbProbeNameMaxLength);
1288 probeName = probeNamePrintable;
1298 LOG_ERROR(
"Unable to store incoming parameter set.");
1319 LOG_ERROR(
"Failed to set depth imaging parameter");
1332 LOG_ERROR(
"Failed to set frequency imaging parameter");
1339 std::vector<double> tgcVec;
1341 double tgc[3] = { tgcVec[0], tgcVec[1], tgcVec[2] };
1349 LOG_ERROR(
"Failed to set time gain compensation parameter");
1364 LOG_ERROR(
"Failed to set intensity and contrast parameters");
1377 LOG_ERROR(
"Failed to set zoom parameter");
1390 LOG_ERROR(
"Failed to set sound velocity parameter");
vtkPlusIntersonVideoSource()
virtual PlusStatus WriteConfiguration(vtkXMLDataElement *config)
PlusStatus SetTimeGainCompensationPercentDevice(double gainPercent[3])
const char int const char const char Phidget_LogLevel level
bool IsPending(const std::string ¶mName) const
PlusStatus SetContrast(int value)
virtual PlusStatus InternalStartRecording()
PlusStatus GetSampleFrequencyDevice(double &aFreq)
static const char * KEY_DEPTH
This class is used to store a configuration of the imaging parameters of an ultrasound video device....
#define XML_FIND_DEVICE_ELEMENT_REQUIRED_FOR_WRITING(deviceConfig, rootConfigElement)
PlusStatus SetTimeGainCompensationPercent(double gainPercent[3])
std::string GetSourceId() const
static const char * KEY_FREQUENCY
bool GetEnableProbeButtonMonitoring() const
PlusStatus SetContrast(double aContrast)
PlusStatus GetDepthMm(double &aDepthMm) const
PlusStatus SetZoomFactor(float zoomFactor)
PlusStatus SetInputFrameSize(unsigned int x, unsigned int y, unsigned int z)
PlusStatus SetLookupTableDevice(double intensity, double contrast)
~vtkPlusIntersonVideoSource()
PlusStatus GetSoundVelocity(float &aSoundVelocity) const
virtual std::string GetSdkVersion()
vtkPlusUsImagingParameters * ImagingParameters
Store the current imaging parameters.
bool RequireImageOrientationInConfiguration
PlusStatus SetImageType(US_IMAGE_TYPE imageType)
PlusStatus SetSoundVelocity(double value)
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
virtual PlusStatus SetNewImagingParameters(const vtkPlusUsImagingParameters &newImagingParameters)
PlusStatus SetFrequencyMhz(float freq)
PlusStatus SetPixelType(igsioCommon::VTKScalarPixelType pixelType)
PlusStatus SetTimeGainCompensation(const std::vector< double > &tgc)
PlusStatus SetImageSize(int imageSize[2])
Initial rotation matrix b
virtual PlusStatus InternalConnect()
virtual PlusStatus WriteConfiguration(vtkXMLDataElement *)
static const char * KEY_INTENSITY
virtual igsioCommon::VTKScalarPixelType GetPixelType()
virtual PlusStatus Disconnect()
PlusStatus GetTimeGainCompensation(std::vector< double > &tgc) const
PlusStatus GetFirstActiveOutputVideoSource(vtkPlusDataSource *&aVideoSource)
int CALLBACK ProbeAttached()
PlusStatus SetWindowDepthDevice(int height)
unsigned long FrameNumber
virtual PlusStatus InternalDisconnect()
virtual void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
virtual PlusStatus NotifyConfigured()
PlusStatus SetProbeVoltage(float aVoltage)
virtual PlusStatus ReadConfiguration(vtkXMLDataElement *)
PlusStatus GetContrast(double &aContrast) const
virtual PlusStatus StopRecording()
int CALLBACK ProbeDetached()
PlusStatus SetFrequencyMhzDevice(float aFreq)
#define XML_FIND_DEVICE_ELEMENT_REQUIRED_FOR_READING(deviceConfig, rootConfigElement)
PlusStatus SetImageSize(const FrameSizeType &imageSize)
virtual PlusStatus SetNewImagingParameters(const vtkPlusUsImagingParameters &newImagingParameters)
PlusStatus SetDynRangeDb(double aDynRangeDb)
PlusStatus GetSoundVelocity(double &aVel)
PlusStatus SetSectorPercent(double aSectorPercent)
static const char * KEY_CONTRAST
vtkStandardNewMacro(vtkPlusIntersonVideoSource)
PlusStatus GetImageSize(FrameSizeType &imageSize) const
static const char * KEY_SOUNDVELOCITY
PlusStatus GetProbeAllowedModes(std::vector< std::pair< double, double > > &allowedModes)
PlusStatus GetZoomFactor(double &aZoomFactor) const
const char const char * value
virtual US_IMAGE_ORIENTATION GetInputImageOrientation()
PlusStatus GetProbeVoltage(float &aVoltage) const
static const char * KEY_ZOOM
bool StartThreadForInternalUpdates
PhidgetLCD_Font int int * height
virtual PlusStatus InternalApplyImagingParameterChange()
PlusStatus SetIntensity(double aIntensity)
PlusStatus SetFrequencyMhz(double aFrequencyMhz)
virtual void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
ChannelContainer OutputChannels
PlusStatus WaitForFrame()
PlusStatus GetFrequencyMhz(double &aFrequencyMhz) const
Direction vectors of rods y
PlusStatus SetZoomFactor(double aZoomFactor)
virtual PlusStatus NotifyConfigured()
PlusStatus SetDepthMmDevice(double depthMm)
PlusStatus SetSoundVelocityDevice(double velocity)
PlusStatus GetIntensity(double &aIntensity) const
static LRESULT CALLBACK ImageWindowProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
PlusStatus SetIntensity(int value)
void SetEnableProbeButtonMonitoring(bool _arg)
bool IsSet(const std::string ¶mName) const
PlusStatus FreezeDevice(bool freeze)
Abstract interface for ultrasound video devices.
virtual PlusStatus InternalStopRecording()
PlusStatus GetProbeNameDevice(std::string &probeName)
PlusStatus SetZoomFactorDevice(float zoomFactor)
PlusStatus SetDynRangeDb(double value)
PlusStatus SetSectorPercent(double value)
PlusStatus SetDepthMm(double aDepthMm)
Class for acquiring ultrasound images from Interson USB ultrasound systems.
PlusStatus SetSoundVelocity(float aSoundVelocity)
virtual PlusStatus ReadConfiguration(vtkXMLDataElement *config)
static const char * KEY_TGC
PlusStatus GetSoundVelocityDevice(float &aVel)
virtual int GetNumberOfItems()
PlusStatus InternalUpdate()
PlusStatus SetDepthMm(double depthMm)
Interface to a 3D positioning tool, video source, or generalized data stream.