Commit 2ebed0078ce3fc97a8834b9cb0345ab2bdbf563c
1 parent
c68dfbfb
Exists in
master
and in
68 other branches
ENH: Changes in raycasting clut widget affects raycasting
Showing
2 changed files
with
18 additions
and
13 deletions
Show diff stats
invesalius/data/volume.py
@@ -204,7 +204,7 @@ class Volume(): | @@ -204,7 +204,7 @@ class Volume(): | ||
204 | ps.Publisher().sendMessage('Render volume viewer') | 204 | ps.Publisher().sendMessage('Render volume viewer') |
205 | 205 | ||
206 | def Refresh(self, pubsub_evt): | 206 | def Refresh(self, pubsub_evt): |
207 | - self.__set_preset() | 207 | + self.__update_colour_table() |
208 | 208 | ||
209 | #*************** | 209 | #*************** |
210 | def Create16bColorTable(self, scale): | 210 | def Create16bColorTable(self, scale): |
@@ -361,15 +361,16 @@ class Volume(): | @@ -361,15 +361,16 @@ class Volume(): | ||
361 | 361 | ||
362 | def ApplyConvolution(self, imagedata): | 362 | def ApplyConvolution(self, imagedata): |
363 | number_filters = len(self.config['convolutionFilters']) | 363 | number_filters = len(self.config['convolutionFilters']) |
364 | - update_progress= vtk_utils.ShowProgress(number_filters) | ||
365 | - for filter in self.config['convolutionFilters']: | ||
366 | - convolve = vtk.vtkImageConvolve() | ||
367 | - convolve.SetInput(imagedata) | ||
368 | - convolve.SetKernel5x5([i/60.0 for i in Kernels[filter]]) | ||
369 | - convolve.AddObserver("ProgressEvent", lambda obj,evt: | ||
370 | - update_progress(convolve, "%s ..." % filter)) | ||
371 | - convolve.Update() | ||
372 | - imagedata = convolve.GetOutput() | 364 | + if number_filters: |
365 | + update_progress= vtk_utils.ShowProgress(number_filters) | ||
366 | + for filter in self.config['convolutionFilters']: | ||
367 | + convolve = vtk.vtkImageConvolve() | ||
368 | + convolve.SetInput(imagedata) | ||
369 | + convolve.SetKernel5x5([i/60.0 for i in Kernels[filter]]) | ||
370 | + convolve.AddObserver("ProgressEvent", lambda obj,evt: | ||
371 | + update_progress(convolve, "%s ..." % filter)) | ||
372 | + convolve.Update() | ||
373 | + imagedata = convolve.GetOutput() | ||
373 | return imagedata | 374 | return imagedata |
374 | 375 | ||
375 | def LoadVolume(self): | 376 | def LoadVolume(self): |
invesalius/gui/default_viewers.py
@@ -24,7 +24,8 @@ import wx.lib.pubsub as ps | @@ -24,7 +24,8 @@ import wx.lib.pubsub as ps | ||
24 | import data.viewer_slice as slice_viewer | 24 | import data.viewer_slice as slice_viewer |
25 | import data.viewer_volume as volume_viewer | 25 | import data.viewer_volume as volume_viewer |
26 | 26 | ||
27 | -from gui.widgets.clut_raycasting import CLUTRaycastingWidget | 27 | +from gui.widgets.clut_raycasting import CLUTRaycastingWidget, \ |
28 | + EVT_CLUT_POINT_CHANGED | ||
28 | 29 | ||
29 | class Panel(wx.Panel): | 30 | class Panel(wx.Panel): |
30 | def __init__(self, parent): | 31 | def __init__(self, parent): |
@@ -192,7 +193,7 @@ class VolumeInteraction(wx.Panel): | @@ -192,7 +193,7 @@ class VolumeInteraction(wx.Panel): | ||
192 | #sizer = wx.BoxSizer(wx.HORIZONTAL) | 193 | #sizer = wx.BoxSizer(wx.HORIZONTAL) |
193 | #sizer.Add(volume_viewer.Viewer(self), 1, wx.EXPAND|wx.GROW) | 194 | #sizer.Add(volume_viewer.Viewer(self), 1, wx.EXPAND|wx.GROW) |
194 | #self.SetSizer(sizer) | 195 | #self.SetSizer(sizer) |
195 | - #self.__bind_events_wx() | 196 | + self.__bind_events_wx() |
196 | #sizer.Fit(self) | 197 | #sizer.Fit(self) |
197 | 198 | ||
198 | def __init_aui_manager(self): | 199 | def __init_aui_manager(self): |
@@ -229,10 +230,13 @@ class VolumeInteraction(wx.Panel): | @@ -229,10 +230,13 @@ class VolumeInteraction(wx.Panel): | ||
229 | self.aui_manager.Update() | 230 | self.aui_manager.Update() |
230 | 231 | ||
231 | def __bind_events_wx(self): | 232 | def __bind_events_wx(self): |
233 | + self.clut_raycasting.Bind(EVT_CLUT_POINT_CHANGED, self.OnPointChanged) | ||
232 | #self.Bind(wx.EVT_SIZE, self.OnSize) | 234 | #self.Bind(wx.EVT_SIZE, self.OnSize) |
233 | #self.Bind(wx.EVT_MAXIMIZE, self.OnMaximize) | 235 | #self.Bind(wx.EVT_MAXIMIZE, self.OnMaximize) |
234 | - pass | ||
235 | 236 | ||
237 | + def OnPointChanged(self, evt): | ||
238 | + ps.Publisher.sendMessage('Set raycasting refresh', None) | ||
239 | + ps.Publisher().sendMessage('Render volume viewer', None) | ||
236 | 240 | ||
237 | import wx.lib.platebtn as pbtn | 241 | import wx.lib.platebtn as pbtn |
238 | import wx.lib.buttons as btn | 242 | import wx.lib.buttons as btn |