[vtkusers] SynchroGrab4D, vtk Polaris tracking

David Gobbi david.gobbi at gmail.com
Thu Jul 16 10:54:36 EDT 2015


Hi Luta,

For the vtkNDITracker, the ports start at index "0" and the first three
ports (0, 1, 2) are reserved for active tools.  So you need to load the
sroms into ports (3, 4, 5).

Here are some other comments:

1) In your code, your class is a subclass of vtkNDITracker, but it also has
a vtkNDITracker that is a member.  This is wrong, because it creates two
instances of vtkNDITracker ("this" and "nditracker" are both instances of
vtkNDITracker).  I suggest you do not subclass vtkNDITracker.

2) Instead of calling Command("INIT:"), call newtracker->StartTracking().
The StartTracking() method will do the initialization.

 - David



On Thu, Jul 16, 2015 at 12:58 AM, luta <sharmaatul11 at gmail.com> wrote:

> Hi David,
> Hope you must be doing great.
> I am working on an augmented reality project for medical application which
> involves surgical instruments tracking in 3D.
> For that we recently bought NDI polaris spectra and trying to use this with
> VTK.
> I downloaded your code for using NDI polaris from
> https://github.com/dgobbi/AIGS.
> I compiled it in visual studio 2010.
> Then I made a simple VTK project with CMake and included the headers and
> libraries from the compiled AIGS to the VTK project. The program is able to
> show me the version of NDI, however, I am not able to initialize and start
> tracking. I am sending you the code and the error what I get. Your help
> will
> be highly appreciated.
>
> #include <vtkConeSource.h>
> #include <vtkPolyData.h>
> #include <vtkSmartPointer.h>
> #include <vtkPolyDataMapper.h>
> #include <vtkActor.h>
> #include <vtkRenderWindow.h>
> #include <vtkRenderer.h>
> #include <vtkRenderWindowInteractor.h>
> #include "vtkNDITracker.h"
> #include <string>
> #include "ndicapi.h"
> using namespace std;
>
>
> class Starttracker_aks:public  vtkNDITracker {
>
> vtkNDITracker* newtracker;
> int x;
> int tool;
> const char *filename;
>
> int tool1;
> const char *filename1;
>
> int tool2;
> const char *filename2;
>
> int beepn;
>
> public:
>         void asignvalues(){
>         newtracker
> =  vtkNDITracker::New();
> tool=1;tool1=2;tool2=3;
> filename=
> "C:\\ATUL_WORKS\\SOFTWARES\\vtkptog\\Cone\\Cone_Aks\\ToolKit\\8700338.rom";
> filename1=
> "C:\\ATUL_WORKS\\SOFTWARES\\vtkptog\\Cone\\Cone_Aks\\ToolKit\\8700339.rom";
> filename2=
> "C:\\ATUL_WORKS\\SOFTWARES\\vtkptog\\Cone\\Cone_Aks\\ToolKit\\8700449.rom";
> string versionname;
> int serialname;
> newtracker->SetSerialDevice("COM5:");
> newtracker->LoadVirtualSROM(tool,filename);
> newtracker->LoadVirtualSROM(tool1,filename1);
> newtracker->LoadVirtualSROM(tool2,filename2);
> newtracker->Probe();
> Command("INIT:");
> versionname=newtracker->GetVersion();
>
> cout << newtracker->GetVersion();
>
>  int t1= GetToolFromHandle(tool);
>  int t2= GetToolFromHandle(tool1);
>  int t3= GetToolFromHandle(tool2);
>  cout << "\n Tools active:\t" << t1 << "\t" << t2 << "\t" << t3 <<"\n";
>
> }
> };
> int main(int, char *[])
> {
>         Starttracker_aks statr;
>         statr.asignvalues();
>         return EXIT_SUCCESS;
> }
>
> <http://vtk.1045678.n5.nabble.com/file/n5732927/Console.jpg>
> <http://vtk.1045678.n5.nabble.com/file/n5732927/Error.jpg>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150716/8aca55cc/attachment.html>


More information about the vtkusers mailing list