PlusLib  2.9.0
Software library for tracked ultrasound image acquisition, calibration, and processing.
vtkPlusUsImagingParameters.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 __vtkPlusUsImagingParameters_h
8 #define __vtkPlusUsImagingParameters_h
9 
10 #include "vtkPlusDataCollectionExport.h"
11 
12 #include <string>
13 #include <map>
14 
41 class vtkPlusDataCollectionExport vtkPlusUsImagingParameters : public vtkObject
42 {
43 protected:
45  {
46  public:
47  ParameterInfo() : Value(""), Set(false), Pending(false) {};
48  ParameterInfo(std::string defaultValue) : Value(defaultValue), Set(false), Pending(false) {};
49 
51  std::string Value;
54  bool Set;
56  bool Pending;
57  };
58  typedef std::map<std::string, ParameterInfo> ParameterMap;
59  typedef ParameterMap::iterator ParameterMapIterator;
60  typedef ParameterMap::const_iterator ParameterMapConstIterator;
61 
63  ParameterMapConstIterator begin() const;
65  ParameterMapConstIterator end() const;
66 
67 public:
68  static const char* XML_ELEMENT_TAG;
69  static const char* US_PARAMETER_TAG;
70  static const char* NAME_TAG;
71  static const char* VALUE_TAG;
72  static const char* KEY_FREQUENCY;
73  static const char* KEY_DEPTH;
74  static const char* KEY_FOCUS_DEPTH;
75  static const char* KEY_DYNRANGE;
76  static const char* KEY_GAIN;
77  static const char* KEY_TGC;
78  static const char* KEY_INTENSITY;
79  static const char* KEY_CONTRAST;
80  static const char* KEY_POWER;
81  static const char* KEY_SECTOR;
82  static const char* KEY_ZOOM;
83  static const char* KEY_SOUNDVELOCITY;
84  static const char* KEY_VOLTAGE;
85  static const char* KEY_IMAGESIZE;
86 
87 public:
88  static vtkPlusUsImagingParameters* New();
89  vtkTypeMacro(vtkPlusUsImagingParameters, vtkObject);
90 
96  virtual PlusStatus ReadConfiguration(vtkXMLDataElement* deviceConfig);
97 
103  virtual PlusStatus WriteConfiguration(vtkXMLDataElement* deviceConfig);
104 
108  virtual PlusStatus DeepCopy(const vtkPlusUsImagingParameters& otherParameters);
109 
115  template<typename T> PlusStatus GetValue(const std::string& paramName, T& outputValue) const
116  {
117  ParameterMapConstIterator keyIt = this->Parameters.find(paramName);
118  if (keyIt != this->Parameters.end() && keyIt->second.Set == false)
119  {
120  return PLUS_FAIL;
121  }
122  else if (keyIt == this->Parameters.end())
123  {
124  return PLUS_FAIL;
125  }
126 
127  std::stringstream ss;
128  ParameterMapConstIterator it = this->Parameters.find(paramName);
129  ss.str(it->second.Value);
130  ss >> outputValue;
131  return PLUS_SUCCESS;
132  }
133 
140  template<typename T> PlusStatus SetValue(const std::string& paramName, T aValue)
141  {
142  std::stringstream ss;
143  ss << aValue;
144  if (this->Parameters[paramName].Value != ss.str())
145  {
146  this->Parameters[paramName].Pending = true;
147  }
148  this->Parameters[paramName].Value = ss.str();
149  this->Parameters[paramName].Set = true;
150  return PLUS_SUCCESS;
151  };
156  bool IsSet(const std::string& paramName) const;
161  bool IsPending(const std::string& paramName) const;
165  PlusStatus SetPending(const std::string& paramName, bool pending);
166 
168  PlusStatus SetFrequencyMhz(double aFrequencyMhz);
170  PlusStatus GetFrequencyMhz(double& aFrequencyMhz) const;
171  double GetFrequencyMhz() const;
172 
174  PlusStatus SetDepthMm(double aDepthMm);
176  PlusStatus GetDepthMm(double& aDepthMm) const;
177  double GetDepthMm() const;
178 
180  PlusStatus SetFocusDepthPercent(double aFocusDepthPercent);
182  PlusStatus GetFocusDepthPercent(double& aFocusDepthPercent) const;
183  double GetFocusDepthPercent() const;
184 
186  PlusStatus SetGainPercent(double aGainPercent);
188  PlusStatus GetGainPercent(double aGainPercent) const;
189  double GetGainPercent() const;
190 
192  PlusStatus SetTimeGainCompensation(const std::vector<double>& tgc);
193  PlusStatus SetTimeGainCompensation(double* tgc, int length);
195  PlusStatus GetTimeGainCompensation(std::vector<double>& tgc) const;
196  std::vector<double> GetTimeGainCompensation() const;
197 
199  PlusStatus SetIntensity(double aIntensity);
201  PlusStatus GetIntensity(double& aIntensity) const;
202  double GetIntensity() const;
203 
205  PlusStatus SetContrast(double aContrast);
207  PlusStatus GetContrast(double& aContrast) const;
208  double GetContrast() const;
209 
211  PlusStatus SetPowerDb(double aPower);
213  PlusStatus GetPowerDb(double& aPower) const;
214  double GetPowerDb() const;
215 
217  PlusStatus SetDynRangeDb(double aDynRangeDb);
219  PlusStatus GetDynRangeDb(double& aDynRangeDb) const;
220  double GetDynRangeDb() const;
221 
223  PlusStatus SetZoomFactor(double aZoomFactor);
225  PlusStatus GetZoomFactor(double& aZoomFactor) const;
226  double GetZoomFactor() const;
227 
229  PlusStatus SetSectorPercent(double aSectorPercent);
231  PlusStatus GetSectorPercent(double& aSectorPercent) const;
232  double GetSectorPercent() const;
233 
235  PlusStatus SetSoundVelocity(float aSoundVelocity);
237  PlusStatus GetSoundVelocity(float& aSoundVelocity) const;
238  float GetSoundVelocity() const;
239 
241  PlusStatus SetProbeVoltage(float aVoltage);
243  PlusStatus GetProbeVoltage(float& aVoltage) const;
244  float GetProbeVoltage() const;
245 
247  PlusStatus SetImageSize(const FrameSizeType& imageSize);
248  PlusStatus SetImageSize(unsigned int x, unsigned int y, unsigned int z);
250  PlusStatus GetImageSize(FrameSizeType& imageSize) const;
251  FrameSizeType GetImageSize() const;
252 
254  virtual void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
255 
257  {
258  BMode = 0,
259  MMode = 1,
260  ColourMode = 2,
261  PwMode = 3,
262  TriplexMode = 4,
263  PanoMode = 5,
264  DualMode = 6,
265  QuadMode = 7,
266  CompoundMode = 8,
267  DualColourMode = 9,
268  DualCompoundMode = 10,
269  CwMode = 11,
270  RfMode = 12,
271  ColorSplitMode = 13,
272  F4DMode = 14,
273  TriplexCwMode = 15,
274  ColourMMode = 16,
275  ElastoMode = 17,
276  SDUVMode = 18,
277  AnatomicalMMode = 19,
278  ElastoComparativeMode = 20,
279  FusionMode = 21,
280  VecDopMode = 22,
281  BiplaneMode = 23,
282  ClinicalRfMode = 24,
283  RfCompoundMode = 25,
284  SHINEMode = 26,
285  ColourRfMode = 27
286  };
287 
288  enum DataType
289  {
290  DataTypeScreen = 0x00000001,
291  DataTypeBPre = 0x00000002,
292  DataTypeBPost = 0x00000004,
293  DataTypeBPost32 = 0x00000008,
294  DataTypeRF = 0x00000010,
295  DataTypeMPre = 0x00000020,
296  DataTypeMPost = 0x00000040,
297  DataTypePWRF = 0x00000080,
298  DataTypePWSpectrum = 0x00000100,
299  DataTypeColorRF = 0x00000200,
300  DataTypeColorCombined = 0x00000400,
301  DataTypeColorVelocityVariance = 0x00000800,
302  DataTypeContrast = 0x00001000,
303  DataTypeElastoCombined = 0x00002000,
304  DataTypeElastoOverlay = 0x00004000,
305  DataTypeElastoPre = 0x00008000,
306  DataTypeECG = 0x00010000,
307  DataTypeGPS1 = 0x00020000,
308  DataTypeGPS2 = 0x00040000,
309  DataTypeTimeStamp = 0x00080000,
310  DataTypeColorSpectrumRF = 0x00100000,
311  DataTypeMRF = 0x00200000,
312  DataTypeDAQRF = 0x00400000,
313  DataType3DPre = 0x00800000,
314  DataType3DPost = 0x01000000,
315  DataTypePNG = 0x10000000
316  };
317 
318 protected:
320  virtual ~vtkPlusUsImagingParameters();
321 
323 };
324 
325 #endif
ParameterMap::const_iterator ParameterMapConstIterator
ParameterMap::iterator ParameterMapIterator
This class is used to store a configuration of the imaging parameters of an ultrasound video device....
igsioStatus PlusStatus
Definition: PlusCommon.h:40
PlusStatus GetValue(const std::string &paramName, T &outputValue) const
#define PLUS_FAIL
Definition: PlusCommon.h:43
#define VTK_OVERRIDE
Definition: PlusCommon.h:49
#define PLUS_SUCCESS
Definition: PlusCommon.h:44
int x
Definition: phidget22.h:4265
PlusStatus SetValue(const std::string &paramName, T aValue)
std::map< std::string, ParameterInfo > ParameterMap
Direction vectors of rods y
Definition: algo3.m:15
bool Pending
Flag indicating whether the parameter is changed but has not been set to device.