PlusLib  2.9.0
Software library for tracked ultrasound image acquisition, calibration, and processing.
vtkPlusChannel.h
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 #ifndef __vtkPlusStream_h
8 #define __vtkPlusStream_h
9 
10 #include "PlusConfigure.h"
11 #include "vtkPlusDataCollectionExport.h"
12 
13 #include "PlusStreamBufferItem.h"
14 #include "vtkDataObject.h"
15 #include "vtkPlusRfProcessor.h"
16 
17 //class igsioTrackedFrame;
19 class vtkPlusDataSource;
21 //class vtkIGSIOTrackedFrameList;
22 
23 typedef std::map<std::string, vtkPlusDataSource*> DataSourceContainer;
24 typedef DataSourceContainer::iterator DataSourceContainerIterator;
25 typedef DataSourceContainer::const_iterator DataSourceContainerConstIterator;
26 
34 class vtkPlusDataCollectionExport vtkPlusChannel : public vtkDataObject
35 {
36 public:
37  typedef std::map< std::string, std::string > CustomAttributeMap;
38  typedef CustomAttributeMap::iterator CustomAttributeMapIterator;
39  typedef CustomAttributeMap::const_iterator CustomAttributeMapConstIterator;
40 
41 public:
42  static vtkPlusChannel* New();
43  vtkTypeMacro(vtkPlusChannel, vtkObject);
44 
48  virtual PlusStatus ReadConfiguration(vtkXMLDataElement* aChannelElement, bool RequireImageOrientationInChannelConfiguration);
52  virtual PlusStatus WriteConfiguration(vtkXMLDataElement* aChannelElement);
53 
54  inline PlusStatus GetVideoSource(vtkPlusDataSource*& aVideoSource) const
55  {
56  aVideoSource = this->VideoSource;
57  return aVideoSource != NULL ? PLUS_SUCCESS : PLUS_FAIL;
58  }
59 
60  void SetVideoSource(vtkPlusDataSource* aSource);
61  inline bool HasVideoSource() const { return this->VideoSource != NULL; };
62  bool IsVideoSource3D() const;
63 
64  int ToolCount() const { return this->Tools.size(); }
65  PlusStatus AddTool(vtkPlusDataSource* aTool);
66  PlusStatus RemoveTool(const std::string& toolSourceId);
67  PlusStatus GetTool(vtkPlusDataSource*& aTool, const std::string& toolSourceId);
68  PlusStatus GetToolByPortName(vtkPlusDataSource*& aTool, const std::string& portName);
69  PlusStatus RemoveTools();
70  inline DataSourceContainerIterator GetToolsStartIterator() { return this->Tools.begin(); };
71  inline DataSourceContainerIterator GetToolsEndIterator() { return this->Tools.end(); };
72  inline DataSourceContainerConstIterator GetToolsStartConstIterator() const { return this->Tools.begin(); };
73  inline DataSourceContainerConstIterator GetToolsEndConstIterator() const { return this->Tools.end(); };
74 
75  int FieldCount() const { return this->FieldDataSources.size(); }
76  PlusStatus AddFieldDataSource(vtkPlusDataSource* aSource);
77  PlusStatus RemoveFieldDataSource(const std::string& sourceId);
78  PlusStatus GetFieldDataSource(vtkPlusDataSource*& aSource, const std::string& sourceId);
79  PlusStatus RemoveFieldDataSources();
80  inline DataSourceContainerIterator GetFieldDataSourcesStartIterator() { return this->FieldDataSources.begin(); };
81  inline DataSourceContainerIterator GetFieldDataSourcesEndIterator() { return this->FieldDataSources.end(); };
82  inline DataSourceContainerConstIterator GetFieldDataSourcesStartConstIterator() const { return this->FieldDataSources.begin(); };
83  inline DataSourceContainerConstIterator GetFieldDataSourcesEndConstIterator() const { return this->FieldDataSources.end(); };
84 
85  bool GetTrackingDataAvailable();
86  bool GetVideoDataAvailable();
87  bool GetFieldDataAvailable();
88  bool GetTrackingEnabled() const;
89  bool GetVideoEnabled() const;
90  bool GetFieldDataEnabled() const;
91 
93  vtkImageData* GetBrightnessOutput();
94 
96  PlusStatus GetBrightnessFrameSize(FrameSizeType& aDim);
97 
103  PlusStatus GetTimestampMasterTool(vtkPlusDataSource*& aTool);
104 
112  virtual PlusStatus GetTrackedFrame(double timestamp, igsioTrackedFrame& trackedFrame, bool enableImageData = true);
113  virtual PlusStatus GetTrackedFrame(igsioTrackedFrame& trackedFrame);
114 
123  virtual PlusStatus GetTrackedFrameListSampled(double& aTimestampOfLastFrameAlreadyGot, double& aTimestampOfNextFrameToBeAdded, vtkIGSIOTrackedFrameList* aTrackedFrameList, double aSamplingPeriodSec, double maxTimeLimitSec = -1);
124 
134  PlusStatus GetTrackedFrameList(double& aTimestampOfLastFrameAlreadyGot, vtkIGSIOTrackedFrameList* aTrackedFrameList, int aMaxNumberOfFramesToAdd);
135 
137  virtual double GetClosestTrackedFrameTimestampByTime(double time);
138 
140  virtual PlusStatus GetMostRecentTimestamp(double& ts);
141 
143  virtual PlusStatus GetOldestTimestamp(double& ts);
144 
145  virtual PlusStatus Clear();
146 
147  virtual void ShallowCopy(vtkDataObject*);
148  virtual void ShallowCopy(const vtkPlusChannel& aChannel);
149 
150  virtual PlusStatus GetLatestTimestamp(double& aTimestamp) const;
151 
152  void SetOwnerDevice(vtkPlusDevice* _arg) { this->OwnerDevice = _arg; }
153  vtkPlusDevice* GetOwnerDevice() const { return this->OwnerDevice; }
154 
155  PlusStatus SetCustomAttribute(const std::string& attributeId, const std::string& value);
156  PlusStatus GetCustomAttribute(const std::string& attributeId, std::string& output) const;
157  PlusStatus GetCustomAttributeMap(CustomAttributeMap& output) const;
158 
159  vtkSetStringMacro(ChannelId);
160  vtkGetStringMacro(ChannelId);
161 
162  vtkGetObjectMacro(RfProcessor, vtkPlusRfProcessor);
163  vtkSetObjectMacro(RfProcessor, vtkPlusRfProcessor);
164 
165  vtkSetMacro(SaveRfProcessingParameters, bool);
166 
171  virtual PlusStatus GenerateDataAcquisitionReport(vtkPlusHTMLGenerator* htmlReport);
172 
173 protected:
175  virtual int GetNumberOfFramesBetweenTimestamps(double aTimestampFrom, double aTimestampTo);
176 
177 protected:
182  char* ChannelId;
183 
186  vtkImageData* BlankImage;
188  FrameSizeType BrightnessFrameSize;
189 
192 
199 
201 
202  vtkPlusChannel(void);
203  virtual ~vtkPlusChannel(void);
204 
205 private:
207  void operator=(const vtkPlusChannel&);
208 };
209 
210 #endif
DataSourceContainer::const_iterator DataSourceContainerConstIterator
bool HasVideoSource() const
Abstract interface for tracker and video devices.
Definition: vtkPlusDevice.h:60
std::map< std::string, vtkPlusDataSource * > DataSourceContainer
double * timestamp
Definition: phidget22.h:3432
DataSourceContainerIterator GetToolsStartIterator()
CustomAttributeMap::const_iterator CustomAttributeMapConstIterator
StreamBufferItem BrightnessOutputTrackedFrame
igsioStatus PlusStatus
Definition: PlusCommon.h:40
DataSourceContainerConstIterator GetToolsEndConstIterator() const
DataSourceContainerIterator GetFieldDataSourcesStartIterator()
std::map< std::string, std::string > CustomAttributeMap
vtkPlusDataSource * TimestampMasterTool
DataSourceContainerIterator GetToolsEndIterator()
vtkPlusDevice * OwnerDevice
DataSourceContainerConstIterator GetFieldDataSourcesStartConstIterator() const
#define PLUS_FAIL
Definition: PlusCommon.h:43
DataSourceContainer Tools
DataSourceContainerConstIterator GetFieldDataSourcesEndConstIterator() const
DataSourceContainerConstIterator GetToolsStartConstIterator() const
DataSourceContainer FieldDataSources
CustomAttributeMap::iterator CustomAttributeMapIterator
#define PLUS_SUCCESS
Definition: PlusCommon.h:44
PhidgetGPS_Time * time
Definition: phidget22.h:3623
FrameSizeType BrightnessFrameSize
DataSourceContainer::iterator DataSourceContainerIterator
vtkPlusDataSource * VideoSource
const char const char * value
Definition: phidget22.h:5111
Convenience class to combine multiple algorithms to compute a displayable B-mode frame from RF data.
vtkImageData * BlankImage
vtkPlusRfProcessor * RfProcessor
bool SaveRfProcessingParameters
Contains an optional timestamped circular buffer containing the video images and a number of timestam...
PlusStatus GetVideoSource(vtkPlusDataSource *&aVideoSource) const
int ToolCount() const
int FieldCount() const
class for generating basic html tags
void SetOwnerDevice(vtkPlusDevice *_arg)
vtkPlusDevice * GetOwnerDevice() const
CustomAttributeMap CustomAttributes
DataSourceContainerIterator GetFieldDataSourcesEndIterator()
Interface to a 3D positioning tool, video source, or generalized data stream.