MITK-IGT
IGT Extension of MITK
Loading...
Searching...
No Matches
mitkUSTelemedSDKHeader.cpp
Go to the documentation of this file.
1/*============================================================================
2
3The Medical Imaging Interaction Toolkit (MITK)
4
5Copyright (c) German Cancer Research Center (DKFZ)
6All rights reserved.
7
8Use of this source code is governed by a 3-clause BSD license that can be
9found in the LICENSE file.
10
11============================================================================*/
12
14
15#include <mitkCommon.h>
16
17/*bool mitk::telemed::CreateUsgControl( Usgfw2Lib::IUsgDataView* dataView, const IID& typeId, ULONG scanMode, ULONG streamId, void** ctrl )
18{
19 if ( ! dataView ) {
20 MITK_WARN("CreateUsgControl") << "DataView must not be null.";
21 return false;
22 }
23
24 Usgfw2Lib::IUsgControl* ctrl2 = nullptr;
25
26 HRESULT hr;
27 hr = dataView->GetControlObj( (GUID*)(&typeId), scanMode, streamId, &ctrl2 );
28 if (FAILED(hr) || ! ctrl2)
29 {
30 MITK_WARN("CreateUsgControl") << "Could not get control object from data view (" << hr << ").";
31 return false;
32 }
33
34 hr = ctrl2->QueryInterface( typeId, (void**)ctrl );
35 if (FAILED(hr)) { *ctrl = nullptr; }
36
37 SAFE_RELEASE(ctrl2);
38
39 return true;
40}*/
41
42bool mitk::telemed::CreateUsgControl( Usgfw2Lib::IUsgDataView* data_view, const IID& type_id, ULONG scan_mode, ULONG
43 stream_id, void** ctrl )
44{
45 Usgfw2Lib::IUsgControl* ctrl2;
46 ctrl2 = nullptr;
47 if (data_view == nullptr) return false;
48 data_view->GetControlObj( (GUID*)(&type_id), scan_mode, stream_id, &ctrl2 );
49 if (ctrl2 != nullptr)
50 {
51 HRESULT hr;
52 hr = ctrl2->QueryInterface( type_id, (void**)ctrl );
53 if (hr != S_OK) *ctrl = nullptr;
54 SAFE_RELEASE(ctrl2);
55 }
56
57 return true;
58}
59
60std::string mitk::telemed::ConvertWcharToString( const BSTR input )
61{
62 // BSTR (-> wchar*) must first be converted to a std::wstring
63 std::wstring tmp(input);
64
65 // this can be converted to a std::string then
66 std::string output(tmp.begin(), tmp.end());
67
68 return output;
69}
#define SAFE_RELEASE(x)
bool CreateUsgControl(Usgfw2Lib::IUsgDataView *dataView, const IID &typeId, ULONG scanMode, ULONG streamId, void **ctrl)
std::string ConvertWcharToString(const BSTR input)