16 #include <vtkImageChangeInformation.h> 17 #include <vtkImageData.h> 31 mStatus =
"USE_DEFAULT";
32 mRedirecter = vtkSmartPointer<vtkImageChangeInformation>::New();
38 mEmptyImage.reset(
new Image(uid, emptyImage));
39 mReceivedImage = mEmptyImage;
40 mRedirecter->SetInputData(mEmptyImage->getBaseVtkImageData());
43 mTimeoutTimer =
new QTimer(
this);
44 mTimeoutTimer->setInterval(1000);
45 connect(mTimeoutTimer, SIGNAL(timeout()),
this, SLOT(timeout()));
57 mTimeoutTimer->setParent(NULL);
67 return mReceivedImage->getUid();
71 return mReceivedImage->getName();
74 void BasicVideoSource::timeout()
91 return mReceivedImage->getAcquisitionTime().toMSecsSinceEpoch();
96 return mReceivedImage->getAdvancedTimeInfo();
101 return (mReceivedImage!=mEmptyImage);
111 mRedirecter->SetOutputSpacing(resolution, resolution, resolution);
116 mRedirecter->Update();
117 return mRedirecter->GetOutput();
129 mTimeoutTimer->start();
147 mTimeoutTimer->stop();
156 if (mStatus!=
"USE_DEFAULT")
161 return "Not connected";
163 return "Not streaming";
177 mReceivedImage = input;
184 mEmptyImage.reset(
new Image(mReceivedImage->getUid(), mEmptyImage->getBaseVtkImageData()));
186 mReceivedImage = mEmptyImage;
188 mRedirecter->SetInputData(mReceivedImage->getBaseVtkImageData());
189 mRedirecter->Update();
194 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.
Namespace for all CustusX production code.
virtual ~BasicVideoSource()