scikit-surgerynditracker

NDI Tracking

Class implementing communication with NDI (Northern Digital) trackers

class sksurgerynditracker.nditracker.NDITracker(configuration)[source]

Bases: sksurgerycore.baseclasses.tracker.SKSBaseTracker

Class for communication with NDI trackers. Should support Polaris, Aurora, and Vega. Currently only tested with wireless tools on Vega

close()[source]

Closes the connection to the NDI Tracker and deletes the tracker device.

Raises:Exception – ValueError
get_frame()[source]

Gets a frame of tracking data from the NDI device.

Returns:port_numbers : list of port handles, one per tool

time_stamps : list of timestamps (cpu clock), one per tool

frame_numbers : list of framenumbers (tracker clock) one per tool

tracking : list of 4x4 tracking matrices, rotation and position, or if use_quaternions is true, a list of tracking quaternions, column 0-2 is x,y,z column 3-6 is the rotation as a quaternion.

tracking_quality : list the tracking quality, one per tool.

Note: The time stamp is based on the host computer clock. Read the following extract from NDI’s API Guide for advice on what to use: “Use the frame number, and not the host computer clock, to identify when data was collected. The frame number is incremented by 1 at a constant rate of 60 Hz. Associating a time from the host computer clock to replies from the system assumes that the duration of time between raw data collection and when the reply is received by the host computer is constant. This is not necessarily the case.”

get_tool_descriptions()[source]

Returns the port handles and tool descriptions

start_tracking()[source]

Tells the NDI devices to start tracking.

Raises:Exception – ValueError
stop_tracking()[source]

Tells the NDI devices to stop tracking.

Raises:Exception – ValueError
sksurgerynditracker.nditracker.int2byte()

S.pack(v1, v2, …) -> bytes

Return a bytes object containing values v1, v2, … packed according to the format string S.format. See help(struct) for more on format strings.