PlusLib  2.9.0
Software library for tracked ultrasound image acquisition, calibration, and processing.
vtkPlusSonixPortaVideoSource.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 /*=========================================================================
8 The following copyright notice is applicable to parts of this file:
9 Copyright (c) Elvis Chen, 2008
10 All rights reserved.
11 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
12 Authors include: Elvis Chen (Queen's University)
13 =========================================================================*/
14 
15 #ifndef __vtkPlusSONIXPORTAVIDEOSOURCE_H__
16 #define __vtkPlusSONIXPORTAVIDEOSOURCE_H__
17 
18 #include "PlusConfigure.h"
19 #include "vtkPlusDataCollectionExport.h"
20 
21 #include "vtkPlusUsDevice.h"
22 
23 class vtkPlusDataCollectionExport vtkPlusSonixPortaVideoSource;
24 class porta;
25 
26 #if (PLUS_ULTRASONIX_SDK_MAJOR_VERSION < 6)
27  class probeInfo;
28 #else
29  struct probeInfo;
30 #endif
31 
32 
38 class vtkPlusDataCollectionExport vtkPlusSonixPortaVideoSourceCleanup
39 {
40 public:
43 
44 private:
47 };
48 
80 class vtkPlusDataCollectionExport vtkPlusSonixPortaVideoSource : public vtkPlusUsDevice
81 {
83  void PrintSelf(ostream& os, vtkIndent indent);
84 
91 
93  static vtkPlusSonixPortaVideoSource* GetInstance();
94 
96  static void SetInstance(vtkPlusSonixPortaVideoSource* instance);
97 
98  //BTX
103  //ETX
104 
106  virtual std::string GetSdkVersion(); virtual PlusStatus ReadConfiguration(vtkXMLDataElement* config);
109  virtual PlusStatus WriteConfiguration(vtkXMLDataElement* config);
110 
111  /* List of parameters which can be set or read in B-mode, other mode parameters not currently implemented*/
112 
114  vtkSetStringMacro(PortaProbeName);
115  vtkGetStringMacro(PortaProbeName);
116 
118  vtkSetStringMacro(PortaSettingPath);
119  vtkGetStringMacro(PortaSettingPath);
120 
122  vtkSetStringMacro(PortaFirmwarePath);
123  vtkGetStringMacro(PortaFirmwarePath);
124 
126  vtkSetStringMacro(PortaLUTPath);
127  vtkGetStringMacro(PortaLUTPath);
128 
130  vtkSetMacro(Usm, int);
132  vtkGetMacro(Usm, int);
133 
135  vtkSetMacro(Pci, int);
137  vtkGetMacro(Pci, int);
138 
140  vtkSetStringMacro(PortaLicensePath);
141  vtkGetStringMacro(PortaLicensePath);
142 
144  PlusStatus SetFrequency(int aFrequency);
146  PlusStatus GetFrequency(int& aFrequency);
147 
149  PlusStatus SetDepth(int aDepth);
151  PlusStatus GetDepth(int& aDepth);
152 
154  PlusStatus SetGain(int aGain);
156  PlusStatus GetGain(int& aGain);
157 
159  PlusStatus SetZoom(int aZoom);
161  PlusStatus GetZoom(int& aZoom);
162 
164  PlusStatus SetFramePerVolume(int aFramePerVolume);
166  PlusStatus GetFramePerVolume(int& aFramePerVolume);
167 
169  PlusStatus SetStepPerFrame(int aStepPerFrame);
171  PlusStatus GetStepPerFrame(int& aStepPerFrame);
172 
174  PlusStatus SetMotorRotationRangeDeg(double fovDeg);
176  PlusStatus GetMotorRotationRangeDeg(double& fovDeg);
177 
178  vtkSetMacro(ImagingMode, int);
179  vtkGetMacro(ImagingMode, int);
180 
181  vtkSetMacro(PortaBModeWidth, int);
182  vtkGetMacro(PortaBModeWidth, int);
183 
184  vtkSetMacro(PortaBModeHeight, int);
185  vtkGetMacro(PortaBModeHeight, int);
186 
188  void SetPortaCineSize(int size);
189 
191  int GetPortaFrameRate();
192 
194  vtkSetMacro(AutoClipEnabled, bool);
195  vtkGetMacro(AutoClipEnabled, bool);
196 
198  virtual PlusStatus NotifyConfigured();
199 
200 protected:
203 
205  virtual PlusStatus InternalConnect();
206 
208  virtual PlusStatus InternalDisconnect();
209 
211  // continues indefinitely until StopRecording() is called.
213 
216 
218  std::string GetLastPortaError();
219 
221  porta* Porta;
223 
225  int Depth;
227  int Gain;
228  int Zoom;
229 
231 
233  int Usm;
234  int Pci;
235 
241 
244 
246  double CurrentPixelSpacingMm[2];
247  int CurrentTransducerOriginPixels[2];
248 
250 
252  PlusStatus AddFrameToBuffer(void* param, int id, bool motorRotationCcw, int motorStepCount);
253 
255  PlusStatus SetParamValue(char* paramId, int paramValue, int& validatedParamValue);
257  PlusStatus GetParamValue(char* paramId, int& paramValue, int& validatedParamValue);
258 
259  virtual bool IsTracker() const { return false; }
260 
261 private:
262  // data members
263  static vtkPlusSonixPortaVideoSource* Instance;
264 
266 #if (PLUS_ULTRASONIX_SDK_MAJOR_VERSION < 5) || (PLUS_ULTRASONIX_SDK_MAJOR_VERSION == 5 && PLUS_ULTRASONIX_SDK_MINOR_VERSION < 7)
267  // SDK version < 5.7.x
268  static bool vtkPlusSonixPortaVideoSourceNewFrameCallback(void* param, int id);
269 #elif (PLUS_ULTRASONIX_SDK_MAJOR_VERSION < 6)
270  // 5.7.x <= SDK version < 6.x
271  static bool vtkPlusSonixPortaVideoSourceNewFrameCallback(void* param, int id, int header);
272 #else
273  static int vtkPlusSonixPortaVideoSourceNewFrameCallback(void* param, int id, int header);
274 #endif
275 
276  // vtkPlusSonixPortaVideoSource(const vtkPlusSonixPortaVideoSource&); // Not implemented.
277  // void operator=(const vtkPlusSonixPortaVideoSource&); // Not implemented.
278 
280  PlusStatus vtkPlusSonixPortaVideoSource::UpdateSonixPortaParams();
281 
283  std::string GetMotorToMotorRotatedTransform(double MotorAngle);
284 
285  // Porta parameters
287  int PortaBModeWidth;
288 
290  int PortaBModeHeight;
291 
293  char* PortaProbeName;
294 
296  char* PortaSettingPath;
297 
299  char* PortaFirmwarePath;
300 
302  char* PortaLUTPath;
303 
305  char* PortaLicensePath;
306 
308  int PortaCineSize;
309 
311  int FramePerVolume;
312 
314  double MotorRotationRangeDeg;
315 
317  int StepPerFrame;
318 
320  probeInfo* ProbeInformation;
321 
323  double MotorRotationPerStepDeg;
324 
326  double MotorRotationStartAngleDeg;
327 
329  bool FirstCallToAddFrameToBuffer;
330 
332  int VolumeIndex;
333 
335  int FrameIndexInVolume;
336 
338  bool LastRotationCcw;
339 
340  unsigned char* ImageBuffer;
341 };
342 
343 #endif // of __vtkPlusSONIXPORTAVIDEOSOURCE_H__
virtual PlusStatus InternalStopRecording()
Abstract interface for tracker and video devices.
Definition: vtkPlusDevice.h:60
virtual PlusStatus InternalConnect()
igsioStatus PlusStatus
Definition: PlusCommon.h:40
Class that cleans up (deletes singleton instance of) vtkPlusSonixPortaVideoSource when destroyed.
class vtkPlusDataCollectionExport vtkPlusSonixPortaVideoSource
virtual std::string GetSdkVersion()
virtual PlusStatus WriteConfiguration(vtkXMLDataElement *)
Class providing VTK video input interface for SonixRP.
virtual void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
virtual PlusStatus InternalStartRecording()
static vtkPlusUsDevice * New()
virtual PlusStatus ReadConfiguration(vtkXMLDataElement *)
virtual PlusStatus NotifyConfigured()
virtual PlusStatus InternalDisconnect()
Abstract interface for ultrasound video devices.