Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkUSTelemedSDKHeader.cpp
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #include "mitkUSTelemedSDKHeader.h"
18 
19 #include <mitkCommon.h>
20 
21 /*bool mitk::telemed::CreateUsgControl( Usgfw2Lib::IUsgDataView* dataView, const IID& typeId, ULONG scanMode, ULONG streamId, void** ctrl )
22 {
23  if ( ! dataView ) {
24  MITK_WARN("CreateUsgControl") << "DataView must not be null.";
25  return false;
26  }
27 
28  Usgfw2Lib::IUsgControl* ctrl2 = NULL;
29 
30  HRESULT hr;
31  hr = dataView->GetControlObj( (GUID*)(&typeId), scanMode, streamId, &ctrl2 );
32  if (FAILED(hr) || ! ctrl2)
33  {
34  MITK_WARN("CreateUsgControl") << "Could not get control object from data view (" << hr << ").";
35  return false;
36  }
37 
38  hr = ctrl2->QueryInterface( typeId, (void**)ctrl );
39  if (FAILED(hr)) { *ctrl = NULL; }
40 
41  SAFE_RELEASE(ctrl2);
42 
43  return true;
44 }*/
45 
46 bool mitk::telemed::CreateUsgControl( Usgfw2Lib::IUsgDataView* data_view, const IID& type_id, ULONG scan_mode, ULONG
47  stream_id, void** ctrl )
48 {
49  Usgfw2Lib::IUsgControl* ctrl2;
50  ctrl2 = NULL;
51  if (data_view == NULL) return false;
52  data_view->GetControlObj( (GUID*)(&type_id), scan_mode, stream_id, &ctrl2 );
53  if (ctrl2 != NULL)
54  {
55  HRESULT hr;
56  hr = ctrl2->QueryInterface( type_id, (void**)ctrl );
57  if (hr != S_OK) *ctrl = NULL;
58  SAFE_RELEASE(ctrl2);
59  }
60 
61  return true;
62 }
63 
64 std::string mitk::telemed::ConvertWcharToString( const BSTR input )
65 {
66  // BSTR (-> wchar*) must first be converted to a std::wstring
67  std::wstring tmp(input);
68 
69  // this can be converted to a std::string then
70  std::string output(tmp.begin(), tmp.end());
71 
72  return output;
73 }
std::string ConvertWcharToString(const BSTR input)
bool CreateUsgControl(Usgfw2Lib::IUsgDataView *dataView, const IID &typeId, ULONG scanMode, ULONG streamId, void **ctrl)
#define SAFE_RELEASE(x)