Commit 83f0a771 authored by Stephen Thompson's avatar Stephen Thompson

Issue #1 tidied up overlay.py

parent 0444db8a
Pipeline #3815 failed with stages
in 2 minutes and 19 seconds
......@@ -6,7 +6,7 @@ from sksurgeryutils.common_overlay_apps import OverlayBaseApp
from sksurgeryvtk.text.text_overlay import VTKCornerAnnotation
from sksurgeryeval.algorithms.algorithms import (
configure_tracker, populate_models, np2vtk, point_in_locator,
add_map)
add_map, random_targets)
from sksurgeryeval.algorithms.background_image import \
OverlayBackground
from sksurgeryeval.shapes.cone import VTKConeModel
......@@ -42,7 +42,7 @@ class OverlayApp(OverlayBaseApp):
self._pointer = VTKConeModel(10.0, 5.0, (1.0, 1.0, 1.0), "pointer")
self.vtk_overlay_window.add_vtk_actor(self._pointer.actor)
self.vtk_overlay_window.add_vtk_models(models)
self.vtk_overlay_window.add_vtk_models(self._models)
if maps is not None:
self.vtk_overlay_window.add_vtk_models(maps)
......@@ -61,10 +61,10 @@ class OverlayApp(OverlayBaseApp):
self._search_radius = config.get("search radius")
self._text = VTKCornerAnnotation()
self._text.set_text(["Hello World","","",""])
self._text.set_text(["Hello World", "", "", ""])
self.vtk_overlay_window.add_vtk_actor(self._text.text_actor)
self._targets = random_targets (len(self._locators))
self._targets = random_targets(len(self._locators))
self._target_index = 0
def update(self):
......@@ -85,18 +85,20 @@ class OverlayApp(OverlayBaseApp):
"""
port_handles, _, _, tracking, quality = self._tracker.get_frame()
for ph_index, port_handle in enumerate(port_handles):
if port_handle != self._tracker_handle:
continue
if not isnan(quality[ph_index]):
self._pointer.actor.SetUserMatrix(np2vtk(tracking[ph_index]))
index, distance = point_in_locator(tracking[ph_index][0:3,3], self._locators, self._search_radius)
# self._text.set_text([str(index),str(distance),str(tracking[ph_index][0:3,3]),""])
self._text.set_text([str(index),str(distance),str(tracking[ph_index]),""])
index, distance = point_in_locator(tracking[ph_index][0:3, 3],
self._locators,
self._search_radius)
self._text.set_text([str(index), str(distance),
str(tracking[ph_index]), ""])
if index == self._targets[self._target_index]:
print ("hit")
print("hit")
self._models[index].actor.SetVisibility(False)
self._target_index = self._target_index + 1
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment