def update_position():
    m.update_single_frame()

    if m.get_frame_markers():



        update_time=time.time()
        try:
            w.setWindowTitle('markers. Update Rate: {0} fps'.format(1./(update_time-last_time)))
        except ZeroDivisionError:
            pass
        global last_time
        last_time=update_time
        sp3 = gl.GLScatterPlotItem(m.get_frame_markers(), color=(1.0, 0.0, 0.0, 0.5), size=0.1, pxMode=False)
Example #2
0
def create_record_object():
    """Returns a data aquisition object consisting of the marker positions of one frame"""
    acq = btk.btkAcquisition()
    btk.btkAcquisition.Reset(acq)
    btk.btkAcquisition.Init(acq, len(m.get_frame_markers()), 1)

    return acq
Example #3
0
def create_record_object():
    """Returns a data aquisition object consisting of the marker positions of one frame"""
    acq=btk.btkAcquisition()
    btk.btkAcquisition.Reset(acq)
    btk.btkAcquisition.Init(acq,len(m.get_frame_markers()),1)

    return acq
Example #4
0
def record_frames_markers(acq):
    """Writes the marker positions of one frame to an existing acquisition object
    and returns the updated acquisition object.

    Args:
        acq: Data acquisition object

    Returns:
        Data acquisition object
    """
    frames=acq.GetPointFrameNumber()
    markers=m.get_frame_markers()
    record_points=acq.GetPoints()

    if record_points.GetItemNumber()<len(markers):
        btk.btkAcquisition.ResizePointNumber(acq, len(markers))

    for i in xrange(len(markers)):
        point=acq.GetPoint(i)
        point.SetDataSlice(frames-1, *[1000*x for x in markers[i]])
    btk.btkAcquisition.ResizeFrameNumber(acq, frames+1)   #always one frame more than needed

    return acq
Example #5
0
def record_frames_markers(acq):
    """Writes the marker positions of one frame to an existing acquisition object
    and returns the updated acquisition object.

    Args:
        acq: Data acquisition object

    Returns:
        Data acquisition object
    """
    frames = acq.GetPointFrameNumber()
    markers = m.get_frame_markers()
    record_points = acq.GetPoints()

    if record_points.GetItemNumber() < len(markers):
        btk.btkAcquisition.ResizePointNumber(acq, len(markers))

    for i in xrange(len(markers)):
        point = acq.GetPoint(i)
        point.SetDataSlice(frames - 1, *[1000 * x for x in markers[i]])
    btk.btkAcquisition.ResizeFrameNumber(acq, frames +
                                         1)  #always one frame more than needed

    return acq