13 #ifndef MITKUSTelemedSDKHeader_H 14 #define MITKUSTelemedSDKHeader_H 28 #define SAFE_RELEASE(x) { if (x) x->Release(); x = nullptr; } 33 #define RETURN_TelemedValue(control) { \ 35 HRESULT hr = control->get_Current(&value); \ 36 if (FAILED(hr)) { mitkThrow() << "Could not get telemed value " << control << "(" << hr << ")."; }; \ 37 return static_cast<double>(value); \ 43 #define SET_TelemedValue(control,value) { \ 44 HRESULT hr = control->put_Current(static_cast<LONG>(value)); \ 45 if (FAILED(hr)) { mitkThrow() << "Could not set telemed value " << value << " to " << control << "(" << hr << ")."; }; \ 52 #define RETURN_TelemedAvailableValues(control) { \ 53 RETURN_TelemedAvailableValuesWithFactor(control, 1); \ 56 #define RETURN_TelemedAvailableValuesWithFactor(control, factor) { \ 57 Usgfw2Lib::IUsgValues *usgValues; \ 58 HRESULT hr = control->get_Values(&usgValues); \ 61 hr = usgValues->get_Count(&usgValuesNum); \ 63 std::vector<double> values(usgValuesNum, 0); \ 66 for (int n = 0; n < usgValuesNum; n++) \ 68 item = usgValues->Item(n); \ 69 values.at(n) = static_cast<double>(item.lVal) / factor; \ 70 VariantClear(&item); \ 73 SAFE_RELEASE(usgValues); \ 83 #define GETINOUTPUT_TelemedAvailableValuesBounds(control, output) { \ 84 Usgfw2Lib::IUsgValues *usgValues; \ 85 HRESULT hr = control->get_Values(&usgValues); \ 86 if (FAILED(hr)) { mitkThrow() << "Values couldn't be read from Teleme API (" << hr << ")."; } \ 89 hr = usgValues->get_Count(&usgValuesNum); \ 90 if (usgValuesNum < 1 || FAILED(hr)) { mitkThrow() << "No values could be read from Telemed API."; } \ 94 item = usgValues->Item(0); \ 95 output[0] = static_cast<double>(item.lVal); \ 96 VariantClear(&item); \ 98 item = usgValues->Item(usgValuesNum-1); \ 99 output[1] = static_cast<double>(item.lVal); \ 100 VariantClear(&item); \ 102 output[2] = (output[1] - output[0]) / usgValuesNum; \ 109 #define CREATE_TelemedControl(control, dataView, iidType, type, scanMode) { \ 110 IUnknown* tmp_obj = nullptr; \ 111 mitk::telemed::CreateUsgControl( dataView, iidType, scanMode, 0, (void**)&tmp_obj ); \ 112 if ( ! tmp_obj ) { mitkThrow() << "Could not create telemed control " << control << ")."; } \ 114 SAFE_RELEASE(control); \ 115 control = (type*)tmp_obj; \ 127 bool CreateUsgControl( Usgfw2Lib::IUsgDataView* dataView,
const IID& typeId, ULONG scanMode, ULONG streamId,
void** ctrl );
136 #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)