17 #include "PlusConfigure.h" 20 #include <porta_params_def.h> 21 #include <ImagingModes.h> 23 #if (PLUS_ULTRASONIX_SDK_MAJOR_VERSION < 6) 24 #include <porta_std_includes.h> 26 #include <porta_def.h> 27 #include <porta_wrapper.h> 40 #include <vtkStreamingDemandDrivenPipeline.h> 41 #include <vtkTimerLog.h> 42 #include <vtkUnsignedCharArray.h> 43 #include <vtksys/SystemTools.hxx> 44 #include <vtkMatrix4x4.h> 45 #include <vtkTransform.h> 46 #include <vtkImageData.h> 47 #include <vtkInformation.h> 48 #include <vtkInformationVector.h> 49 #include <vtkMultiThreader.h> 50 #include <vtkObjectFactory.h> 54 #pragma warning (push, 3) 65 #if ( _MSC_VER >= 1300 ) // Visual studio .NET 66 #pragma warning ( disable : 4311 ) 67 #pragma warning ( disable : 4312 ) 68 #define vtkGetWindowLong GetWindowLongPtr 69 #define vtkSetWindowLong SetWindowLongPtr 70 #define vtkGWL_USERDATA GWLP_USERDATA 71 #else // regular Visual studio 72 #define vtkGetWindowLong GetWindowLong 73 #define vtkSetWindowLong SetWindowLong 74 #define vtkGWL_USERDATA GWL_USERDATA 77 #if (PLUS_ULTRASONIX_SDK_MAJOR_VERSION >= 6) 80 int portaImportChromaMap(
int index,
const unsigned int* lut)
82 LOG_ERROR(
"portaImportChromaMap function is missing from Ultrasonix Porta SDK");
87 #include "porta_wrapper.cpp" 105 vtkPlusSonixPortaVideoSource::SetInstance(NULL);
111 , AutoClipEnabled(false)
113 , ImageGeometryChanged(false)
115 this->
Porta =
new porta;
117 this->ProbeInformation =
new probeInfo;
121 this->PortaBModeWidth = 480;
122 this->PortaBModeHeight = 436;
123 this->ImageBuffer = NULL;
125 this->PortaProbeName = NULL;
126 this->PortaSettingPath = NULL;
127 this->PortaLicensePath = NULL;
128 this->PortaFirmwarePath = NULL;
129 this->PortaLUTPath = NULL;
130 this->PortaCineSize = 256 * 1024 * 1024;
131 this->FirstCallToAddFrameToBuffer =
true;
132 this->VolumeIndex = 0;
133 this->FrameIndexInVolume = 0;
135 this->FramePerVolume = -1;
136 this->StepPerFrame = -1;
137 this->MotorRotationRangeDeg = -1;
144 this->LastRotationCcw =
false;
153 this->SetPortaProbeName(NULL);
154 this->SetPortaSettingPath(NULL);
155 this->SetPortaLicensePath(NULL);
156 this->SetPortaFirmwarePath(NULL);
157 this->SetPortaLUTPath(NULL);
158 this->SetImageToTransducerTransformName(NULL);
160 delete [] this->ImageBuffer;
161 this->ImageBuffer = NULL;
163 delete this->ProbeInformation;
164 this->ProbeInformation = NULL;
183 if (!vtkPlusSonixPortaVideoSource::Instance)
186 vtkPlusSonixPortaVideoSource::Instance = (
vtkPlusSonixPortaVideoSource*)vtkObjectFactory::CreateInstance(
"vtkPlusSonixPortaVideoSource");
188 if (!vtkPlusSonixPortaVideoSource::Instance)
193 if (!vtkPlusSonixPortaVideoSource::Instance)
199 return (vtkPlusSonixPortaVideoSource::Instance);
205 if (vtkPlusSonixPortaVideoSource::Instance == instance)
211 if (vtkPlusSonixPortaVideoSource::Instance)
213 vtkPlusSonixPortaVideoSource::Instance->Delete();
214 vtkPlusSonixPortaVideoSource::Instance = NULL;
217 vtkPlusSonixPortaVideoSource::Instance = instance;
225 instance->Register(NULL);
229 std::string vtkPlusSonixPortaVideoSource::GetSdkVersion()
231 std::ostringstream version;
232 version <<
"UltrasonixSDK-" << PLUS_ULTRASONIX_SDK_MAJOR_VERSION <<
"." << PLUS_ULTRASONIX_SDK_MINOR_VERSION <<
"." << PLUS_ULTRASONIX_SDK_PATCH_VERSION;
233 return version.str();
237 void vtkPlusSonixPortaVideoSource::PrintSelf(ostream& os, vtkIndent indent)
240 os << indent <<
"Imaging mode: " << this->
ImagingMode <<
"\n";
241 os << indent <<
"Frequency: " << this->
Frequency <<
"MHz\n";
246 #if (PLUS_ULTRASONIX_SDK_MAJOR_VERSION < 5) || (PLUS_ULTRASONIX_SDK_MAJOR_VERSION == 5 && PLUS_ULTRASONIX_SDK_MINOR_VERSION < 7) 248 bool vtkPlusSonixPortaVideoSource::vtkPlusSonixPortaVideoSourceNewFrameCallback(
void* param,
int id)
249 #elif (PLUS_ULTRASONIX_SDK_MAJOR_VERSION < 6) 251 bool vtkPlusSonixPortaVideoSource::vtkPlusSonixPortaVideoSourceNewFrameCallback(
void* param,
int id,
int header)
253 int vtkPlusSonixPortaVideoSource::vtkPlusSonixPortaVideoSourceNewFrameCallback(
void* param,
int id,
int header)
262 bool motorRotationCcw = (header & 0x00000002) > 0;
263 int motorStepCount = (header & 0xFFFC) >> 2;
265 vtkPlusSonixPortaVideoSource::GetInstance()->
AddFrameToBuffer(param,
id, motorRotationCcw, motorStepCount);
283 LOG_ERROR(
"No output channels defined for vtkPlusSonixPortaVideoSource");
288 FrameSizeType frameSize = {0, 0, 0};
293 LOG_ERROR(
"Unable to retrieve the video source in the SonixPorta device.");
298 int numberOfBytesToSkip = 4;
301 if (this->FirstCallToAddFrameToBuffer && this->MotorRotationRangeDeg > 0)
303 this->
Porta->setParam(prmMotorStatus, 0);
304 this->
Porta->setParam(prmMotorStatus, 1);
305 this->FirstCallToAddFrameToBuffer =
false;
306 this->LastRotationCcw = !motorRotationCcw;
309 this->VolumeIndex = motorRotationCcw ? -1 : 0;
310 this->FrameIndexInVolume = 0;
313 if (this->ImageBuffer == NULL)
315 LOG_ERROR(
"vtkPlusSonixPortaVideoSource::AddFrameToBuffer failed: no image buffer is allocated");
318 this->
Porta->getBwImage(0, this->ImageBuffer,
false);
321 unsigned char* deviceDataPtr = static_cast<unsigned char*>(this->ImageBuffer);
323 double motorAngleDeg = 0;
324 if (this->ProbeInformation->motorized)
326 if (motorRotationCcw)
328 motorAngleDeg = -this->MotorRotationStartAngleDeg + motorStepCount * this->MotorRotationPerStepDeg;
332 motorAngleDeg = this->MotorRotationStartAngleDeg - motorStepCount * this->MotorRotationPerStepDeg;
334 if (this->LastRotationCcw != motorRotationCcw)
337 this->LastRotationCcw = motorRotationCcw;
339 this->FrameIndexInVolume = 0;
346 int currentDepth = -1;
347 if (!this->
Porta->getParam(
"b-depth", currentDepth))
349 LOG_WARNING(
"Failed to retrieve b-depth parameter");
352 int currentPixelSpacingMicron[2] = {-1, -1};
353 if (!this->
Porta->getMicronsPerPixel(this->DisplayIndex, currentPixelSpacingMicron[0], currentPixelSpacingMicron[1]))
355 LOG_WARNING(
"Failed to retrieve pixel spacing from Porta");
358 int line = this->ProbeInformation->elements / 2;
360 int currentTransducerOriginPixels[2] = {-1, -1};
361 if (!this->
Porta->getPixelCoordinates(this->DisplayIndex,
line, sample, currentTransducerOriginPixels[0], currentTransducerOriginPixels[1],
false))
363 LOG_WARNING(
"Failed to retrieve transducer origin parameter from Porta");
377 igsioFieldMapType customFields;
379 std::ostringstream frameIndexInVolumeStr;
380 frameIndexInVolumeStr << this->FrameIndexInVolume;
381 customFields[
"FrameIndex"].first = FRAMEFIELD_FORCE_SERVER_SEND;
382 customFields[
"FrameIndex"].second = frameIndexInVolumeStr.str();
383 std::ostringstream volumeIndexStr;
384 volumeIndexStr << this->VolumeIndex;
385 customFields[
"VolumeIndex"].first = FRAMEFIELD_FORCE_SERVER_SEND;
386 customFields[
"VolumeIndex"].second = volumeIndexStr.str();
387 std::ostringstream motorAngleDegStr;
388 motorAngleDegStr << motorAngleDeg;
389 customFields[
"MotorAngleDeg"].first = FRAMEFIELD_FORCE_SERVER_SEND;
390 customFields[
"MotorAngleDeg"].second = motorAngleDegStr.str();
391 customFields[
"MotorToMotorRotatedTransform"].first = FRAMEFIELD_NONE;
392 customFields[
"MotorToMotorRotatedTransform"].second = this->GetMotorToMotorRotatedTransform(motorAngleDeg);
393 customFields[
"MotorToMotorRotatedTransformStatus"].first = FRAMEFIELD_NONE;
394 customFields[
"MotorToMotorRotatedTransformStatus"].second =
"OK";
395 std::ostringstream motorRotatedToTransducerTransformStr;
396 motorRotatedToTransducerTransformStr <<
"1 0 0 0 0 1 0 " << -this->ProbeInformation->motorRadius * 0.001 <<
" 0 0 1 0 0 0 0 1";
397 customFields[
"MotorRotatedToTransducerTransform"].second = motorRotatedToTransducerTransformStr.str();
398 customFields[
"MotorRotatedToTransducerTransformStatus"].first = FRAMEFIELD_NONE;
399 customFields[
"MotorRotatedToTransducerTransformStatus"].second =
"OK";
401 PlusStatus status = this->
AddVideoItemToVideoSource(*aSource, deviceDataPtr, aSource->
GetInputImageOrientation(), frameSize, VTK_UNSIGNED_CHAR, 1, US_IMG_BRIGHTNESS, numberOfBytesToSkip, id, UNDEFINED_TIMESTAMP, UNDEFINED_TIMESTAMP, &customFields);
408 std::string vtkPlusSonixPortaVideoSource::GetMotorToMotorRotatedTransform(
double angle)
410 vtkSmartPointer<vtkMatrix4x4> matrix = vtkSmartPointer<vtkMatrix4x4>::New();
412 vtkSmartPointer<vtkTransform> transform = vtkSmartPointer<vtkTransform>::New();
413 transform->SetMatrix(matrix);
414 transform->RotateX(angle);
415 transform->GetMatrix(matrix);
417 std::ostringstream matrixToString;
419 matrix->GetElement(0, 0) <<
" " << matrix->GetElement(0, 1) <<
" " << matrix->GetElement(0, 2) <<
" " << matrix->GetElement(0, 3) <<
" " <<
420 matrix->GetElement(1, 0) <<
" " << matrix->GetElement(1, 1) <<
" " << matrix->GetElement(1, 2) <<
" " << matrix->GetElement(1, 3) <<
" " <<
421 matrix->GetElement(2, 0) <<
" " << matrix->GetElement(2, 1) <<
" " << matrix->GetElement(2, 2) <<
" " << matrix->GetElement(2, 3) <<
" " <<
422 matrix->GetElement(3, 0) <<
" " << matrix->GetElement(3, 1) <<
" " << matrix->GetElement(3, 2) <<
" " << matrix->GetElement(3, 3) ;
424 return matrixToString.str();
433 LOG_ERROR(this->
GetDeviceId() <<
": Unable to retrieve video source.");
438 delete [] this->ImageBuffer;
439 this->ImageBuffer =
new unsigned char [ this->PortaBModeWidth * this->PortaBModeHeight * 4 ];
440 if (this->ImageBuffer == NULL)
442 LOG_ERROR(
"vtkPlusSonixPortaVideoSource constructor: not enough memory for ImageBuffer");
446 LOG_TRACE(
"InternalConnect start");
447 if (this->PortaSettingPath == 0 ||
448 this->PortaFirmwarePath == 0 ||
449 this->PortaLicensePath == 0 ||
450 this->PortaLUTPath == 0)
452 LOG_ERROR(
"One of the Porta paths has not been set (check PortaSettingPath, PortaFirmwarePath, PortaLicensePath, PortaLUTPath attributes)");
456 #if (PLUS_ULTRASONIX_SDK_MAJOR_VERSION >= 6) 461 int channels = (this->
Usm == 2) ? 32 : 64;
463 LOG_TRACE(
"Porta initialization:" 464 <<
" PortaFirmwarePath=" << this->PortaFirmwarePath
465 <<
" PortaSettingPath=" << this->PortaSettingPath
466 <<
" PortaLicensePath=" << this->PortaLicensePath
467 <<
" PortaLUTPath=" << this->PortaLUTPath
468 <<
" Usm=" << this->
Usm 469 <<
" Pci=" << this->
Pci 470 <<
" channels=" << channels);
471 if (!this->
Porta->init(this->PortaCineSize,
472 this->PortaFirmwarePath,
473 this->PortaSettingPath,
474 this->PortaLicensePath,
482 LOG_ERROR(
"Initialize: Porta could not be initialized: (" << this->
GetLastPortaError() <<
")" 483 <<
" PortaFirmwarePath=" << this->PortaFirmwarePath
484 <<
" PortaSettingPath=" << this->PortaSettingPath
485 <<
" PortaLicensePath=" << this->PortaLicensePath
486 <<
" PortaLUTPath=" << this->PortaLUTPath
487 <<
" Usm=" << this->
Usm 488 <<
" Pci=" << this->
Pci 489 <<
" channels=" << channels);
495 this->FirstCallToAddFrameToBuffer =
true;
501 if (!this->
Porta->isConnected())
503 LOG_ERROR(
"Porta is not connected");
509 const int connectorId = 0;
510 int probeId = (char)this->
Porta->getProbeID(connectorId);
511 if (!this->
Porta->selectProbe(probeId))
513 LOG_ERROR(
"Porta connect error: failed to select probe plugged into connector " << connectorId);
519 if (!this->
Porta->getProbeInfo(*this->ProbeInformation))
521 LOG_ERROR(
"Porta connect error: failed to get probe information");
526 const int MAX_NAME_LENGTH = 100;
527 char name[MAX_NAME_LENGTH + 1];
528 name[MAX_NAME_LENGTH] = 0;
529 this->
Porta->activateProbeConnector(connectorId);
530 this->
Porta->getProbeName(name, MAX_NAME_LENGTH, probeId);
531 LOG_DEBUG(
"Probe connected to connector " << probeId <<
": " << name);
534 SetPortaProbeName(name);
535 if (!this->
Porta->findMasterPreset(name, MAX_NAME_LENGTH, probeId))
537 LOG_ERROR(
"Porta connect error: master preset cannot be found");
542 if (!this->
Porta->loadPreset(name))
544 LOG_ERROR(
"Porta connect error: master preset could not be loaded");
549 if (!this->
SetInputFrameSize(*aSource, this->PortaBModeWidth, this->PortaBModeHeight, 1))
551 LOG_ERROR(
"Initializer: can not set the frame size");
559 int isRunning = this->
Porta->isImaging();
562 this->
Porta->stopImage();
566 if (!this->
Porta->initImagingMode(BMode))
568 LOG_ERROR(
"Initialize: cannot initialize imagingMode (" << this->
GetLastPortaError() <<
")");
572 this->
Porta->setDisplayDimensions(this->
DisplayIndex, this->PortaBModeWidth, this->PortaBModeHeight);
579 if (this->
Depth >= 0) { SetDepth(this->
Depth); }
580 if (this->
Gain >= 0) { SetGain(this->
Gain); }
581 if (this->
Zoom >= 0) { SetZoom(this->
Zoom); }
583 this->MotorRotationPerStepDeg = 0;
584 this->MotorRotationStartAngleDeg = 0;
585 if (this->ProbeInformation->motorized)
587 if (this->MotorRotationRangeDeg > 0)
590 if (this->ProbeInformation->motorSteps > 0)
592 this->MotorRotationPerStepDeg = static_cast<double>(this->ProbeInformation->motorFov) * 0.001 / static_cast<double>(this->ProbeInformation->motorSteps);
595 if (this->MotorRotationRangeDeg >= 0) { SetMotorRotationRangeDeg(this->MotorRotationRangeDeg); }
596 if (this->StepPerFrame >= 0) { SetStepPerFrame(this->StepPerFrame); }
597 if (this->FramePerVolume >= 0) { SetFramePerVolume(this->FramePerVolume); }
598 int actualFramePerVolume = 0;
599 GetFramePerVolume(actualFramePerVolume);
600 int actualStepPerFrame = 0;
601 GetStepPerFrame(actualStepPerFrame);
602 double actualMotorRotationRangeDeg = 0;
603 GetMotorRotationRangeDeg(actualMotorRotationRangeDeg);
604 this->MotorRotationStartAngleDeg = (actualFramePerVolume - 1) / 2 * actualStepPerFrame * this->MotorRotationPerStepDeg;
605 LOG_INFO(
"actual values in hw: FramePerVolume=" << actualFramePerVolume <<
" StepPerFrame=" << actualStepPerFrame <<
" MotorRotationRangeDeg=" << actualMotorRotationRangeDeg <<
" MotorRotationPerStepDeg=" << this->MotorRotationPerStepDeg <<
" MotorRotationStartAngleDeg=" << this->MotorRotationStartAngleDeg);
608 this->
Porta->setParam(prmMotorStatus, 1);
613 this->
Porta->setParam(prmMotorStatus, 0);
618 if (this->FramePerVolume >= 0 || this->StepPerFrame >= 0 || this->MotorRotationRangeDeg >= 0)
620 LOG_WARNING(
"Porta motor parameters are specified but the currently connected probe is not motorized");
625 if (!this->UpdateSonixPortaParams())
627 LOG_ERROR(
"Initialize: cannot update sonix params");
631 this->
Porta->setDisplayCallback(0, vtkPlusSonixPortaVideoSourceNewFrameCallback, (
void*)
this);
633 LOG_DEBUG(
"Successfully connected to sonix porta video device");
640 this->
Porta->setParam(prmMotorStatus, 0);
641 this->
Porta->stopImage();
643 this->
Porta->shutdown();
644 #if (PLUS_ULTRASONIX_SDK_MAJOR_VERSION >= 6) 652 if (!this->
Porta->isImaging())
654 this->
Porta->runImage();
662 if (this->
Porta->isImaging())
664 this->
Porta->stopImage();
670 PlusStatus vtkPlusSonixPortaVideoSource::ReadConfiguration(vtkXMLDataElement* rootConfigElement)
672 LOG_TRACE(
"vtkPlusSonixPortaVideoSource::ReadConfiguration");
675 XML_READ_ENUM1_ATTRIBUTE_OPTIONAL(
ImagingMode, deviceConfig,
"BMode", BMode)
677 XML_READ_SCALAR_ATTRIBUTE_OPTIONAL(
int,
Depth, deviceConfig);
678 XML_READ_SCALAR_ATTRIBUTE_OPTIONAL(
int,
Gain, deviceConfig);
679 XML_READ_SCALAR_ATTRIBUTE_OPTIONAL(
int,
Zoom, deviceConfig);
680 XML_READ_SCALAR_ATTRIBUTE_OPTIONAL(
int,
Frequency, deviceConfig);
682 XML_READ_SCALAR_ATTRIBUTE_OPTIONAL(
int, PortaBModeWidth, deviceConfig);
683 XML_READ_SCALAR_ATTRIBUTE_OPTIONAL(
int, PortaBModeHeight, deviceConfig);
685 XML_READ_SCALAR_ATTRIBUTE_OPTIONAL(
int, StepPerFrame, deviceConfig);
686 XML_READ_SCALAR_ATTRIBUTE_OPTIONAL(
int, FramePerVolume, deviceConfig);
687 XML_READ_SCALAR_ATTRIBUTE_OPTIONAL(
double, MotorRotationRangeDeg, deviceConfig);
689 XML_READ_SCALAR_ATTRIBUTE_REQUIRED(
int,
Usm, deviceConfig);
690 XML_READ_SCALAR_ATTRIBUTE_REQUIRED(
int,
Pci, deviceConfig);
692 XML_READ_CSTRING_ATTRIBUTE_REQUIRED(PortaLUTPath, deviceConfig);
693 XML_READ_CSTRING_ATTRIBUTE_REQUIRED(PortaSettingPath, deviceConfig);
694 XML_READ_CSTRING_ATTRIBUTE_REQUIRED(PortaLicensePath, deviceConfig);
695 XML_READ_CSTRING_ATTRIBUTE_REQUIRED(PortaFirmwarePath, deviceConfig);
700 if (deviceConfig->GetScalarAttribute(
"HighVoltage", obsolete))
702 LOG_WARNING(
"SonixPortaVideo HighVoltage attribute is ignored (HighVoltage is always disabled)");
704 if (deviceConfig->GetScalarAttribute(
"Channels", obsolete))
706 LOG_WARNING(
"SonixPortaVideo Channels attribute is ignored (number of channels is now automatically determined from USM (ultrasound module version) attribute.");
709 LOG_DEBUG(
"Porta read the XML configuration");
714 PlusStatus vtkPlusSonixPortaVideoSource::WriteConfiguration(vtkXMLDataElement* rootConfigElement)
720 deviceConfig->SetAttribute(
"ImagingMode",
"BMode");
724 LOG_ERROR(
"Writing of unsupported ImagingMode requested");
727 deviceConfig->SetIntAttribute(
"Depth", this->
Depth);
728 deviceConfig->SetIntAttribute(
"Gain", this->
Gain);
729 deviceConfig->SetIntAttribute(
"Zoom", this->
Zoom);
730 deviceConfig->SetIntAttribute(
"Frequency", this->
Frequency);
731 deviceConfig->SetIntAttribute(
"StepPerFrame", this->StepPerFrame);
734 if (this->FramePerVolume >= 0)
736 deviceConfig->SetIntAttribute(
"FramePerVolume", this->FramePerVolume);
738 if (this->MotorRotationRangeDeg >= 0)
740 deviceConfig->SetDoubleAttribute(
"MotorRotationRangeDeg", this->MotorRotationRangeDeg);
742 deviceConfig->SetIntAttribute(
"USM", this->
Usm);
743 deviceConfig->SetIntAttribute(
"PCI", this->
Pci);
744 deviceConfig->SetAttribute(
"PortaLUTPath", this->PortaLUTPath);
745 deviceConfig->SetAttribute(
"PortaSettingPath", this->PortaSettingPath);
746 deviceConfig->SetAttribute(
"PortaLicensePath", this->PortaLicensePath);
747 deviceConfig->SetAttribute(
"PortaFirmwarePath", this->PortaFirmwarePath);
757 #if (PLUS_ULTRASONIX_SDK_MAJOR_VERSION < 6) 758 const unsigned int MAX_PORTA_ERROR_MSG_LENGTH = 256;
759 char err[MAX_PORTA_ERROR_MSG_LENGTH + 1];
760 err[MAX_PORTA_ERROR_MSG_LENGTH] = 0;
761 this->
Porta->getLastError(err, MAX_PORTA_ERROR_MSG_LENGTH);
774 validatedParamValue = paramValue;
777 if (!this->
Porta->setParam(paramId, paramValue))
779 LOG_ERROR(
"vtkPlusSonixPortaVideoSource::SetParamValue failed (paramId=" << paramId <<
", paramValue=" << paramValue <<
") " <<
GetLastPortaError());
782 validatedParamValue = paramValue;
792 paramValue = validatedParamValue;
796 if (!this->
Porta->getParam(paramId, paramValue))
798 LOG_ERROR(
"vtkPlusSonixPortaVideoSource::GetParamValue failed (paramId=" << paramId <<
", paramValue=" << paramValue <<
") " <<
GetLastPortaError());
806 PlusStatus vtkPlusSonixPortaVideoSource::SetFrequency(
int aFrequency)
812 PlusStatus vtkPlusSonixPortaVideoSource::GetFrequency(
int& aFrequency)
818 PlusStatus vtkPlusSonixPortaVideoSource::SetDepth(
int aDepth)
824 PlusStatus vtkPlusSonixPortaVideoSource::GetDepth(
int& aDepth)
830 PlusStatus vtkPlusSonixPortaVideoSource::SetGain(
int aGain)
836 PlusStatus vtkPlusSonixPortaVideoSource::GetGain(
int& aGain)
842 PlusStatus vtkPlusSonixPortaVideoSource::SetZoom(
int aZoom)
848 PlusStatus vtkPlusSonixPortaVideoSource::GetZoom(
int& aZoom)
854 PlusStatus vtkPlusSonixPortaVideoSource::SetFramePerVolume(
int aFramePerVolume)
856 #if (PLUS_ULTRASONIX_SDK_MAJOR_VERSION >= 6) 857 LOG_WARNING(
"FramePerVolume parameter cannot be set in Ultrasonix SDK-6.x. Use MotorRotationRangeDeg parameter instead.");
859 return SetParamValue(prmMotorFrames, aFramePerVolume, this->FramePerVolume);
863 PlusStatus vtkPlusSonixPortaVideoSource::GetFramePerVolume(
int& aFramePerVolume)
865 return GetParamValue(prmMotorFrames, aFramePerVolume, this->FramePerVolume);
869 PlusStatus vtkPlusSonixPortaVideoSource::SetMotorRotationRangeDeg(
double aMotorRotationRangeDeg)
871 #if (PLUS_ULTRASONIX_SDK_MAJOR_VERSION < 6) 872 LOG_WARNING(
"MotorRotationRangeDeg parameter is not available in Ultrasonix SDK-6.x. Use FramePerVolume parameter instead.");
875 int aMotorRotationRangeMilliDeg =
int(aMotorRotationRangeDeg * 1000);
876 int aMotorRotationRangeMilliDegStored =
int(this->MotorRotationRangeDeg * 1000);
877 if (
SetParamValue(prmMotorFOV, aMotorRotationRangeMilliDeg, aMotorRotationRangeMilliDegStored) ==
PLUS_FAIL)
881 this->MotorRotationRangeDeg = aMotorRotationRangeMilliDegStored * 0.001;
887 PlusStatus vtkPlusSonixPortaVideoSource::GetMotorRotationRangeDeg(
double& aMotorRotationRangeDeg)
889 #if (PLUS_ULTRASONIX_SDK_MAJOR_VERSION < 6) 890 LOG_WARNING(
"MotorRotationRangeDeg parameter is not available in Ultrasonix SDK-6.x. Use FramePerVolume parameter instead.");
893 int aMotorRotationRangeMilliDeg =
int(aMotorRotationRangeDeg * 1000);
894 int aMotorRotationRangeMilliDegStored =
int(this->MotorRotationRangeDeg * 1000);
895 if (
GetParamValue(prmMotorFOV, aMotorRotationRangeMilliDeg, aMotorRotationRangeMilliDegStored) ==
PLUS_FAIL)
899 aMotorRotationRangeDeg = aMotorRotationRangeMilliDegStored * 0.001;
906 PlusStatus vtkPlusSonixPortaVideoSource::SetStepPerFrame(
int aStepPerFrame)
908 return SetParamValue(prmMotorSteps, aStepPerFrame, this->StepPerFrame);
912 PlusStatus vtkPlusSonixPortaVideoSource::GetStepPerFrame(
int& aStepPerFrame)
914 return GetParamValue(prmMotorSteps, aStepPerFrame, this->StepPerFrame);
918 PlusStatus vtkPlusSonixPortaVideoSource::UpdateSonixPortaParams()
920 bool bRunning = this->
Porta->isImaging();
924 this->
Porta->stopImage();
937 this->
Porta->runImage();
946 PlusStatus vtkPlusSonixPortaVideoSource::NotifyConfigured()
950 LOG_WARNING(
"vtkPlusSonixPortaVideoSource is expecting one output channel and there are " << this->
OutputChannels.size() <<
" channels. First output channel will be used.");
956 LOG_ERROR(
"No output channels defined for vtkPlusSonixPortaVideoSource. Cannot proceed.");
virtual PlusStatus SetInputFrameSize(vtkPlusDataSource &aSource, unsigned int x, unsigned int y, unsigned int z)
virtual void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
virtual PlusStatus InternalStartRecording()
virtual PlusStatus GetInputFrameSize(vtkPlusChannel &aChannel, unsigned int &x, unsigned int &y, unsigned int &z) const
PlusStatus SetParamValue(char *paramId, int paramValue, int &validatedParamValue)
#define XML_FIND_DEVICE_ELEMENT_REQUIRED_FOR_WRITING(deviceConfig, rootConfigElement)
virtual std::string GetDeviceId() const
Class that cleans up (deletes singleton instance of) vtkPlusSonixPortaVideoSource when destroyed.
PlusStatus AddFrameToBuffer(void *param, int id, bool motorRotationCcw, int motorStepCount)
double CurrentPixelSpacingMm[2]
bool RequireImageOrientationInConfiguration
bool ImageGeometryChanged
vtkPlusSonixPortaVideoSourceCleanup()
std::array< int, 3 > GetClipRectangleOrigin() const
PlusStatus GetFirstVideoSource(vtkPlusDataSource *&anImage)
virtual PlusStatus AddVideoItemToVideoSource(vtkPlusDataSource &videoSource, const igsioVideoFrame &frame, long frameNumber, double unfilteredTimestamp=UNDEFINED_TIMESTAMP, double filteredTimestamp=UNDEFINED_TIMESTAMP, const igsioFieldMapType *customFields=NULL)
Class providing VTK video input interface for SonixRP.
virtual void SetCorrectlyConfigured(bool)
int CurrentTransducerOriginPixels[2]
~vtkPlusSonixPortaVideoSourceCleanup()
virtual PlusStatus InternalStopRecording()
#define XML_FIND_DEVICE_ELEMENT_REQUIRED_FOR_READING(deviceConfig, rootConfigElement)
virtual US_IMAGE_ORIENTATION GetInputImageOrientation()
std::string GetLastPortaError()
virtual PlusStatus InternalDisconnect()
Contains an optional timestamped circular buffer containing the video images and a number of timestam...
~vtkPlusSonixPortaVideoSource()
ChannelContainer OutputChannels
PlusStatus GetVideoSource(vtkPlusDataSource *&aVideoSource) const
vtkPlusSonixPortaVideoSource()
PlusStatus GetParamValue(char *paramId, int ¶mValue, int &validatedParamValue)
virtual PlusStatus InternalConnect()
Interface to a 3D positioning tool, video source, or generalized data stream.