27 m_Probe(0), m_UsgDataView(0), m_ProbesCollection(0)
29 SetNumberOfOutputs(1);
39 return "org.mitk.modules.us.USTelemedDevice";
44 return m_ControlsBMode.GetPointer();
49 return m_ControlsProbes.GetPointer();
54 return m_ControlsDoppler.GetPointer();
69 hr = CoCreateInstance(Usgfw2Lib::CLSID_Usgfw2, NULL, CLSCTX_INPROC_SERVER, Usgfw2Lib::IID_IUsgfw2,(LPVOID*) &m_UsgMainInterface);
73 MITK_ERROR(
"USDevice")(
"USTelemedDevice") <<
"Error at connecting to ultrasound device (" << hr <<
").";
77 this->ConnectDeviceChangeSink();
85 m_ControlsBMode->SetIsActive(
false);
86 m_ControlsDoppler->SetIsActive(
false);
87 m_ControlsProbes->SetIsActive(
false);
97 m_ControlsProbes->SetIsActive(
true);
99 if ( m_ControlsProbes->GetProbesCount() < 1 )
101 MITK_WARN(
"USDevice")(
"USTelemedDevice") <<
"No probe found.";
106 m_ControlsProbes->SelectProbe(0);
110 HRESULT hr = m_UsgDataView->put_ScanMode(Usgfw2Lib::SCAN_MODE_B);
113 MITK_ERROR(
"USDevice")(
"USTelemedDevice") <<
"Could not set scan mode b (" << hr <<
").";
118 hr = m_UsgDataView->put_ScanState(Usgfw2Lib::SCAN_STATE_RUN);
121 MITK_ERROR(
"USDevice")(
"USTelemedDevice") <<
"Start scanning failed (" << hr <<
").";
125 m_ControlsBMode->ReinitializeControls();
132 this->StopScanning();
140 m_UsgDataView->put_ScanState(Usgfw2Lib::SCAN_STATE_FREEZE);
144 m_UsgDataView->put_ScanState(Usgfw2Lib::SCAN_STATE_RUN);
150 return m_ImageSource.GetPointer();
155 if (m_UsgDataView) { this->StopScanning(); };
165 if ( ! m_UsgDataView )
167 MITK_WARN(
"USDevice")(
"USTelemedDevice") <<
"Cannot stop scanning as Telemed Data View is null.";
172 hr = m_UsgDataView->put_ScanState(Usgfw2Lib::SCAN_STATE_STOP);
176 MITK_ERROR(
"USDevice")(
"USTelemedDevice") <<
"Stop scanning failed (" << hr <<
").";
177 mitkThrow() <<
"Stop scanning failed (" << hr <<
").";
183 return m_UsgMainInterface;
189 if ( m_UsgDataView != usgDataView )
193 m_UsgDataView = usgDataView;
194 if ( ! m_ImageSource->CreateAndConnectConverterPlugin(m_UsgDataView, Usgfw2Lib::SCAN_MODE_B)) {
return; }
197 m_ControlsBMode->SetUsgDataView(m_UsgDataView);
203 IConnectionPointContainer* cpc = NULL;
204 HRESULT hr = m_UsgMainInterface->QueryInterface(IID_IConnectionPointContainer, (
void**)&cpc);
209 hr = cpc->FindConnectionPoint(Usgfw2Lib::IID_IUsgDeviceChangeSink, &m_UsgDeviceChangeCpnt);
213 m_UsgDeviceChangeCpnt = NULL;
214 m_UsgDeviceChangeCpntCookie = 0;
218 if (m_UsgDeviceChangeCpnt != NULL)
219 hr = m_UsgDeviceChangeCpnt->Advise((IUnknown*)((Usgfw2Lib::IUsgDeviceChangeSink*)
this), &m_UsgDeviceChangeCpntCookie);
233 if ( this->GetIsActive() ) { this->Deactivate(); }
242 m_ControlsProbes->ProbeAdded(static_cast<unsigned int>(*probeIndex));
251 m_ControlsProbes->ProbeRemoved(static_cast<unsigned int>(*probeIndex));
253 if ( this->GetIsActive() ) { this->Deactivate(); }
272 if (riid == IID_IUnknown || riid == Usgfw2Lib::IID_IUsgDeviceChangeSink)
274 *ppv = (IUsgDeviceChangeSink*)
this;
277 if (riid == IID_IDispatch)
279 *ppv = (IDispatch*)
this;
282 return E_NOINTERFACE;
287 if (pctinfo == NULL)
return E_INVALIDARG;
294 if (pptinfo == NULL)
return E_INVALIDARG;
296 if(itinfo != 0)
return DISP_E_BADINDEX;
306 HRESULT
mitk::USTelemedDevice::Invoke(DISPID dispIdMember,
const IID &riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
308 if ( (dispIdMember >= 1) && (dispIdMember <= 6) )
310 if (pDispParams->cArgs != 2)
313 IUnknown *unkn = NULL;
318 p1 = pDispParams->rgvarg;
321 if (p->vt == (VT_BYREF|VT_UI4))
326 if (p->vt == VT_UNKNOWN)
327 unkn = (IUnknown*)(p->punkVal);
329 if (dispIdMember == 1)
330 OnProbeArrive(unkn, res);
331 else if (dispIdMember == 2)
332 OnBeamformerArrive(unkn, res);
333 else if (dispIdMember == 3)
334 OnProbeRemove(unkn, res);
335 else if (dispIdMember == 4)
336 OnBeamformerRemove(unkn, res);
337 else if (dispIdMember == 5)
338 OnProbeStateChanged(unkn, res);
339 else if (dispIdMember == 6)
340 OnBeamformerStateChanged(unkn, res);
virtual bool OnConnection()
Is called during the connection process. Connect to the Telemed API and try to get available probes f...
A device holds information about it's model, make and the connected probes. It is the common super cl...
itk::SmartPointer< Self > Pointer
virtual itk::DataObject::Pointer MakeOutput(DataObjectPointerArraySizeType idx) override
Make a DataObject of the correct type to used as the specified output.
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(const IID &riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgdispid)
DataCollection - Class to facilitate loading/accessing structured data.
Implementation of mitk::USControlInterfaceProbes for Telemed ultrasound devices. See documentation of...
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.
virtual HRESULT STDMETHODCALLTYPE Invoke(DISPID dispIdMember, const IID &riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
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()
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 ...
STDMETHODIMP_(ULONG) mitk
virtual bool OnInitialization()
Is called during the initialization process. There is nothing done on the initialization of a mik::US...
void StopScanning()
Stop ultrasound scanning by Telemed API call.
virtual ~USTelemedDevice()
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)
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.
Implementation of mitk::USControlInterfaceDoppler for Telemed ultrasound devices. See documentation o...