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)
48 bool printHelp(
false);
50 vtksys::CommandLineArguments args;
51 args.Initialize(argc, argv);
53 int verboseLevel = vtkPlusLogger::LOG_LEVEL_UNDEFINED;
55 args.AddArgument(
"--help", vtksys::CommandLineArguments::NO_ARGUMENT, &printHelp,
"Print this help.");
56 args.AddArgument(
"--verbose", vtksys::CommandLineArguments::EQUAL_ARGUMENT, &verboseLevel,
"Verbose level (1=error only, 2=warning, 3=info, 4=debug, 5=trace)");
60 std::cerr <<
"Problem parsing arguments" << std::endl;
61 std::cout <<
"\n\nvtkInfraredSeekCamTest help:" << args.GetHelp() << std::endl;
69 std::cout <<
"\n\nvtkInfraredSeekCamTest help:" << args.GetHelp() << std::endl;
74 vtkSmartPointer<vtkInfraredSeekCam> infraredSeekCam = vtkSmartPointer<vtkInfraredSeekCam>::New();
76 infraredSeekCam->CreateDefaultOutputChannel();
79 vtkSmartPointer<vtkCallbackCommand> callbackCommand = vtkSmartPointer<vtkCallbackCommand>::New();
81 infraredSeekCam->AddObserver(
"WarningEvent", callbackCommand);
82 infraredSeekCam->AddObserver(
"ErrorEvent", callbackCommand);
84 LOG_INFO(
"Initialize...");
85 infraredSeekCam->Connect();
87 if ( infraredSeekCam->GetConnected() )
89 LOG_INFO(
"Start recording...");
90 infraredSeekCam->StartRecording();
94 infraredSeekCam->Disconnect();
95 LOG_ERROR(
"Unable to connect to IC capture device");
99 LOG_INFO(
"Stop recording...");
100 infraredSeekCam->StopRecording();
101 infraredSeekCam->Disconnect();
102 LOG_INFO(
"Exit successfully");
110 if ( eid == vtkCommand::GetEventIdFromString(
"WarningEvent") )
112 LOG_WARNING((
const char*)calldata);
114 else if ( eid == vtkCommand::GetEventIdFromString(
"ErrorEvent") )
116 LOG_ERROR((
const char*)calldata);
vtkRenderWindowInteractor * iren
int main(int argc, char **argv)
void PrintLogsCallback(vtkObject *obj, unsigned long eid, void *clientdata, void *calldata)
static vtkIGSIOLogger * Instance()