PlusLib  2.9.0
Software library for tracked ultrasound image acquisition, calibration, and processing.
vtkPlusICCapturingSource.cxx
Go to the documentation of this file.
1 /*=Plus=header=begin======================================================
2 Program: Plus
3 Copyright (c) Laboratory for Percutaneous Surgery. All rights reserved.
4 See License.txt for details.
5 =========================================================Plus=header=end*/
6 
7 // Local includes
8 #include "PlusConfigure.h"
9 #include "ICCapturingListener.h"
10 #include "vtkPlusChannel.h"
11 #include "vtkPlusDataSource.h"
13 
14 // VTK includes
15 #include <vtkImageData.h>
16 #include <vtkInformation.h>
17 #include <vtkInformationVector.h>
18 #include <vtkMultiThreader.h>
19 #include <vtkObjectFactory.h>
20 #include <vtkStreamingDemandDrivenPipeline.h>
21 #include <vtksys/SystemTools.hxx>
22 
23 // ICC includes
24 #include <tisudshl.h>
25 
26 // OS includes
27 #include <ctype.h>
28 
29 // STL includes
30 #include <vector>
31 #include <string>
32 
33 //----------------------------------------------------------------------------
34 
35 vtkPlusICCapturingSource* vtkPlusICCapturingSource::Instance = 0;
37 
38 //----------------------------------------------------------------------------
40 {
41 }
42 
43 //----------------------------------------------------------------------------
45 {
46  // Destroy any remaining output window.
48 }
49 
50 //----------------------------------------------------------------------------
52 {
53  this->ICBufferSize = 50;
54 
55  this->DeviceName = NULL;
56  this->VideoNorm = NULL;
57  this->VideoFormat = NULL;
58  this->FrameSize[0] = 640;
59  this->FrameSize[1] = 480;
60  this->FrameSize[2] = 1;
61  this->InputChannel = NULL;
62 
63  this->FrameGrabber = NULL;
64  this->FrameGrabberListener = NULL;
65 
66  this->Modified();
67 
69 
70  // No need for StartThreadForInternalUpdates, as we are notified about each new frame through a callback function
71 }
72 
73 //----------------------------------------------------------------------------
75 {
76  this->Disconnect();
77 
78  if (this->FrameGrabber != NULL)
79  {
80  delete this->FrameGrabber;
81  this->FrameGrabber = NULL;
82  }
83 
84  if (this->FrameGrabberListener != NULL)
85  {
86  delete this->FrameGrabberListener;
87  this->FrameGrabberListener = NULL;
88  }
89 
90  SetDeviceName(NULL);
91  SetVideoNorm(NULL);
92  SetVideoFormat(NULL);
93 }
94 
95 //----------------------------------------------------------------------------
96 // Up the reference count so it behaves like New
98 {
100  ret->Register(NULL);
101  return ret;
102 }
103 
104 //----------------------------------------------------------------------------
105 // Return the single instance of the vtkOutputWindow
107 {
108  if (!vtkPlusICCapturingSource::Instance)
109  {
110  // Try the factory first
111  vtkPlusICCapturingSource::Instance = (vtkPlusICCapturingSource*)vtkObjectFactory::CreateInstance("vtkPlusICCapturingSource");
112  if (!vtkPlusICCapturingSource::Instance)
113  {
114  vtkPlusICCapturingSource::Instance = new vtkPlusICCapturingSource();
115  }
116  if (!vtkPlusICCapturingSource::Instance)
117  {
118  int error = 0;
119  }
120  }
121  // return the instance
122  return vtkPlusICCapturingSource::Instance;
123 }
124 
125 //----------------------------------------------------------------------------
127 {
128  if (vtkPlusICCapturingSource::Instance == instance)
129  {
130  return;
131  }
132  // preferably this will be NULL
133  if (vtkPlusICCapturingSource::Instance)
134  {
135  vtkPlusICCapturingSource::Instance->Delete();;
136  }
137  vtkPlusICCapturingSource::Instance = instance;
138  if (!instance)
139  {
140  return;
141  }
142  // user will call ->Delete() after setting instance
143  instance->Register(NULL);
144 }
145 
146 //----------------------------------------------------------------------------
148 {
149  std::ostringstream version;
150  version << "The Imaging Source UDSHL-" << UDSHL_LIB_VERSION_MAJOR << "." << UDSHL_LIB_VERSION_MINOR;
151  return version.str();
152 }
153 
154 //----------------------------------------------------------------------------
155 void vtkPlusICCapturingSource::PrintSelf(ostream& os, vtkIndent indent)
156 {
157  this->Superclass::PrintSelf(os, indent);
158 }
159 
160 //----------------------------------------------------------------------------
161 // the callback function used when there is a new frame of data received
162 bool vtkPlusICCapturingSource::vtkPlusICCapturingSourceNewFrameCallback(unsigned char* data, unsigned long size, unsigned long frameNumber)
163 {
164  if (data == NULL || size == 0)
165  {
166  LOG_ERROR("No actual frame data received from the framegrabber");
167  return false;
168  }
169 
171 
172  return true;
173 }
174 
175 //----------------------------------------------------------------------------
176 // copy the Device Independent Bitmap from the VFW framebuffer into the
177 // vtkVideoSource framebuffer (don't do the unpacking yet)
178 PlusStatus vtkPlusICCapturingSource::AddFrameToBuffer(unsigned char* dataPtr, unsigned long size, unsigned long frameNumber)
179 {
180  if (!this->Recording)
181  {
182  // drop the frame, we are not recording data now
183  return PLUS_SUCCESS;
184  }
185 
186  vtkPlusDataSource* aSource = NULL;
187  if (this->GetFirstActiveOutputVideoSource(aSource) != PLUS_SUCCESS)
188  {
189  LOG_ERROR("Unable to retrieve the video source in the ICCapturing device.");
190  return PLUS_FAIL;
191  }
192 
193  this->FrameNumber = frameNumber;
194 
195  DShowLib::Grabber* grabber = static_cast<DShowLib::Grabber*>(this->FrameGrabber);
196  if (grabber == nullptr || grabber->getAcqSizeMaxX() < 0 || grabber->getAcqSizeMaxY() < 0)
197  {
198  LOG_ERROR("Negative frame size sent from ICC device. Cannot continue.");
199  return PLUS_FAIL;
200  }
201 
202  FrameSizeType frameSize = {static_cast<unsigned int>(grabber->getAcqSizeMaxX()), static_cast<unsigned int>(grabber->getAcqSizeMaxY()), 1};
203 
204  int frameBufferBitsPerPixel = grabber->getVideoFormat().getBitsPerPixel();
205  if (frameBufferBitsPerPixel != 8)
206  {
207  LOG_ERROR("vtkPlusICCapturingSource::AddFrameToBuffer: only 8-bit acquisition is supported, current frameBufferBitsPerPixel=" << frameBufferBitsPerPixel);
208  return PLUS_FAIL;
209  }
210 
211  PlusStatus status = aSource->AddItem(dataPtr, aSource->GetInputImageOrientation(), frameSize, VTK_UNSIGNED_CHAR, 1, US_IMG_BRIGHTNESS, 0, this->FrameNumber);
212  this->Modified();
213 
214  return status;
215 }
216 
217 
218 //----------------------------------------------------------------------------
220 {
221  if (!DShowLib::InitLibrary())
222  {
223  LOG_ERROR("The IC capturing library could not be initialized");
224  return PLUS_FAIL;
225  }
226 
227  // Add DShowLib::ExitLibrary to the list of functions that are called on application exit.
228  // It is useful because when the application is forced to exit then the destructor may not be called.
229  static bool exitFunctionAdded = false;
230  if (!exitFunctionAdded)
231  {
232  atexit(DShowLib::ExitLibrary);
233  exitFunctionAdded = true;
234  }
235 
236  if (this->FrameGrabber == NULL)
237  {
238  this->FrameGrabber = new DShowLib::Grabber;
239  }
240 
241  // Set the device name (e.g. DFG/USB2-lt)
242  if (this->GetDeviceName() == NULL || !static_cast<DShowLib::Grabber*>(FrameGrabber)->openDev(this->GetDeviceName()))
243  {
244  LOG_ERROR("The IC capturing library could not be initialized - invalid device name: " << this->GetDeviceName());
246  return PLUS_FAIL;
247  }
248 
249  // Set the video norm (e.g. PAL_B or NTSC_M)
250  if (this->GetVideoNorm() == NULL || !static_cast<DShowLib::Grabber*>(FrameGrabber)->setVideoNorm(this->GetVideoNorm()))
251  {
252  LOG_ERROR("The IC capturing library could not be initialized - invalid video norm: " << this->GetVideoNorm());
254  return PLUS_FAIL;
255  }
256 
257  // The Y800 color format is an 8 bit monochrome format.
258  if (!static_cast<DShowLib::Grabber*>(FrameGrabber)->setVideoFormat(this->GetDShowLibVideoFormatString().c_str()))
259  {
260  LOG_ERROR("The IC capturing library could not be initialized - invalid video format: " << this->GetDShowLibVideoFormatString());
262  return PLUS_FAIL;
263  }
264 
265  int bitsPerPixel = static_cast<DShowLib::Grabber*>(FrameGrabber)->getVideoFormat().getBitsPerPixel();
266  if (bitsPerPixel != 8)
267  {
268  LOG_ERROR("The IC capturing library could not be initialized - invalid bits per pixel: " << bitsPerPixel);
269  return PLUS_FAIL;
270  }
271 
272  vtkPlusDataSource* aSource = NULL;
273  if (this->GetFirstActiveOutputVideoSource(aSource) != PLUS_SUCCESS)
274  {
275  LOG_ERROR("Unable to retrieve the video source in the ICCapturing device.");
276  return PLUS_FAIL;
277  }
278  aSource->SetPixelType(VTK_UNSIGNED_CHAR);
279 
280  FrameSizeType frameSize = {0, 0, 1};
281  frameSize[0] = static_cast<DShowLib::Grabber*>(FrameGrabber)->getAcqSizeMaxX();
282  frameSize[1] = static_cast<DShowLib::Grabber*>(FrameGrabber)->getAcqSizeMaxY();
283  frameSize[2] = 1;
284  aSource->SetInputFrameSize(frameSize);
285 
286  if (this->GetInputChannel() == NULL || !static_cast<DShowLib::Grabber*>(FrameGrabber)->setInputChannel(this->GetInputChannel()))
287  {
288  LOG_ERROR("The IC capturing library could not be initialized - invalid input channel: " << this->GetInputChannel());
289  return PLUS_FAIL;
290  }
291 
292  if (this->FrameGrabberListener == NULL)
293  {
295  }
296 
297  this->FrameGrabberListener->SetICCapturingSourceNewFrameCallback(vtkPlusICCapturingSource::vtkPlusICCapturingSourceNewFrameCallback);
298 
299  // Assign the number of buffers to the cListener object.
301 
302  // Register the FrameGrabberListener object for the frame ready
303  // TODO: check if the listener should be removed (in disconnect, when reconnecting, ...)
304  static_cast<DShowLib::Grabber*>(FrameGrabber)->addListener(FrameGrabberListener, DShowLib::GrabberListener::eFRAMEREADY);
305 
306  // Create a FrameTypeInfoArray data structure describing the allowed color formats.
307  DShowLib::FrameTypeInfoArray acceptedTypes = DShowLib::FrameTypeInfoArray::createRGBArray();
308 
309  // Create the frame handler sink: 8 bit monochrome format.
310  smart_ptr<DShowLib::FrameHandlerSink> pSink = DShowLib::FrameHandlerSink::create(DShowLib::eRGB8, 1);
311  //smart_ptr<DShowLib::FrameHandlerSink> pSink = DShowLib::FrameHandlerSink::create( DShowLib::eY800, 1);
312 
313  // Disable snap mode.
314  pSink->setSnapMode(false);
315 
316  // Apply the sink to the grabber.
317  static_cast<DShowLib::Grabber*>(FrameGrabber)->setSinkType(pSink);
318 
319  return PLUS_SUCCESS;
320 }
321 
322 //----------------------------------------------------------------------------
324 {
325  LOG_DEBUG("Disconnect from IC capturing");
326 
327  static_cast<DShowLib::Grabber*>(FrameGrabber)->removeListener(FrameGrabberListener);
328  delete this->FrameGrabberListener;
329  this->FrameGrabberListener = NULL;
330 
331  delete FrameGrabber;
332  this->FrameGrabber = NULL;
333 
334  DShowLib::ExitLibrary();
335 
336  return PLUS_SUCCESS;
337 }
338 
339 //----------------------------------------------------------------------------
341 {
342  if (!static_cast<DShowLib::Grabber*>(FrameGrabber)->startLive(false))
343  {
344  LOG_ERROR("Framegrabber startLive failed, cannot start the recording");
345  return PLUS_FAIL;
346  }
347  return PLUS_SUCCESS;
348 }
349 
350 //----------------------------------------------------------------------------
352 {
353  if (!static_cast<DShowLib::Grabber*>(FrameGrabber)->stopLive())
354  {
355  LOG_ERROR("Framegrabber stopLive failed");
356  return PLUS_FAIL;
357  }
358  return PLUS_SUCCESS;
359 }
360 
361 //-----------------------------------------------------------------------------
362 PlusStatus vtkPlusICCapturingSource::ReadConfiguration(vtkXMLDataElement* rootConfigElement)
363 {
364  LOG_TRACE("vtkPlusICCapturingSource::ReadConfiguration");
365 
366  // This is a singleton class, so some input channels, output channels, or tools might have been already
367  // defined. Clean them up before creating the new ones from XML.
368  for (ChannelContainerIterator it = this->OutputChannels.begin(); it != this->OutputChannels.end(); ++it)
369  {
370  (*it)->UnRegister(this);
371  }
372  this->InputChannels.clear();
373  this->OutputChannels.clear();
374  for (DataSourceContainerIterator it = this->Tools.begin(); it != this->Tools.end(); ++it)
375  {
376  it->second->UnRegister(this);
377  }
378  this->Tools.clear();
379  for (DataSourceContainerIterator it = this->VideoSources.begin(); it != this->VideoSources.end(); ++it)
380  {
381  it->second->UnRegister(this);
382  }
383  this->VideoSources.clear();
384 
385  XML_FIND_DEVICE_ELEMENT_REQUIRED_FOR_READING(deviceConfig, rootConfigElement);
386 
387  XML_READ_CSTRING_ATTRIBUTE_OPTIONAL(DeviceName, deviceConfig);
388  XML_READ_CSTRING_ATTRIBUTE_OPTIONAL(VideoNorm, deviceConfig);
389  XML_READ_CSTRING_ATTRIBUTE_OPTIONAL(VideoFormat, deviceConfig);
390  XML_READ_STD_ARRAY_ATTRIBUTE_OPTIONAL(int, 2, FrameSize, deviceConfig);
391  FrameSize[2] = 1;
392 
393  // Only for backward compatibility
394  // VideoFormat used to contain both video format and frame size, so in case frame size is defined
395  // then this method parses that and updates VideoFormat and FrameSize accordingly
397 
398  XML_READ_CSTRING_ATTRIBUTE_OPTIONAL(InputChannel, deviceConfig);
399  XML_READ_SCALAR_ATTRIBUTE_OPTIONAL(int, ICBufferSize, deviceConfig);
400 
401  return PLUS_SUCCESS;
402 }
403 
404 //-----------------------------------------------------------------------------
405 PlusStatus vtkPlusICCapturingSource::WriteConfiguration(vtkXMLDataElement* rootConfigElement)
406 {
407  XML_FIND_DEVICE_ELEMENT_REQUIRED_FOR_WRITING(imageAcquisitionConfig, rootConfigElement);
408 
409  imageAcquisitionConfig->SetAttribute("DeviceName", this->DeviceName);
410  imageAcquisitionConfig->SetAttribute("VideoNorm", this->VideoNorm);
411  imageAcquisitionConfig->SetAttribute("VideoFormat", this->VideoFormat);
412  int frameSize[2];
413  frameSize[0] = static_cast<int>(this->FrameSize[0]);
414  frameSize[1] = static_cast<int>(this->FrameSize[1]);
415  imageAcquisitionConfig->SetVectorAttribute("FrameSize", 2, frameSize);
416  imageAcquisitionConfig->SetAttribute("InputChannel", this->InputChannel);
417  imageAcquisitionConfig->SetIntAttribute("ICBufferSize", this->ICBufferSize);
418 
419  return PLUS_SUCCESS;
420 }
421 
422 //----------------------------------------------------------------------------
423 void vtkPlusICCapturingSource::SetFrameSize(const FrameSizeType& frameSize)
424 {
425  this->FrameSize = frameSize;
426 }
427 
428 //----------------------------------------------------------------------------
429 void vtkPlusICCapturingSource::SetFrameSize(unsigned int i, unsigned int j, unsigned int k)
430 {
431  FrameSizeType t;
432  t[0] = i;
433  t[1] = j;
434  t[2] = k;
435  this->SetFrameSize(t);
436 }
437 
438 //----------------------------------------------------------------------------
440 {
441  return this->FrameSize;
442 }
443 
444 //----------------------------------------------------------------------------
446 {
447  if (this->OutputChannels.size() > 1)
448  {
449  LOG_WARNING("ICCapturingSource is expecting one output channel and there are " << this->OutputChannels.size() << " channels. First output channel will be used.");
450  return PLUS_FAIL;
451  }
452 
453  if (this->OutputChannels.empty())
454  {
455  LOG_ERROR("No output channels defined for vtkPlusICCapturingSource. Cannot proceed.");
456  this->SetCorrectlyConfigured(false);
457  return PLUS_FAIL;
458  }
459 
460  return PLUS_SUCCESS;
461 }
462 
463 //----------------------------------------------------------------------------
464 void vtkPlusICCapturingSource::ParseDShowLibVideoFormatString(const char* videoFormatFrameSizeString)
465 {
466  if (videoFormatFrameSizeString == NULL)
467  {
468  // parsing failed
469  return;
470  }
471 
472  // videoFormatFrameSizeString sample: "Y800 (640x480)"
473  std::vector<std::string> splitVideoFormatFrameSize;
474  igsioCommon::SplitStringIntoTokens(videoFormatFrameSizeString, ' ', splitVideoFormatFrameSize);
475  if (splitVideoFormatFrameSize.size() != 2)
476  {
477  // parsing failed
478  return;
479  }
480 
481  // splitVideoFormatFrameSize[0] is Y800
482  // splitVideoFormatFrameSize[1] is (640x480), so it has to be split and parsed further
483 
484  // parse frame size
485  std::vector<std::string> splitFrameSize;
486  igsioCommon::SplitStringIntoTokens(splitVideoFormatFrameSize[1], 'x', splitFrameSize);
487  if (splitFrameSize.size() != 2 || splitFrameSize[0].empty() || splitFrameSize[1].empty()) // (640 480)
488  {
489  // parsing failed
490  return;
491  }
492  if (splitFrameSize[0][0] != '(' || splitFrameSize[1][splitFrameSize[1].size() - 1] != ')')
493  {
494  // parsing failed
495  return;
496  }
497  // Remove parentheses
498  splitFrameSize[0].erase(splitFrameSize[0].begin());
499  splitFrameSize[1].erase(splitFrameSize[1].end() - 1);
500 
501  // Convert to unsigned integer
502  unsigned int frameSizeX = 0;
503  unsigned int frameSizeY = 0;
504  if (igsioCommon::StringToUInt(splitFrameSize[0].c_str(), frameSizeX) == PLUS_FAIL)
505  {
506  return;
507  }
508  if (igsioCommon::StringToUInt(splitFrameSize[1].c_str(), frameSizeY) == PLUS_FAIL)
509  {
510  return;
511  }
512 
513  // Parsing successful, save results
514  this->SetVideoFormat(splitVideoFormatFrameSize[0].c_str());
515  this->SetFrameSize(frameSizeX, frameSizeY, 1);
516 }
517 
518 //----------------------------------------------------------------------------
520 {
521  std::ostringstream ss;
522  ss << (this->GetVideoFormat() ? this->GetVideoFormat() : "Y800");
523  ss << " (" << this->FrameSize[0] << "x" << this->FrameSize[1] << ")" << std::ends;
524  std::string formatString = ss.str();
525  return formatString;
526 }
527 
528 //----------------------------------------------------------------------------
529 void vtkPlusICCapturingSource::GetListOfCaptureDevices(std::vector< std::string >& deviceNames)
530 {
531  deviceNames.clear();
532 
533  if (!DShowLib::InitLibrary())
534  {
535  LOG_ERROR("The IC capturing library could not be initialized");
536  return;
537  }
538  DShowLib::Grabber grabber;
539  DShowLib::Grabber::tVidCapDevListPtr pVidCapDevList = grabber.getAvailableVideoCaptureDevices();
540  DShowLib::ExitLibrary();
541 
542  if (pVidCapDevList == 0)
543  {
544  // no devices are found
545  return;
546  }
547  for (DShowLib::Grabber::tVidCapDevList::iterator it = pVidCapDevList->begin(); it != pVidCapDevList->end(); ++it)
548  {
549  deviceNames.push_back(it->toString());
550  }
551 }
552 
553 //----------------------------------------------------------------------------
554 void vtkPlusICCapturingSource::GetListOfCaptureVideoNorms(std::vector< std::string >& videoNorms, const std::string& deviceName)
555 {
556  videoNorms.clear();
557 
558  if (!DShowLib::InitLibrary())
559  {
560  LOG_ERROR("The IC capturing library could not be initialized");
561  return;
562  }
563  DShowLib::Grabber grabber;
564  if (!grabber.openDev(deviceName))
565  {
566  LOG_ERROR("Could not connect to device: " << deviceName);
567  DShowLib::ExitLibrary();
568  return;
569  }
570  DShowLib::Grabber::tVidNrmListPtr pVidNrmList = grabber.getAvailableVideoNorms();
571  DShowLib::ExitLibrary();
572 
573  if (pVidNrmList == 0)
574  {
575  LOG_ERROR("Error getting list of capture video norms for device: " << grabber.getLastError().toString());
576  return;
577  }
578 
579  for (DShowLib::Grabber::tVidNrmList::iterator it = pVidNrmList->begin(); it != pVidNrmList->end(); ++it)
580  {
581  videoNorms.push_back(it->toString());
582  }
583 }
584 
585 //----------------------------------------------------------------------------
586 void vtkPlusICCapturingSource::GetListOfCaptureVideoModes(std::vector< std::string >& videoFormats, const std::string& deviceName, const std::string& videoNorm)
587 {
588  videoFormats.clear();
589 
590  if (!DShowLib::InitLibrary())
591  {
592  LOG_ERROR("The IC capturing library could not be initialized");
593  return;
594  }
595  DShowLib::Grabber grabber;
596  if (!grabber.openDev(deviceName))
597  {
598  LOG_ERROR("Could not connect to device: " << deviceName);
599  DShowLib::ExitLibrary();
600  return;
601  }
602  if (!grabber.setVideoNorm(videoNorm))
603  {
604  LOG_ERROR("Failed to set video norm: " << videoNorm);
605  DShowLib::ExitLibrary();
606  return;
607  }
608  DShowLib::Grabber::tVidFmtListPtr pVidFmtList = grabber.getAvailableVideoFormats();
609  DShowLib::ExitLibrary();
610 
611  if (pVidFmtList == 0)
612  {
613  LOG_ERROR("Error getting list of capture video formats for device " << grabber.getLastError().toString());
614  return;
615  }
616 
617  for (DShowLib::Grabber::tVidFmtList::iterator it = pVidFmtList->begin(); it != pVidFmtList->end(); ++it)
618  {
619  videoFormats.push_back(it->toString());
620  }
621 }
622 
623 //----------------------------------------------------------------------------
625 {
626  LOG_INFO("Available video formats and frame sizes for all available capture devices:");
627  std::vector<std::string> deviceNames;
628  GetListOfCaptureDevices(deviceNames);
629  for (std::vector<std::string>::iterator deviceNameIt = deviceNames.begin(); deviceNameIt != deviceNames.end(); ++deviceNameIt)
630  {
631  LOG_INFO(" Device name: " << (*deviceNameIt));
632  std::vector<std::string> videoNorms;
633  GetListOfCaptureVideoNorms(videoNorms, (*deviceNameIt));
634  for (std::vector<std::string>::iterator videoNormIt = videoNorms.begin(); videoNormIt != videoNorms.end(); ++videoNormIt)
635  {
636  LOG_INFO(" Video norm: " << (*videoNormIt));
637  std::vector<std::string> videoModes;
638  GetListOfCaptureVideoModes(videoModes, (*deviceNameIt), (*videoNormIt));
639  for (std::vector<std::string>::iterator videoModeIt = videoModes.begin(); videoModeIt != videoModes.end(); ++videoModeIt)
640  {
641  LOG_INFO(" " << (*videoModeIt));
642  }
643  }
644  }
645 }
const uint32_t * data
Definition: phidget22.h:3971
virtual void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
virtual void SetVideoFormat(const char *)
virtual void SetDeviceName(const char *)
virtual char * GetVideoNorm()
void ParseDShowLibVideoFormatString(const char *videoFormatFrameSizeString)
virtual void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
#define XML_FIND_DEVICE_ELEMENT_REQUIRED_FOR_WRITING(deviceConfig, rootConfigElement)
static vtkPlusICCapturingSourceCleanup Cleanup
igsioStatus PlusStatus
Definition: PlusCommon.h:40
static vtkPlusICCapturingSource * GetInstance()
ChannelContainer InputChannels
PlusStatus SetInputFrameSize(unsigned int x, unsigned int y, unsigned int z)
virtual PlusStatus AddItem(vtkImageData *frame, US_IMAGE_ORIENTATION usImageOrientation, US_IMAGE_TYPE imageType, long frameNumber, double unfilteredTimestamp=UNDEFINED_TIMESTAMP, double filteredTimestamp=UNDEFINED_TIMESTAMP, const igsioFieldMapType *customFields=NULL)
DataSourceContainer VideoSources
static void SetInstance(vtkPlusICCapturingSource *instance)
virtual void SetVideoNorm(const char *)
bool RequireImageOrientationInConfiguration
for i
#define PLUS_FAIL
Definition: PlusCommon.h:43
DataSourceContainer Tools
Class for providing video input interfaces between VTK and ICCapturing frame grabber device.
PlusStatus SetPixelType(igsioCommon::VTKScalarPixelType pixelType)
void GetListOfCaptureVideoNorms(std::vector< std::string > &videoNorms, const std::string &deviceName)
virtual char * GetVideoFormat()
Class that listens for incoming framegrabber images.
virtual int GetICBufferSize()
void SetFrameSize(const FrameSizeType &frameSize)
virtual PlusStatus Disconnect()
PlusStatus GetFirstActiveOutputVideoSource(vtkPlusDataSource *&aVideoSource)
virtual PlusStatus ReadConfiguration(vtkXMLDataElement *config)
virtual PlusStatus InternalDisconnect()
virtual void SetCorrectlyConfigured(bool)
void GetListOfCaptureVideoModes(std::vector< std::string > &videoModes, const std::string &deviceName, const std::string &videoNorm)
unsigned long FrameNumber
const char ** deviceName
Definition: phidget22.h:1316
#define PLUS_SUCCESS
Definition: PlusCommon.h:44
virtual PlusStatus WriteConfiguration(vtkXMLDataElement *config)
void setBufferSize(unsigned long NumBuffers)
#define XML_FIND_DEVICE_ELEMENT_REQUIRED_FOR_READING(deviceConfig, rootConfigElement)
PlusStatus AddFrameToBuffer(unsigned char *data, unsigned long size, unsigned long frameNumber)
DataSourceContainer::iterator DataSourceContainerIterator
virtual PlusStatus InternalStartRecording()
static vtkPlusICCapturingSource * New()
virtual US_IMAGE_ORIENTATION GetInputImageOrientation()
Class that cleans up (deletes singleton instance of) vtkPlusICCapturingSource when destroyed.
void SetICCapturingSourceNewFrameCallback(ICCapturingSourceNewFramePtr cb)
virtual PlusStatus InternalStopRecording()
ChannelContainer OutputChannels
virtual char * GetInputChannel()
ICCapturingListener * FrameGrabberListener
for t
Definition: exploreFolders.m:9
ChannelContainer::iterator ChannelContainerIterator
Definition: vtkPlusDevice.h:36
void GetListOfCaptureDevices(std::vector< std::string > &deviceNames)
virtual char * GetDeviceName()
Interface to a 3D positioning tool, video source, or generalized data stream.