NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
niftk::NDICAPITracker Class Reference

Interface class for Northern Digital's tracking devices. More...

Classes

struct  NdiToolDescriptor
 

Public Types

enum  PlusStatus { PLUS_FAIL =0, PLUS_SUCCESS =1 }
 
enum  LedState { TR_LED_OFF = 0, TR_LED_ON = 1, TR_LED_FLASH = 2 }
 
typedef std::map< std::string,
NdiToolDescriptor
NdiToolDescriptorsType
 

Public Member Functions

 NDICAPITracker ()
 
 ~NDICAPITracker ()
 
virtual bool IsTracker () const
 
virtual std::string GetSdkVersion ()
 
PlusStatus Probe ()
 
char * Command (const char *command)
 
char * GetVersion () const
 
void SetSerialPort (int i)
 
int GetSerialPort () const
 
void SetBaudRate (int i)
 
int GetBaudRate () const
 
void SetMeasurementVolumeNumber (int i)
 
int GetMeasurementVolumeNumber () const
 
PlusStatus InternalUpdate ()
 
std::map< std::string,
std::vector< double > > 
GetTrackerMatrices ()
 
PlusStatus SetToolLED (const char *portName, int led, LedState state)
 
void SetVersion (const char *v)
 
PlusStatus InternalConnect ()
 
PlusStatus InternalDisconnect ()
 
PlusStatus InternalStartRecording ()
 
PlusStatus InternalStopRecording ()
 
PlusStatus Beep (int n)
 
PlusStatus ReadSromFromFile (NdiToolDescriptor &toolDescriptor, const char *filename)
 
PlusStatus UpdatePortHandle (NdiToolDescriptor &toolDescriptor)
 
PlusStatus SendSromToTracker (const NdiToolDescriptor &toolDescriptor)
 
PlusStatus ClearVirtualSromInTracker (NdiToolDescriptor &toolDescriptor)
 
PlusStatus EnableToolPorts ()
 
void DisableToolPorts ()
 
void LogVolumeList (const char *ndiVolumeListCommandReply, int selectedVolume)
 

Public Attributes

unsigned long LastFrameNumber
 
ndicapiDevice
 
char * Version
 
char * SerialDevice
 
int SerialPort
 
int BaudRate
 
int IsDeviceTracking
 
int MeasurementVolumeNumber
 
NdiToolDescriptorsType NdiToolDescriptors
 
char CommandReply [VTK_NDI_REPLY_LEN]
 

Detailed Description

Interface class for Northern Digital's tracking devices.

The NDICAPITracker class provides an interface to the AURORA and POLARIS (Northern Digital Inc., Waterloo, Canada) using the new "combined API" and should also support all newer NDI tracking devices. Any POLARIS systems purchased before 2002 will not support the combined API.

For active (wired) tools specify PortName attribute. For example, PortName="0" is the first port, PortName="1" is the second, etc.

If multi-channel tools are used then the PortName is <ChannelNumber><PortNumber>, for example for two 5-DOF sensors plugged into the first connector: PortName="0" and PortName="100", for two 5-DOF sensors plugged into the second connector: PortName="1" and PortName="101".

For passive (wireless) tools specify RomFile attribute. For example, RomFile="NdiToolDefinitions/8700339.rom".

Important notes on the data collection rate of the Polaris:

The camera frame rate is 60Hz, and therefore the maximum data collection rate is also 60Hz. The maximum data transfer rate to the computer is also 60Hz.

Depending on the number of enabled tools, the data collection rate might be reduced. Each of the active tools requires one camera frame, and all the passive tools (if any are enabled) collectively require one camera frame.

Therefore if there are two enabled active tools, the data rate is reduced to 30Hz. Ditto for an active tool and a passive tool. If all tools are passive, the data rate is 60Hz. With 3 active tools and one or more passive tools, the data rate is 15Hz. With 3 active tools, or 2 active and one or more passive tools, the data rate is 20Hz.

The data transfer rate to the computer is independent of the data collection rate, and there might be duplicated records. The data tranfer rate is limited by the speed of the serial port and by the number of characters sent per data record. If tools are marked as 'missing' then the number of characters that are sent will be reduced.

Member Typedef Documentation

Member Enumeration Documentation

Flags for tool LEDs

Enumerator
TR_LED_OFF 
TR_LED_ON 
TR_LED_FLASH 
Enumerator
PLUS_FAIL 
PLUS_SUCCESS 

Constructor & Destructor Documentation

niftk::NDICAPITracker::NDICAPITracker ( )
niftk::NDICAPITracker::~NDICAPITracker ( )

Member Function Documentation

NDICAPITracker::PlusStatus niftk::NDICAPITracker::Beep ( int  n)

Cause the device to beep the specified number of times

NDICAPITracker::PlusStatus niftk::NDICAPITracker::ClearVirtualSromInTracker ( NdiToolDescriptor toolDescriptor)

This is a low-level method for loading a virtual SROM. You must halt the tracking thread and take the device out of tracking mode before you use it.

char * niftk::NDICAPITracker::Command ( const char *  command)

