PlusLib  2.9.0
Software library for tracked ultrasound image acquisition, calibration, and processing.
vtkIntelRealSenseTrackerTest.cxx
Go to the documentation of this file.
1 /*=Plus=header=begin======================================================
2 Program: Plus
3 Copyright (c) Laboratory for Percutaneous Surgery. All rights reserved.
4 See License.txt for details.
5 =========================================================Plus=header=end*/
6 
7 #include "PlusConfigure.h"
8 #include "vtksys/CommandLineArguments.hxx"
10 #include "vtkImageData.h"
11 #include "vtkImageViewer2.h"
12 #include "vtkRenderWindowInteractor.h"
13 #include "vtkRenderer.h"
14 #include "vtkSmartPointer.h"
15 #include "vtkCommand.h"
16 #include "vtkCallbackCommand.h"
17 
18 //void PrintLogsCallback(vtkObject* obj, unsigned long eid, void* clientdata, void* calldata);
19 //
20 //class vtkMyCallback : public vtkCommand
21 //{
22 //public:
23 // static vtkMyCallback *New()
24 // {return new vtkMyCallback;}
25 // virtual void Execute(vtkObject *caller, unsigned long, void*)
26 // {
27 // frameGrabber->GetImage(leftImage,NULL);
28 // viewer->SetInputData(leftImage);
29 // viewer->Render();
30 //
31 // update the timer so it will trigger again
32 // iren->CreateTimer(VTKI_TIMER_UPDATE);
33 // }
34 // vtkImageViewer2 *viewer;
35 // vtkRenderWindowInteractor *iren;
36 // vtkPlusIntelRealSenseTracker *frameGrabber;
37 // vtkImageData *leftImage;
38 //protected:
39 // vtkMyCallback()
40 // {
41 // viewer = NULL;
42 // iren = NULL;
43 // }
44 //};
45 
46 int main(int argc, char **argv)
47 {
48  //std::string serialNumber;
49  //double frameRate=20;
50  //bool printHelp(false);
51  //bool renderingOff(false);
52 
53  //vtksys::CommandLineArguments args;
54  //args.Initialize(argc, argv);
55 
56  //int verboseLevel = vtkPlusLogger::LOG_LEVEL_UNDEFINED;
57 
59  //args.AddArgument("--frame-rate", vtksys::CommandLineArguments::EQUAL_ARGUMENT, &frameRate, "Requested acquisition frame rate (in FPS, default = 30)");
60  //args.AddArgument("--help", vtksys::CommandLineArguments::NO_ARGUMENT, &printHelp, "Print this help.");
61  //args.AddArgument("--rendering-off", vtksys::CommandLineArguments::NO_ARGUMENT, &renderingOff, "Run test without rendering.");
62  //args.AddArgument("--verbose", vtksys::CommandLineArguments::EQUAL_ARGUMENT, &verboseLevel, "Verbose level (1=error only, 2=warning, 3=info, 4=debug, 5=trace)");
63 
64  //if ( !args.Parse() )
65  //{
66  // std::cerr << "Problem parsing arguments" << std::endl;
67  // std::cout << "\n\nvtkPlusEpiphanVideoSourceTest help:" << args.GetHelp() << std::endl;
68  // exit(EXIT_FAILURE);
69  //}
70 
71  //vtkPlusLogger::Instance()->SetLogLevel(verboseLevel);
72 
73  //if ( printHelp )
74  //{
75  // std::cout << "\n\nvtkPlusIntelRealSenseTrackerTest help:" << args.GetHelp() << std::endl;
76  // exit(EXIT_SUCCESS);
77  //}
78 
79  //vtkSmartPointer<vtkPlusIntelRealSenseTracker> frameGrabber = vtkSmartPointer<vtkPlusIntelRealSenseTracker>::New();
80 
81  //frameGrabber->SetAcquisitionRate(frameRate);
82 
83  //LOG_INFO("Initialize...");
84 
85  //if ( frameGrabber->Connect()!=PLUS_SUCCESS )
86  //{
87  // LOG_ERROR( "Unable to connect to device");
88  // exit(EXIT_FAILURE);
89  //}
90 
91  //LOG_INFO("Start recording...");
92  //if ( frameGrabber->StartRecording()!=PLUS_SUCCESS )
93  //{
94  // LOG_ERROR( "Unable to connect to device");
95  // exit(EXIT_FAILURE);
96  //}
97 
98  //if (renderingOff)
99  //{
100  // LOG_INFO("No need for rendering, stop the device...");
101  // frameGrabber->StopRecording();
102  // frameGrabber->Disconnect();
103  // LOG_INFO("Exit successfully");
104  // exit(EXIT_SUCCESS);
105  //}
106 
107  //vtkSmartPointer<vtkImageViewer2> viewer = vtkSmartPointer<vtkImageViewer2>::New();
108 
109  //viewer->SetColorWindow(255);
110  //viewer->SetColorLevel(100.5);
111  //viewer->SetSize(1024,768);
112 
113  //vtkSmartPointer<vtkImageData> leftImage=vtkSmartPointer<vtkImageData>::New();
114  //frameGrabber->GetImage(leftImage,NULL);
115  //viewer->SetInputData(leftImage);
116 
118  //vtkSmartPointer<vtkRenderWindowInteractor> iren = vtkSmartPointer<vtkRenderWindowInteractor>::New();
119  //iren->SetRenderWindow(viewer->GetRenderWindow());
120  //viewer->SetupInteractor(iren);
121 
122  //viewer->Render();
123 
125  //vtkSmartPointer<vtkMyCallback> call = vtkSmartPointer<vtkMyCallback>::New();
126  //call->iren=iren;
127  //call->viewer=viewer;
128  //call->frameGrabber=frameGrabber;
129  //call->leftImage=leftImage;
130  //iren->AddObserver(vtkCommand::TimerEvent, call);
131  //iren->CreateTimer(VTKI_TIMER_FIRST); //VTKI_TIMER_FIRST = 0
132 
134  //iren->Initialize();
135  //iren->Start();
136 
137  //LOG_INFO("Exit successfully");
138  return EXIT_SUCCESS;
139 
140 }
int main(int argc, char **argv)