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\nvtkDAQVideoSourceTest help:" << args.GetHelp() << std::endl;
68 std::cout <<
"\n\nvtkDAQVideoSourceTest help:" << args.GetHelp() << std::endl;
72 vtkSmartPointer<vtkPlusDAQVideoSource> DAQVideoSource = vtkSmartPointer<vtkPlusDAQVideoSource>::New();
74 DAQVideoSource->CreateDefaultOutputChannel();
77 vtkSmartPointer<vtkCallbackCommand> callbackCommand = vtkSmartPointer<vtkCallbackCommand>::New();
79 DAQVideoSource->AddObserver(
"WarningEvent", callbackCommand);
80 DAQVideoSource->AddObserver(
"ErrorEvent", callbackCommand);
82 LOG_INFO(
"Initialize...");
83 DAQVideoSource->Connect();
85 if ( DAQVideoSource->GetConnected() )
87 LOG_INFO(
"Start recording...");
88 DAQVideoSource->StartRecording();
92 DAQVideoSource->Disconnect();
93 LOG_ERROR(
"Unable to connect to DAQ USB3-FRM13-B device");
97 LOG_INFO(
"Stop recording...");
98 DAQVideoSource->StopRecording();
99 DAQVideoSource->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);
int main(int argc, char **argv)
vtkRenderWindowInteractor * iren
void PrintLogsCallback(vtkObject *obj, unsigned long eid, void *clientdata, void *calldata)
static vtkIGSIOLogger * Instance()