Commit f76502316fcf9e5e47404dc446c14d28d81cd9f0
1 parent
ae5620c9
Exists in
master
and in
68 other branches
ENH: Altering the ww e wl text in the volume viewer when a curve is selected in …
…the clut raycasting widget
Showing
1 changed file
with
16 additions
and
0 deletions
Show diff stats
invesalius/data/volume.py
@@ -161,6 +161,12 @@ class Volume(): | @@ -161,6 +161,12 @@ class Volume(): | ||
161 | 161 | ||
162 | def OnSetCurve(self, pubsub_evt): | 162 | def OnSetCurve(self, pubsub_evt): |
163 | self.curve = pubsub_evt.data | 163 | self.curve = pubsub_evt.data |
164 | + self.CalculateWWWL() | ||
165 | + ww = self.ww | ||
166 | + wl = self.wl | ||
167 | + ps.Publisher().sendMessage('Set volume window and level text', | ||
168 | + (ww, wl)) | ||
169 | + ps.Publisher().sendMessage('Render volume viewer') | ||
164 | 170 | ||
165 | def OnSetRelativeWindowLevel(self, pubsub_evt): | 171 | def OnSetRelativeWindowLevel(self, pubsub_evt): |
166 | diff_ww, diff_wl = pubsub_evt.data | 172 | diff_ww, diff_wl = pubsub_evt.data |
@@ -207,6 +213,16 @@ class Volume(): | @@ -207,6 +213,16 @@ class Volume(): | ||
207 | self.__update_colour_table() | 213 | self.__update_colour_table() |
208 | ps.Publisher().sendMessage('Render volume viewer') | 214 | ps.Publisher().sendMessage('Render volume viewer') |
209 | 215 | ||
216 | + def CalculateWWWL(self): | ||
217 | + """ | ||
218 | + Get the window width & level from the selected curve | ||
219 | + """ | ||
220 | + curve = self.config['16bitClutCurves'][self.curve] | ||
221 | + first_point = curve[0]['x'] | ||
222 | + last_point = curve[-1]['x'] | ||
223 | + self.ww = last_point - first_point | ||
224 | + self.wl = first_point + self.ww | ||
225 | + | ||
210 | def Refresh(self, pubsub_evt): | 226 | def Refresh(self, pubsub_evt): |
211 | self.__update_colour_table() | 227 | self.__update_colour_table() |
212 | 228 |