Commit 8e222ec9b46378d7001b2f47f95674fca019fe78
1 parent
f9eb4d86
Exists in
master
and in
68 other branches
ENH: Conflict state window and level with zoom in the volume
Showing
1 changed file
with
12 additions
and
6 deletions
Show diff stats
invesalius/data/viewer_volume.py
| @@ -91,7 +91,12 @@ class Viewer(wx.Panel): | @@ -91,7 +91,12 @@ class Viewer(wx.Panel): | ||
| 91 | "MouseMoveEvent": self.OnSpinMove, | 91 | "MouseMoveEvent": self.OnSpinMove, |
| 92 | "LeftButtonPressEvent": self.OnSpinClick, | 92 | "LeftButtonPressEvent": self.OnSpinClick, |
| 93 | "LeftButtonReleaseEvent": self.OnReleaseSpinClick, | 93 | "LeftButtonReleaseEvent": self.OnReleaseSpinClick, |
| 94 | - } | 94 | + }, |
| 95 | + 'WINDOWLEVEL':{ | ||
| 96 | + "MouseMoveEvent": self.OnWindowLevelMove, | ||
| 97 | + "LeftButtonPressEvent": self.OnWindowLevelClick, | ||
| 98 | + "LeftButtonReleaseEvent":self.OnWindowLevelRelease | ||
| 99 | + } | ||
| 95 | } | 100 | } |
| 96 | 101 | ||
| 97 | if (new_mode == 'ZOOMSELECT'): | 102 | if (new_mode == 'ZOOMSELECT'): |
| @@ -149,7 +154,6 @@ class Viewer(wx.Panel): | @@ -149,7 +154,6 @@ class Viewer(wx.Panel): | ||
| 149 | evt.EndPan() | 154 | evt.EndPan() |
| 150 | 155 | ||
| 151 | def SetNewMode(self, pubsub_evt): | 156 | def SetNewMode(self, pubsub_evt): |
| 152 | - print "__________________________" | ||
| 153 | mode = pubsub_evt.topic[1] | 157 | mode = pubsub_evt.topic[1] |
| 154 | 158 | ||
| 155 | if (mode == const.MODE_ZOOM_SELECTION): | 159 | if (mode == const.MODE_ZOOM_SELECTION): |
| @@ -160,8 +164,10 @@ class Viewer(wx.Panel): | @@ -160,8 +164,10 @@ class Viewer(wx.Panel): | ||
| 160 | self.SetMode('ZOOM') | 164 | self.SetMode('ZOOM') |
| 161 | elif(mode == const.MODE_ROTATE): | 165 | elif(mode == const.MODE_ROTATE): |
| 162 | self.SetMode('SPIN') | 166 | self.SetMode('SPIN') |
| 167 | + elif(mode == const.MODE_WW_WL): | ||
| 168 | + self.SetMode('WINDOWLEVEL') | ||
| 163 | 169 | ||
| 164 | - def OnMove(self, obj, evt): | 170 | + def OnWindowLevelMove(self, obj, evt): |
| 165 | if self.onclick and self.raycasting_volume: | 171 | if self.onclick and self.raycasting_volume: |
| 166 | mouse_x, mouse_y = self.interactor.GetEventPosition() | 172 | mouse_x, mouse_y = self.interactor.GetEventPosition() |
| 167 | diff_x = mouse_x - self.last_x | 173 | diff_x = mouse_x - self.last_x |
| @@ -172,12 +178,12 @@ class Viewer(wx.Panel): | @@ -172,12 +178,12 @@ class Viewer(wx.Panel): | ||
| 172 | ps.Publisher().sendMessage('Refresh raycasting widget points', None) | 178 | ps.Publisher().sendMessage('Refresh raycasting widget points', None) |
| 173 | self.interactor.Render() | 179 | self.interactor.Render() |
| 174 | 180 | ||
| 175 | - def OnClick(self, obj, evt): | 181 | + def OnWindowLevelClick(self, obj, evt): |
| 176 | self.onclick = True | 182 | self.onclick = True |
| 177 | mouse_x, mouse_y = self.interactor.GetEventPosition() | 183 | mouse_x, mouse_y = self.interactor.GetEventPosition() |
| 178 | self.last_x, self.last_y = mouse_x, mouse_y | 184 | self.last_x, self.last_y = mouse_x, mouse_y |
| 179 | 185 | ||
| 180 | - def OnRelease(self, obj, evt): | 186 | + def OnWindowLevelRelease(self, obj, evt): |
| 181 | self.onclick = False | 187 | self.onclick = False |
| 182 | 188 | ||
| 183 | 189 | ||
| @@ -241,7 +247,7 @@ class Viewer(wx.Panel): | @@ -241,7 +247,7 @@ class Viewer(wx.Panel): | ||
| 241 | ps.Publisher().subscribe(self.OnSetViewAngle, | 247 | ps.Publisher().subscribe(self.OnSetViewAngle, |
| 242 | 'Set volume view angle') | 248 | 'Set volume view angle') |
| 243 | 249 | ||
| 244 | - ps.Publisher().subscribe(self.OnEnableBrightContrast, | 250 | + ps.Publisher().subscribe(self.SetNewMode, |
| 245 | ('Set interaction mode', const.MODE_WW_WL)) | 251 | ('Set interaction mode', const.MODE_WW_WL)) |
| 246 | ps.Publisher().subscribe(self.OnDisableBrightContrast, | 252 | ps.Publisher().subscribe(self.OnDisableBrightContrast, |
| 247 | ('Set interaction mode', | 253 | ('Set interaction mode', |