Send a command to the NDI in the format INIT: or VER:0 (the command should include a colon). Commands can only be done after either Probe() or StartTracking() has been called. The text reply from the NDI is returned, without the CRC or final carriage return.

void niftk::NDICAPITracker::DisableToolPorts ( )

Methods for detecting which ports have tools in them, and auto-enabling those tools.

NDICAPITracker::PlusStatus niftk::NDICAPITracker::EnableToolPorts ( )

Methods for detecting which ports have tools in them, and auto-enabling those tools.

int niftk::NDICAPITracker::GetBaudRate ( ) const
inline
int niftk::NDICAPITracker::GetMeasurementVolumeNumber ( ) const
inline
std::string niftk::NDICAPITracker::GetSdkVersion ( )
virtual

Hardware device SDK version.

int niftk::NDICAPITracker::GetSerialPort ( ) const
inline
std::map< std::string, std::vector< double > > niftk::NDICAPITracker::GetTrackerMatrices ( )
char* niftk::NDICAPITracker::GetVersion ( ) const
inline

Get the a string (perhaps a long one) describing the type and version of the device.

NDICAPITracker::PlusStatus niftk::NDICAPITracker::InternalConnect ( )

Connect to the tracker hardware

NDICAPITracker::PlusStatus niftk::NDICAPITracker::InternalDisconnect ( )

Disconnect from the tracker hardware

NDICAPITracker::PlusStatus niftk::NDICAPITracker::InternalStartRecording ( )

Start the tracking system. The tracking system is brought from its ground state into full tracking mode. The device will only be reset if communication cannot be established without a reset.

NDICAPITracker::PlusStatus niftk::NDICAPITracker::InternalStopRecording ( )

Stop the tracking system and bring it back to its ground state: Initialized, not tracking, at 9600 Baud.

NDICAPITracker::PlusStatus niftk::NDICAPITracker::InternalUpdate ( )

Get an update from the tracking system and push the new transforms to the tools. This should only be used within vtkTracker.cxx.

virtual bool niftk::NDICAPITracker::IsTracker ( ) const
inlinevirtual
void niftk::NDICAPITracker::LogVolumeList ( const char *  ndiVolumeListCommandReply,
int  selectedVolume 
)

Parse and log available volume list response

NDICAPITracker::PlusStatus niftk::NDICAPITracker::Probe ( )

Probe to see if the tracking system is present on the specified serial port. If the SerialPort is set to -1, then all serial ports will be checked.

NDICAPITracker::PlusStatus niftk::NDICAPITracker::ReadSromFromFile ( NdiToolDescriptor toolDescriptor,
const char *  filename 
)

Read a virtual SROM from file and store it in the tool descriptor

NDICAPITracker::PlusStatus niftk::NDICAPITracker::SendSromToTracker ( const NdiToolDescriptor toolDescriptor)

This is a low-level method for loading a virtual SROM. You must halt the tracking thread and take the device out of tracking mode before you use it. This call also sets the port handle in the descriptor.

void niftk::NDICAPITracker::SetBaudRate ( int  i)
inline

Set the desired baud rate. Default: 9600.

void niftk::NDICAPITracker::SetMeasurementVolumeNumber ( int  i)
inline

Measurement volume number. It can be used for defining volume type (dome, cube) and size. Default is 0, which means that the default volume is used. First valid volume number is 1. If an invalid value is set (for example -1) then a list of available volumes is logged. See VSEL command in the NDI API documentation for details.

void niftk::NDICAPITracker::SetSerialPort ( int  i)
inline

Set which serial port to use, 1 through 4

NDICAPITracker::PlusStatus niftk::NDICAPITracker::SetToolLED ( const char *  portName,
int  led,
LedState  state 
)

Read NDI tracker configuration from xml data

Read NDI tracker configuration from xml data

Set the specified tool LED to the specified state

void niftk::NDICAPITracker::SetVersion ( const char *  v)
inline

Set the version information

NDICAPITracker::PlusStatus niftk::NDICAPITracker::UpdatePortHandle ( NdiToolDescriptor toolDescriptor)

Sets the port handle in the descriptor. For wired tools it iterates through the existing connections, for wireless tools it requests a new handle.

Member Data Documentation

int niftk::NDICAPITracker::BaudRate
char niftk::NDICAPITracker::CommandReply[VTK_NDI_REPLY_LEN]
ndicapi* niftk::NDICAPITracker::Device
int niftk::NDICAPITracker::IsDeviceTracking
unsigned long niftk::NDICAPITracker::LastFrameNumber

Index of the last frame number. This is used for providing a frame number when the tracker doesn't return any transform

int niftk::NDICAPITracker::MeasurementVolumeNumber
NdiToolDescriptorsType niftk::NDICAPITracker::NdiToolDescriptors

Maps Plus tool source IDs to NDI tool descriptors

char* niftk::NDICAPITracker::SerialDevice
int niftk::NDICAPITracker::SerialPort
char* niftk::NDICAPITracker::Version

The documentation for this class was generated from the following files: