17 #ifndef MITKUSTelemedSDKHeader_H
18 #define MITKUSTelemedSDKHeader_H
32 #define SAFE_RELEASE(x) { if (x) x->Release(); x = NULL; }
37 #define RETURN_TelemedValue(control) { \
39 HRESULT hr = control->get_Current(&value); \
40 if (FAILED(hr)) { mitkThrow() << "Could not get telemed value " << control << "(" << hr << ")."; }; \
41 return static_cast<double>(value); \
47 #define SET_TelemedValue(control,value) { \
48 HRESULT hr = control->put_Current(static_cast<LONG>(value)); \
49 if (FAILED(hr)) { mitkThrow() << "Could not set telemed value " << value << " to " << control << "(" << hr << ")."; }; \
56 #define RETURN_TelemedAvailableValues(control) { \
57 RETURN_TelemedAvailableValuesWithFactor(control, 1); \
60 #define RETURN_TelemedAvailableValuesWithFactor(control, factor) { \
61 Usgfw2Lib::IUsgValues *usgValues; \
62 HRESULT hr = control->get_Values(&usgValues); \
65 hr = usgValues->get_Count(&usgValuesNum); \
67 std::vector<double> values(usgValuesNum, 0); \
70 for (int n = 0; n < usgValuesNum; n++) \
72 item = usgValues->Item(n); \
73 values.at(n) = static_cast<double>(item.lVal) / factor; \
74 VariantClear(&item); \
77 SAFE_RELEASE(usgValues); \
87 #define GETINOUTPUT_TelemedAvailableValuesBounds(control, output) { \
88 Usgfw2Lib::IUsgValues *usgValues; \
89 HRESULT hr = control->get_Values(&usgValues); \
90 if (FAILED(hr)) { mitkThrow() << "Values couldn't be read from Teleme API (" << hr << ")."; } \
93 hr = usgValues->get_Count(&usgValuesNum); \
94 if (usgValuesNum < 1 || FAILED(hr)) { mitkThrow() << "No values could be read from Telemed API."; } \
98 item = usgValues->Item(0); \
99 output[0] = static_cast<double>(item.lVal); \
100 VariantClear(&item); \
102 item = usgValues->Item(usgValuesNum-1); \
103 output[1] = static_cast<double>(item.lVal); \
104 VariantClear(&item); \
106 output[2] = (output[1] - output[0]) / usgValuesNum; \
113 #define CREATE_TelemedControl(control, dataView, iidType, type, scanMode) { \
114 IUnknown* tmp_obj = NULL; \
115 mitk::telemed::CreateUsgControl( dataView, iidType, scanMode, 0, (void**)&tmp_obj ); \
116 if ( ! tmp_obj ) { mitkThrow() << "Could not create telemed control " << control << ")."; } \
118 SAFE_RELEASE(control); \
119 control = (type*)tmp_obj; \
131 bool CreateUsgControl( Usgfw2Lib::IUsgDataView* dataView,
const IID& typeId, ULONG scanMode, ULONG streamId,
void** ctrl );
140 #endif // MITKUSTelemedSDKHeader_H
DataCollection - Class to facilitate loading/accessing structured data.
std::string ConvertWcharToString(const BSTR input)
bool CreateUsgControl(Usgfw2Lib::IUsgDataView *dataView, const IID &typeId, ULONG scanMode, ULONG streamId, void **ctrl)