37 #include <vtkImageChangeInformation.h>
38 #include <vtkImageData.h>
52 mStatus =
"USE_DEFAULT";
53 mRedirecter = vtkSmartPointer<vtkImageChangeInformation>::New();
59 mEmptyImage.reset(
new Image(uid, emptyImage));
60 mReceivedImage = mEmptyImage;
61 mRedirecter->SetInputData(mEmptyImage->getBaseVtkImageData());
64 mTimeoutTimer =
new QTimer(
this);
65 mTimeoutTimer->setInterval(1000);
66 connect(mTimeoutTimer, SIGNAL(timeout()),
this, SLOT(timeout()));
78 mTimeoutTimer->setParent(NULL);
88 return mReceivedImage->getUid();
92 return mReceivedImage->getName();
95 void BasicVideoSource::timeout()
112 return mReceivedImage->getAcquisitionTime().toMSecsSinceEpoch();
117 return mReceivedImage->getAdvancedTimeInfo();
122 return (mReceivedImage!=mEmptyImage);
132 mRedirecter->SetOutputSpacing(resolution, resolution, resolution);
137 mRedirecter->Update();
138 return mRedirecter->GetOutput();
150 mTimeoutTimer->start();
168 mTimeoutTimer->stop();
177 if (mStatus!=
"USE_DEFAULT")
182 return "Not connected";
184 return "Not streaming";
198 mReceivedImage = input;
205 mEmptyImage.reset(
new Image(mReceivedImage->getUid(), mEmptyImage->getBaseVtkImageData()));
207 mReceivedImage = mEmptyImage;
209 mRedirecter->SetInputData(mReceivedImage->getBaseVtkImageData());
210 mRedirecter->Update();
215 mTimeoutTimer->start();
void overrideTimeout(bool timeout)
void connected(bool on)
emitted when source is connected/disconnected
virtual double getTimestamp()
void streaming(bool on)
emitted when streaming started/stopped
virtual void setResolution(double resolution)
boost::shared_ptr< class Image > ImagePtr
virtual void stop()
stop streaming
virtual bool isStreaming() const
return true when the source is streaming data.
virtual TimeInfo getAdvancedTimeInfo()
void reportWarning(QString msg)
virtual void start()
start streaming
BasicVideoSource(QString uid="<none>")
vtkImageDataPtr generateVtkImageData(Eigen::Array3i dim, Vector3D spacing, const unsigned char initValue, int components)
virtual QString getStatusString() const
status text describing the stream state, display instead of stream when the stream is invalid...
virtual vtkImageDataPtr getVtkImageData()
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
virtual bool validData() const
return true is data stream is ok to display. This is a heuristic based on the data rate...
void setInput(ImagePtr input)
void newFrame()
emitted when a new frame has arrived (getVtkImageData() returns something new). info/status/name/vali...
virtual QString getName()
virtual bool isConnected() const
return true when a connection to the data source is established.
virtual ~BasicVideoSource()