23 m_Probe(0), m_UsgDataView(0), m_ProbesCollection(0)
25 SetNumberOfOutputs(1);
35 return "org.mitk.modules.us.USTelemedDevice";
55 CoInitialize(
nullptr);
65 hr = CoCreateInstance(Usgfw2Lib::CLSID_Usgfw2,
nullptr, CLSCTX_INPROC_SERVER, Usgfw2Lib::IID_IUsgfw2,(LPVOID*) &
m_UsgMainInterface);
69 MITK_ERROR(
"USDevice")(
"USTelemedDevice") <<
"Error at connecting to ultrasound device (" << hr <<
").";
97 MITK_WARN(
"USDevice")(
"USTelemedDevice") <<
"No probe found.";
106 HRESULT hr =
m_UsgDataView->put_ScanMode(Usgfw2Lib::SCAN_MODE_B);
109 MITK_ERROR(
"USDevice")(
"USTelemedDevice") <<
"Could not set scan mode b (" << hr <<
").";
114 hr =
m_UsgDataView->put_ScanState(Usgfw2Lib::SCAN_STATE_RUN);
117 MITK_ERROR(
"USDevice")(
"USTelemedDevice") <<
"Start scanning failed (" << hr <<
").";
163 MITK_WARN(
"USDevice")(
"USTelemedDevice") <<
"Cannot stop scanning as Telemed Data View is null.";
168 hr =
m_UsgDataView->put_ScanState(Usgfw2Lib::SCAN_STATE_STOP);
172 MITK_ERROR(
"USDevice")(
"USTelemedDevice") <<
"Stop scanning failed (" << hr <<
").";
173 mitkThrow() <<
"Stop scanning failed (" << hr <<
").";
199 IConnectionPointContainer* cpc =
nullptr;
200 HRESULT hr =
m_UsgMainInterface->QueryInterface(IID_IConnectionPointContainer, (
void**)&cpc);
268 if (riid == IID_IUnknown || riid == Usgfw2Lib::IID_IUsgDeviceChangeSink)
270 *ppv = (IUsgDeviceChangeSink*)
this;
273 if (riid == IID_IDispatch)
275 *ppv = (IDispatch*)
this;
278 return E_NOINTERFACE;
283 if (pctinfo ==
nullptr)
return E_INVALIDARG;
290 if (pptinfo ==
nullptr)
return E_INVALIDARG;
292 if(itinfo != 0)
return DISP_E_BADINDEX;
302 HRESULT
mitk::USTelemedDevice::Invoke(DISPID dispIdMember,
const IID &riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
304 if ( (dispIdMember >= 1) && (dispIdMember <= 6) )
306 if (pDispParams->cArgs != 2)
309 IUnknown *unkn =
nullptr;
310 ULONG *res =
nullptr;
314 p1 = pDispParams->rgvarg;
317 if (p->vt == (VT_BYREF|VT_UI4))
322 if (p->vt == VT_UNKNOWN)
323 unkn = (IUnknown*)(p->punkVal);
325 if (dispIdMember == 1)
326 OnProbeArrive(unkn, res);
327 else if (dispIdMember == 2)
328 OnBeamformerArrive(unkn, res);
329 else if (dispIdMember == 3)
330 OnProbeRemove(unkn, res);
331 else if (dispIdMember == 4)
332 OnBeamformerRemove(unkn, res);
333 else if (dispIdMember == 5)
334 OnProbeStateChanged(unkn, res);
335 else if (dispIdMember == 6)
336 OnBeamformerStateChanged(unkn, res);
virtual bool OnConnection()
Is called during the connection process. Connect to the Telemed API and try to get available probes f...
Usgfw2Lib::IUsgfw2 * m_UsgMainInterface
bool Activate()
Activates this device. After the activation process, the device will start to produce images...
A device holds information about it's model, make and the connected probes. It is the common super cl...
itk::DataObject::Pointer MakeOutput(DataObjectPointerArraySizeType idx) override
Make a DataObject of the correct type to used as the specified output.
DWORD m_UsgDeviceChangeCpntCookie
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
Usgfw2Lib::IUsgDataView * m_UsgDataView
virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(const IID &riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgdispid)
DataCollection - Class to facilitate loading/accessing structured data.
Usgfw2Lib::IProbe * m_Probe
bool Connect()
Connects this device. A connected device is ready to deliver images (i.e. be Activated). A Connected Device can be active. A disconnected Device cannot be active. Internally calls onConnect and then registers the device with the service. A device usually should override the OnConnection() method, but never the Connect() method, since this will possibly exclude the device from normal service management. The exact flow of events is: 0. Check if the device is already connected. If yes, return true anyway, but don't do anything.
Implementation of mitk::USControlInterfaceProbes for Telemed ultrasound devices. See documentation of...
USTelemedDopplerControls::Pointer m_ControlsDoppler
USTelemedImageSource::Pointer m_ImageSource
virtual HRESULT __stdcall raw_OnBeamformerRemove(IUnknown *pUsgBeamformer, ULONG *reserved)
Usgfw2Lib::IUsgfw2 * GetUsgMainInterface()
Getter for main Telemed API object. This method is for being called by Telemed control interfaces...
Implementation of mitk::USImageSource for Telemed API devices. The method mitk::USImageSource::GetNex...
virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo **pptinfo)
virtual USControlInterfaceProbes::Pointer GetControlInterfaceProbes()
Default getter for the probes control interface. Has to be implemented in a subclass if a probes cont...
virtual HRESULT __stdcall raw_OnProbeRemove(IUnknown *pUsgProbe, ULONG *reserved)
virtual bool OnDeactivation()
Is called during the deactivation process. After a call to this method the device is connected...
USTelemedDevice(std::string manufacturer, std::string model)
virtual std::string GetDeviceClass()
Returns the class of the device.
USTelemedProbesControls::Pointer m_ControlsProbes
virtual HRESULT STDMETHODCALLTYPE Invoke(DISPID dispIdMember, const IID &riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
STDMETHODIMP_(ULONG) AddRef()
virtual HRESULT __stdcall raw_OnProbeArrive(IUnknown *pUsgProbe, ULONG *reserved)
USImageSource::Pointer GetUSImageSource()
void ReleaseUsgControls()
void SetActiveDataView(Usgfw2Lib::IUsgDataView *)
Changes active IUsgDataView of the device. This method is for being called by Telemed control interfa...
virtual USControlInterfaceDoppler::Pointer GetControlInterfaceDoppler()
Default getter for the doppler control interface. Has to be implemented in a subclass if a doppler co...
virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount(UINT *pctinfo)
virtual bool OnActivation()
Is called during the activation process. After this method is finished, the device is generating imag...
void ConnectDeviceChangeSink()
void Deactivate()
Deactivates this device. After the deactivation process, the device will no longer produce images...
virtual void OnFreeze(bool freeze)
Changes scan state of the device if freeze is toggeled in mitk::USDevice.
virtual bool OnDisconnection()
Is called during the disconnection process. Deactivate and remove all Telemed API controls...
Implementation of mitk::USControlInterfaceBMode for Telemed ultrasound devices. See documentation of ...
bool GetIsActive()
True, if the device is currently generating image data, false otherwise.
bool Disconnect()
Works analogously to mitk::USDevice::Connect(). Don't override this Method, but onDisconnection inste...
virtual bool OnInitialization()
Is called during the initialization process. There is nothing done on the initialization of a mik::US...
IConnectionPoint * m_UsgDeviceChangeCpnt
void StopScanning()
Stop ultrasound scanning by Telemed API call.
virtual ~USTelemedDevice()
USTelemedBModeControls::Pointer m_ControlsBMode
virtual USControlInterfaceBMode::Pointer GetControlInterfaceBMode()
Default getter for the b mode control interface. Has to be implemented in a subclass if a b mode cont...
virtual HRESULT __stdcall raw_OnBeamformerArrive(IUnknown *pUsgBeamformer, ULONG *reserved)
Usgfw2Lib::IUsgCollection * m_ProbesCollection
Implementation of mitk::USControlInterfaceDoppler for Telemed ultrasound devices. See documentation o...