PlusLib  2.9.0
Software library for tracked ultrasound image acquisition, calibration, and processing.
TelemedUltrasound.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 TelemedUltrasound_h
8 #define TelemedUltrasound_h
9 
10 #include "igsioCommon.h"
11 #include "Usgfw2.h"
12 
13 // STL includes
14 #include <vector>
15 
17 {
18 public:
19 
21  virtual ~TelemedUltrasound();
22 
23  PlusStatus Connect(int probeId = 0);
24  void Disconnect();
25 
26  unsigned char* CaptureFrame();
27  unsigned long GetBufferSize() {return m_FrameBuffer.size();}
28  void GetFrameSize(FrameSizeType& frameSize) { frameSize = m_FrameSize; }
29 
31  void SetMaximumFrameSize(const FrameSizeType& maxFrameSize);
32 
33  void FreezeDevice(bool freeze);
34 
35  PlusStatus GetFrequencyMhz(double& freqMHz);
36  PlusStatus SetFrequencyMhz(double freqMHz);
37 
38  PlusStatus SetDepthMm(double depthMm);
39  PlusStatus GetDepthMm(double& depthMm);
40 
41  PlusStatus SetGainPercent(double gainPercent);
42  PlusStatus GetGainPercent(double& gainPercent);
43 
44  PlusStatus SetPowerDb(double powerDb);
45  PlusStatus GetPowerDb(double& powerDb);
46 
47  PlusStatus SetFocusDepthPercent(double focusDepthPercent);
48  PlusStatus GetFocusDepthPercent(double& focusDepthPercent);
49 
50  PlusStatus SetDynRangeDb(double dynRangeDb);
51  PlusStatus GetDynRangeDb(double& dynRangeDb);
52 
53 protected:
54  std::vector<unsigned char> m_FrameBuffer;
55  FrameSizeType m_FrameSize;
56  FrameSizeType m_MaximumFrameSize;
57 
58 private:
59  IUsgfw2* m_usgfw2;
60  IUsgDataView* m_data_view;
61  IProbe* m_probe;
62  IUsgMixerControl* m_mixer_control;
63  IUsgDepth* m_depth_ctrl;
64  IUsgPower* m_b_power_ctrl;
65  IUsgGain* m_b_gain_ctrl;
66  IUsgDynamicRange* m_b_dynrange_ctrl;
67  IUsgProbeFrequency3* m_b_frequency_ctrl;
68  IUsgFocus* m_b_focus_ctrl;
69 
70  IConnectionPoint* m_usg_device_change_cpnt; // connection point for device change events
71  DWORD m_usg_device_change_cpnt_cookie;
72 
73  IConnectionPoint* m_usg_control_change_cpnt; // connection point for control change events
74  DWORD m_usg_control_change_cpnt_cookie;
75 
76  void CreateUsgControl(IUsgDataView* data_view, const IID& type_id, ULONG scan_mode, ULONG stream_id, void** ctrl);
77  void ReleaseUsgControls(bool release_usgfw2);
78 
79  long GetDepth();
80  void DepthSetPrevNext(int dir);
81 
82  LPCWSTR GetInterfaceNameByGuid(BSTR ctrlGUID);
83  LPCWSTR GetModeNameById(LONG scanMode);
84 
85 private:
86  HWND ImageWindowHandle;
87  HBITMAP DataHandle;
88  std::vector<unsigned char> MemoryBitmapBuffer;
89  BITMAP Bitmap;
90 
91 public:
92  void CreateUsgControls(int probeId=0);
93 
94 public:
95  // IUnknown
96  STDMETHODIMP_(ULONG) AddRef();
97  STDMETHODIMP_(ULONG) Release();
98  STDMETHODIMP QueryInterface(REFIID riid, void** ppv);
100 
101  // IDispatch
102  virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount(UINT* pctinfo);
103  virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo** pptinfo);
104  virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(const IID& riid, LPOLESTR* rgszNames, UINT cNames, LCID lcid, DISPID* rgdispid);
105  virtual HRESULT STDMETHODCALLTYPE Invoke(DISPID dispIdMember, const IID& riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr);
106 
107  // IUsgCtrlChangeCommon
108  virtual HRESULT STDMETHODCALLTYPE OnControlChanged(REFIID riidCtrl, ULONG scanMode, LONG streamId, IUsgControl* pControlObj, LONG dispId, LONG flags);
109  virtual HRESULT STDMETHODCALLTYPE OnControlChangedBSTR(BSTR ctrlGUID, LONG scanMode, LONG streamId, IUsgControl* pControlObject, LONG dispId, LONG flags);
110 
111  // IUsgDeviceChangeSink
112  virtual HRESULT STDMETHODCALLTYPE OnProbeArrive(IUnknown* pUsgProbe, ULONG* reserved);
113  virtual HRESULT STDMETHODCALLTYPE OnBeamformerArrive(IUnknown* pUsgBeamformer, ULONG* reserved);
114  virtual HRESULT STDMETHODCALLTYPE OnProbeRemove(IUnknown* pUsgProbe, ULONG* reserved);
115  virtual HRESULT STDMETHODCALLTYPE OnBeamformerRemove(IUnknown* pUsgBeamformer, ULONG* reserved);
116  virtual HRESULT STDMETHODCALLTYPE OnProbeStateChanged(IUnknown* pUsgProbe, ULONG* reserved);
117  virtual HRESULT STDMETHODCALLTYPE OnBeamformerStateChanged(IUnknown* pUsgBeamformer, ULONG* reserved);
118 };
119 
120 #endif //TelemedUltrasound
virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount(UINT *pctinfo)
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
PlusStatus GetFocusDepthPercent(double &focusDepthPercent)
PlusStatus SetPowerDb(double powerDb)
virtual HRESULT STDMETHODCALLTYPE OnBeamformerArrive(IUnknown *pUsgBeamformer, ULONG *reserved)
virtual HRESULT STDMETHODCALLTYPE OnBeamformerStateChanged(IUnknown *pUsgBeamformer, ULONG *reserved)
virtual HRESULT STDMETHODCALLTYPE Invoke(DISPID dispIdMember, const IID &riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
struct _IID IID
unsigned char * CaptureFrame()
igsioStatus PlusStatus
Definition: PlusCommon.h:40
unsigned short WORD
Definition: ATC3DGm.h:450
void FreezeDevice(bool freeze)
void GetFrameSize(FrameSizeType &frameSize)
interface IUsgMixerControl IUsgMixerControl
Definition: USgfw2.h:70
interface IUsgDeviceChangeSink IUsgDeviceChangeSink
Definition: USgfw2.h:91
PlusStatus GetPowerDb(double &powerDb)
interface IUsgDynamicRange IUsgDynamicRange
Definition: USgfw2.h:182
virtual HRESULT STDMETHODCALLTYPE OnControlChangedBSTR(BSTR ctrlGUID, LONG scanMode, LONG streamId, IUsgControl *pControlObject, LONG dispId, LONG flags)
interface IUsgGain IUsgGain
Definition: USgfw2.h:161
interface IUsgDataView IUsgDataView
Definition: USgfw2.h:49
interface IUsgDepth IUsgDepth
Definition: USgfw2.h:210
PlusStatus SetFocusDepthPercent(double focusDepthPercent)
virtual HRESULT STDMETHODCALLTYPE OnProbeStateChanged(IUnknown *pUsgProbe, ULONG *reserved)
STDMETHODIMP_(ULONG) AddRef()
unsigned long DWORD
Definition: ATC3DGm.h:451
PlusStatus GetGainPercent(double &gainPercent)
PlusStatus GetDepthMm(double &depthMm)
virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(const IID &riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgdispid)
PlusStatus GetDynRangeDb(double &dynRangeDb)
FrameSizeType m_FrameSize
void SetMaximumFrameSize(const FrameSizeType &maxFrameSize)
interface IProbe IProbe
Definition: USgfw2.h:126
PlusStatus GetFrequencyMhz(double &freqMHz)
PlusStatus SetDepthMm(double depthMm)
const char int const char int flags
Definition: phidget22.h:2552
unsigned long ULONG
Definition: ATC3DGm.h:432
interface IUsgPower IUsgPower
Definition: USgfw2.h:175
interface IUsgControl IUsgControl
Definition: USgfw2.h:154
PlusStatus Connect(int probeId=0)
virtual HRESULT STDMETHODCALLTYPE OnProbeArrive(IUnknown *pUsgProbe, ULONG *reserved)
virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo **pptinfo)
PlusStatus SetGainPercent(double gainPercent)
interface IUsgProbeFrequency3 IUsgProbeFrequency3
Definition: USgfw2.h:525
void CreateUsgControls(int probeId=0)
virtual HRESULT STDMETHODCALLTYPE OnProbeRemove(IUnknown *pUsgProbe, ULONG *reserved)
unsigned long GetBufferSize()
virtual HRESULT STDMETHODCALLTYPE OnBeamformerRemove(IUnknown *pUsgBeamformer, ULONG *reserved)
virtual HRESULT STDMETHODCALLTYPE OnControlChanged(REFIID riidCtrl, ULONG scanMode, LONG streamId, IUsgControl *pControlObj, LONG dispId, LONG flags)
interface IUsgFocus IUsgFocus
Definition: USgfw2.h:245
PlusStatus SetDynRangeDb(double dynRangeDb)
PlusStatus SetFrequencyMhz(double freqMHz)
FrameSizeType m_MaximumFrameSize
std::vector< unsigned char > m_FrameBuffer
interface IUsgfw2 IUsgfw2
Definition: USgfw2.h:105