MITK-IGT
IGT Extension of MITK
Loading...
Searching...
No Matches
mitkUSTelemedSDKHeader.h File Reference
#include <Usgfw2.tlh>
#include <mitkCommon.h>

Go to the source code of this file.

Namespaces

namespace  mitk
 IGT Exceptions.
 
namespace  mitk::telemed
 

Macros

#define SAFE_RELEASE(x)
 
#define RETURN_TelemedValue(control)
 
#define SET_TelemedValue(control, value)
 
#define RETURN_TelemedAvailableValues(control)
 
#define RETURN_TelemedAvailableValuesWithFactor(control, factor)
 
#define GETINOUTPUT_TelemedAvailableValuesBounds(control, output)
 
#define CREATE_TelemedControl(control, dataView, iidType, type, scanMode)
 

Enumerations

enum  mitk::telemed::ScanModes { mitk::telemed::ScanModeB }
 

Functions

bool mitk::telemed::CreateUsgControl (Usgfw2Lib::IUsgDataView *dataView, const IID &typeId, ULONG scanMode, ULONG streamId, void **ctrl)
 
std::string mitk::telemed::ConvertWcharToString (const BSTR input)
 

Macro Definition Documentation

◆ CREATE_TelemedControl

#define CREATE_TelemedControl ( control,
dataView,
iidType,
type,
scanMode )
Value:
{ \
IUnknown* tmp_obj = nullptr; \
mitk::telemed::CreateUsgControl( dataView, iidType, scanMode, 0, (void**)&tmp_obj ); \
if ( ! tmp_obj ) { mitkThrow() << "Could not create telemed control " << control << ")."; } \
\
SAFE_RELEASE(control); \
control = (type*)tmp_obj; \
}

Create Telemed API control. The interface documentation can be found in the Telemed API documentation regarding CreateUsgControl().

Definition at line 109 of file mitkUSTelemedSDKHeader.h.

◆ GETINOUTPUT_TelemedAvailableValuesBounds

#define GETINOUTPUT_TelemedAvailableValuesBounds ( control,
output )
Value:
{ \
Usgfw2Lib::IUsgValues *usgValues; \
HRESULT hr = control->get_Values(&usgValues); \
if (FAILED(hr)) { mitkThrow() << "Values couldn't be read from Teleme API (" << hr << ")."; } \
\
LONG usgValuesNum; \
hr = usgValues->get_Count(&usgValuesNum); \
if (usgValuesNum < 1 || FAILED(hr)) { mitkThrow() << "No values could be read from Telemed API."; } \
\
VARIANT item; \
\
item = usgValues->Item(0); \
output[0] = static_cast<double>(item.lVal); \
VariantClear(&item); \
\
item = usgValues->Item(usgValuesNum-1); \
output[1] = static_cast<double>(item.lVal); \
VariantClear(&item); \
\
output[2] = (output[1] - output[0]) / usgValuesNum; \
}

Get all available values for given COM object, calculate minimum, maximum and interval step from them and save this three in given "output" variable. This variable must be a c array with three elements.

Definition at line 83 of file mitkUSTelemedSDKHeader.h.

◆ RETURN_TelemedAvailableValues

#define RETURN_TelemedAvailableValues ( control)
Value:
{ \
RETURN_TelemedAvailableValuesWithFactor(control, 1); \
}

Get all available values for given COM object and return them as std::vector<double>.

Definition at line 52 of file mitkUSTelemedSDKHeader.h.

◆ RETURN_TelemedAvailableValuesWithFactor

#define RETURN_TelemedAvailableValuesWithFactor ( control,
factor )
Value:
{ \
Usgfw2Lib::IUsgValues *usgValues; \
HRESULT hr = control->get_Values(&usgValues); \
\
LONG usgValuesNum; \
hr = usgValues->get_Count(&usgValuesNum); \
\
std::vector<double> values(usgValuesNum, 0); \
\
VARIANT item; \
for (int n = 0; n < usgValuesNum; n++) \
{ \
item = usgValues->Item(n); \
values.at(n) = static_cast<double>(item.lVal) / factor; \
VariantClear(&item); \
} \
\
SAFE_RELEASE(usgValues); \
return values; \
}

Definition at line 56 of file mitkUSTelemedSDKHeader.h.

◆ RETURN_TelemedValue

#define RETURN_TelemedValue ( control)
Value:
{ \
LONG value; \
HRESULT hr = control->get_Current(&value); \
if (FAILED(hr)) { mitkThrow() << "Could not get telemed value " << control << "(" << hr << ")."; }; \
return static_cast<double>(value); \
}

Get the current value from the given COM object and return it as double.

Definition at line 33 of file mitkUSTelemedSDKHeader.h.

◆ SAFE_RELEASE

#define SAFE_RELEASE ( x)
Value:
{ if (x) x->Release(); x = nullptr; }

Release the given COM object pointer and set the pointer to null.

Definition at line 28 of file mitkUSTelemedSDKHeader.h.

◆ SET_TelemedValue

#define SET_TelemedValue ( control,
value )
Value:
{ \
HRESULT hr = control->put_Current(static_cast<LONG>(value)); \
if (FAILED(hr)) { mitkThrow() << "Could not set telemed value " << value << " to " << control << "(" << hr << ")."; }; \
}

Cast the value to LONG and set it at the given COM object.

Definition at line 43 of file mitkUSTelemedSDKHeader.h.