12 #include "PlusConfigure.h" 13 #include "vtkCommand.h" 15 #include "vtkMatrix4x4.h" 19 #include "vtkSmartPointer.h" 21 #include "vtkXMLUtilities.h" 22 #include "vtksys/CommandLineArguments.hxx" 23 #include "vtksys/SystemTools.hxx" 25 int main(
int argc,
char** argv)
27 bool printHelp(
false);
28 std::string inputConfigFileName =
"USDigitalEncodersTracker.xml";
29 std::string inputToolSourceId;
30 double inputAcqTimeLength(60);
31 std::string outputTrackerBufferSequenceFileName;
32 bool renderingOff(
false);
34 int verboseLevel = vtkPlusLogger::LOG_LEVEL_UNDEFINED;
36 vtksys::CommandLineArguments args;
37 args.Initialize(argc, argv);
39 args.AddArgument(
"--help", vtksys::CommandLineArguments::NO_ARGUMENT, &printHelp,
"Print this help.");
40 args.AddArgument(
"--config-file", vtksys::CommandLineArguments::EQUAL_ARGUMENT, &inputConfigFileName,
"Name of the input configuration file.");
41 args.AddArgument(
"--tool-name", vtksys::CommandLineArguments::EQUAL_ARGUMENT, &inputToolSourceId,
"Will print the actual transform of this tool (names were defined in the config file, default is the first active tool)");
42 args.AddArgument(
"--acq-time-length", vtksys::CommandLineArguments::EQUAL_ARGUMENT, &inputAcqTimeLength,
"Length of acquisition time in seconds (Default: 60s)");
43 args.AddArgument(
"--output-tracker-buffer-seq-file-name", vtksys::CommandLineArguments::EQUAL_ARGUMENT, &outputTrackerBufferSequenceFileName,
"Filename of the output tracker bufffer sequence metafile (Default: TrackerBufferMetafile)");
44 args.AddArgument(
"--rendering-off", vtksys::CommandLineArguments::NO_ARGUMENT, &renderingOff,
"Run test without rendering.");
45 args.AddArgument(
"--verbose", vtksys::CommandLineArguments::EQUAL_ARGUMENT, &verboseLevel,
"Verbose level (1=error only, 2=warning, 3=info, 4=debug, 5=trace)");
49 std::cerr <<
"Problem parsing arguments" << std::endl;
50 std::cout <<
"Help: " << args.GetHelp() << std::endl;
56 std::cout << args.GetHelp() << std::endl;
62 if(inputConfigFileName.empty())
64 std::cerr <<
"--config-file is required" << std::endl;
70 vtkSmartPointer< vtkPlusUSDigitalEncodersTracker > usDigitalEncodersTracker =
71 vtkSmartPointer< vtkPlusUSDigitalEncodersTracker >::New();
73 vtkSmartPointer<vtkXMLDataElement> configRootElement = vtkSmartPointer<vtkXMLDataElement>::New();
76 LOG_ERROR(
"Unable to read configuration from file " << inputConfigFileName.c_str());
80 usDigitalEncodersTracker->ReadConfiguration(configRootElement);
84 LOG_ERROR(
"Unable to connect to US Digital encoders!");
88 usDigitalEncodersTracker->StartRecording();
91 std::string inputMessage;
94 std::getline(std::cin, inputMessage);
95 std::cout <<
" Input :: " << inputMessage << std::endl;
96 if(inputMessage.find(
"quit") != std::string::npos)
103 usDigitalEncodersTracker->StopRecording();
104 usDigitalEncodersTracker->Disconnect();
106 std::cout <<
"Test completed successfully!" << std::endl;
static vtkIGSIOLogger * Instance()
int main(int argc, char **argv)
static PlusStatus ReadDeviceSetConfigurationFromFile(vtkXMLDataElement *config, const char *filename)