diff --git a/sksurgerybard/visualisation/bard_visualisation.py b/sksurgerybard/visualisation/bard_visualisation.py index b4f8dce..f1ba344 100644 --- a/sksurgerybard/visualisation/bard_visualisation.py +++ b/sksurgerybard/visualisation/bard_visualisation.py @@ -250,11 +250,11 @@ def luminance_change_left(self, y_pos): return actor_index = len(self._target_anatomy_actors) - 2 if actor_index >= 0: - target_colour = get_green(y_pos) + luminance, target_colour = get_green(y_pos) self._target_anatomy_actors[ actor_index].GetProperty().SetColor(target_colour) print(f"Changing luminance for actor {actor_index} to ", - f"{target_colour}") + f"{luminance}, RGB={target_colour}", flush=True) def luminance_change_right(self, y_pos): """ @@ -265,11 +265,11 @@ def luminance_change_right(self, y_pos): if len(self._target_anatomy_actors) < 1: return actor_index = len(self._target_anatomy_actors) - 1 - target_colour = get_yellow(y_pos) + luminance, target_colour = get_yellow(y_pos) self._target_anatomy_actors[ actor_index].GetProperty().SetColor(target_colour) print(f"Changing luminance for actor {actor_index} to ", - f"{target_colour}") + f"{luminance}, RGB={target_colour}", flush=True) def next_target(self): """ diff --git a/sksurgerybard/visualisation/colours.py b/sksurgerybard/visualisation/colours.py index 0bb7d38..07ec366 100644 --- a/sksurgerybard/visualisation/colours.py +++ b/sksurgerybard/visualisation/colours.py @@ -77,8 +77,10 @@ def integer_colour_to_float(colour): def get_green(y_pos): """Gets a green shade with luminace set by y_pos""" - return integer_colour_to_float(green.get(y_pos_to_luminance(y_pos))) + luminance = y_pos_to_luminance(y_pos) + return luminance, integer_colour_to_float(green.get(luminance)) def get_yellow(y_pos): """Gets a yellow shade with luminace set by y_pos""" - return integer_colour_to_float(yellow.get(y_pos_to_luminance(y_pos))) + luminance = y_pos_to_luminance(y_pos) + return luminance, integer_colour_to_float(yellow.get(luminance)) diff --git a/tests/visualisation/test_colours.py b/tests/visualisation/test_colours.py index 24ef470..e2b07d2 100644 --- a/tests/visualisation/test_colours.py +++ b/tests/visualisation/test_colours.py @@ -27,8 +27,8 @@ def test_integer_colour_to_float(): def test_get_yellow(): """Checks that get yellow returns the right value""" - assert cls.get_yellow(1.0) == [1.0, 1.0, 1.0] + assert cls.get_yellow(1.0)[1] == [1.0, 1.0, 1.0] def test_get_green(): """Checks that get green returns the right value""" - assert cls.get_green(1.0) == [1.0, 1.0, 1.0] + assert cls.get_green(1.0)[1] == [1.0, 1.0, 1.0]