sksurgerycore.algorithms.tracking_smoothing module

Classes and functions for smoothing tracking data

class sksurgerycore.algorithms.tracking_smoothing.RollingMean(vector_size=3, buffer_size=1, datatype=<class 'float'>)[source]

Bases: object

Performs rolling average calculations on numpy arrays

getmean()[source]

Returns the mean vector across the buffer, ignoring NaNs

pop(vector)[source]

Adds a new vector to the buffer, removing the oldest one.

Params vector:A new vector to place at the start of the buffer.
class sksurgerycore.algorithms.tracking_smoothing.RollingMeanRotation(buffer_size=1)[source]

Bases: sksurgerycore.algorithms.tracking_smoothing.RollingMean

Performs rolling average calculations on rotation vectors

getmean()[source]

Returns the mean quaternion across the buffer, ignoring NaNs

pop(rvector, is_quaternion=False)[source]

Adds a new vector to the buffer, removing the oldest one.

Params vector:A new rotation vector to place at the start of the buffer.
Params is_quaternion:
 if true treat the rvector as a quaternion
sksurgerycore.algorithms.tracking_smoothing.quaternion_to_matrix(quat)[source]

Convert a quaternion to a rotation vector

Params quat:the quaternion (1x4)
Returns:the rotation matrix (4x4)