From f76502316fcf9e5e47404dc446c14d28d81cd9f0 Mon Sep 17 00:00:00 2001 From: tfmoraes Date: Wed, 9 Sep 2009 15:09:10 +0000 Subject: [PATCH] ENH: Altering the ww e wl text in the volume viewer when a curve is selected in the clut raycasting widget --- invesalius/data/volume.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+), 0 deletions(-) diff --git a/invesalius/data/volume.py b/invesalius/data/volume.py index 022b48e..c8d213c 100755 --- a/invesalius/data/volume.py +++ b/invesalius/data/volume.py @@ -161,6 +161,12 @@ class Volume(): def OnSetCurve(self, pubsub_evt): self.curve = pubsub_evt.data + self.CalculateWWWL() + ww = self.ww + wl = self.wl + ps.Publisher().sendMessage('Set volume window and level text', + (ww, wl)) + ps.Publisher().sendMessage('Render volume viewer') def OnSetRelativeWindowLevel(self, pubsub_evt): diff_ww, diff_wl = pubsub_evt.data @@ -207,6 +213,16 @@ class Volume(): self.__update_colour_table() ps.Publisher().sendMessage('Render volume viewer') + def CalculateWWWL(self): + """ + Get the window width & level from the selected curve + """ + curve = self.config['16bitClutCurves'][self.curve] + first_point = curve[0]['x'] + last_point = curve[-1]['x'] + self.ww = last_point - first_point + self.wl = first_point + self.ww + def Refresh(self, pubsub_evt): self.__update_colour_table() -- libgit2 0.21.2