7 #include "PlusConfigure.h" 8 #include "vtkCallbackCommand.h" 9 #include "vtkCommand.h" 10 #include "vtkImageData.h" 11 #include "vtkImageViewer.h" 14 #include "vtkRenderWindowInteractor.h" 15 #include "vtkSmartPointer.h" 17 #include "vtkXMLUtilities.h" 18 #include "vtksys/CommandLineArguments.hxx" 23 vtkRenderWindowInteractor *
iren = NULL;
25 class vtkMyCallback :
public vtkCommand
28 static vtkMyCallback *New()
29 {
return new vtkMyCallback;}
30 virtual void Execute(vtkObject *caller,
unsigned long,
void*)
36 iren->CreateTimer(VTKI_TIMER_UPDATE);
40 int main(
int argc,
char* argv[])
43 bool printHelp(
false);
44 bool renderingOff(
false);
45 std::string inputConfigFileName;
46 std::string inputSonixIp;
48 vtksys::CommandLineArguments args;
49 args.Initialize(argc, argv);
51 int verboseLevel = vtkPlusLogger::LOG_LEVEL_INFO;
53 args.AddArgument(
"--help", vtksys::CommandLineArguments::NO_ARGUMENT, &printHelp,
"Print this help.");
54 args.AddArgument(
"--sonix-ip", vtksys::CommandLineArguments::EQUAL_ARGUMENT, &inputSonixIp,
"IP address of the Ultrasonix scanner (overrides the IP address parameter defined in the config file).");
55 args.AddArgument(
"--config-file", vtksys::CommandLineArguments::EQUAL_ARGUMENT, &inputConfigFileName,
"Config file containing the device configuration.");
56 args.AddArgument(
"--rendering-off", vtksys::CommandLineArguments::NO_ARGUMENT, &renderingOff,
"Run test without rendering.");
57 args.AddArgument(
"--verbose", vtksys::CommandLineArguments::EQUAL_ARGUMENT, &verboseLevel,
"Verbose level (Default: 1; 1=error only, 2=warning, 3=info, 4=debug)");
61 std::cerr <<
"Problem parsing arguments" << std::endl;
62 std::cout <<
"\n\nvtkPlusSonixVideoSourceTest1 help:" << args.GetHelp() << std::endl;
68 std::cout <<
"\n\nvtkPlusSonixVideoSourceTest1 help:" << args.GetHelp() << std::endl;
75 LOG_DEBUG(
"Reading config file...");
76 vtkSmartPointer<vtkXMLDataElement> configRootElement = vtkSmartPointer<vtkXMLDataElement>::New();
79 LOG_ERROR(
"Unable to read configuration from file " << inputConfigFileName.c_str());
82 LOG_DEBUG(
"Reading config file finished.");
85 sonixGrabber = vtkSmartPointer<vtkPlusSonixVideoSource>::New();
89 if (!inputSonixIp.empty())
120 LOG_ERROR(
"Unable to connect to Sonix RP machine at: " << inputSonixIp );
147 viewer = vtkImageViewer::New();
149 viewer->SetColorWindow(255);
150 viewer->SetColorLevel(127.5);
154 iren = vtkRenderWindowInteractor::New();
155 iren->SetRenderWindow(
viewer->GetRenderWindow());
162 vtkMyCallback* call = vtkMyCallback::New();
163 iren->AddObserver(vtkCommand::TimerEvent, call);
164 iren->CreateTimer(VTKI_TIMER_FIRST);
int main(int argc, char *argv[])
vtkRenderWindowInteractor * iren
vtkSmartPointer< vtkPlusSonixVideoSource > sonixGrabber
static vtkIGSIOLogger * Instance()
static PlusStatus ReadDeviceSetConfigurationFromFile(vtkXMLDataElement *config, const char *filename)