9 #include "PlusConfigure.h" 10 #include "vtkCallbackCommand.h" 11 #include "vtkCommand.h" 12 #include "vtkImageData.h" 13 #include "vtkImageViewer2.h" 15 #include "vtkRenderWindowInteractor.h" 16 #include "vtkRenderer.h" 17 #include "vtkSmartPointer.h" 19 #include "vtksys/CommandLineArguments.hxx" 21 void PrintLogsCallback(vtkObject* obj,
unsigned long eid,
void* clientdata,
void* calldata);
23 class vtkMyCallback :
public vtkCommand
26 static vtkMyCallback *New()
27 {
return new vtkMyCallback;}
28 virtual void Execute(vtkObject *caller,
unsigned long,
void*)
33 iren->CreateTimer(VTKI_TIMER_UPDATE);
36 vtkRenderWindowInteractor *
iren;
45 int main(
int argc,
char **argv)
47 bool printHelp(
false);
49 vtksys::CommandLineArguments args;
50 args.Initialize(argc, argv);
52 int verboseLevel = vtkPlusLogger::LOG_LEVEL_UNDEFINED;
54 args.AddArgument(
"--help", vtksys::CommandLineArguments::NO_ARGUMENT, &printHelp,
"Print this help.");
55 args.AddArgument(
"--verbose", vtksys::CommandLineArguments::EQUAL_ARGUMENT, &verboseLevel,
"Verbose level (1=error only, 2=warning, 3=info, 4=debug, 5=trace)");
59 std::cerr <<
"Problem parsing arguments" << std::endl;
60 std::cout <<
"\n\nvtkInfraredTEEV2CamTest help:" << args.GetHelp() << std::endl;
68 std::cout <<
"\n\nvtkInfraredTEEV2CamTest help:" << args.GetHelp() << std::endl;
72 vtkSmartPointer<vtkPlusInfraredTEEV2Cam> infraredTEEV2Cam = vtkSmartPointer<vtkPlusInfraredTEEV2Cam>::New();
74 infraredTEEV2Cam->CreateDefaultOutputChannel();
77 vtkSmartPointer<vtkCallbackCommand> callbackCommand = vtkSmartPointer<vtkCallbackCommand>::New();
79 infraredTEEV2Cam->AddObserver(
"WarningEvent", callbackCommand);
80 infraredTEEV2Cam->AddObserver(
"ErrorEvent", callbackCommand);
82 LOG_INFO(
"Initialize...");
83 infraredTEEV2Cam->Connect();
85 if ( infraredTEEV2Cam->GetConnected() )
87 LOG_INFO(
"Start recording...");
88 infraredTEEV2Cam->StartRecording();
92 infraredTEEV2Cam->Disconnect();
93 LOG_ERROR(
"Unable to connect to Thermal Expert EV2 device");
97 LOG_INFO(
"Stop recording...");
98 infraredTEEV2Cam->StopRecording();
99 infraredTEEV2Cam->Disconnect();
100 LOG_INFO(
"Exit successfully");
108 if ( eid == vtkCommand::GetEventIdFromString(
"WarningEvent") )
110 LOG_WARNING((
const char*)calldata);
112 else if ( eid == vtkCommand::GetEventIdFromString(
"ErrorEvent") )
114 LOG_ERROR((
const char*)calldata);
vtkRenderWindowInteractor * iren
void PrintLogsCallback(vtkObject *obj, unsigned long eid, void *clientdata, void *calldata)
int main(int argc, char **argv)
static vtkIGSIOLogger * Instance()