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 | 91 | "MouseMoveEvent": self.OnSpinMove, |
92 | 92 | "LeftButtonPressEvent": self.OnSpinClick, |
93 | 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 | 102 | if (new_mode == 'ZOOMSELECT'): |
... | ... | @@ -149,7 +154,6 @@ class Viewer(wx.Panel): |
149 | 154 | evt.EndPan() |
150 | 155 | |
151 | 156 | def SetNewMode(self, pubsub_evt): |
152 | - print "__________________________" | |
153 | 157 | mode = pubsub_evt.topic[1] |
154 | 158 | |
155 | 159 | if (mode == const.MODE_ZOOM_SELECTION): |
... | ... | @@ -160,8 +164,10 @@ class Viewer(wx.Panel): |
160 | 164 | self.SetMode('ZOOM') |
161 | 165 | elif(mode == const.MODE_ROTATE): |
162 | 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 | 171 | if self.onclick and self.raycasting_volume: |
166 | 172 | mouse_x, mouse_y = self.interactor.GetEventPosition() |
167 | 173 | diff_x = mouse_x - self.last_x |
... | ... | @@ -172,12 +178,12 @@ class Viewer(wx.Panel): |
172 | 178 | ps.Publisher().sendMessage('Refresh raycasting widget points', None) |
173 | 179 | self.interactor.Render() |
174 | 180 | |
175 | - def OnClick(self, obj, evt): | |
181 | + def OnWindowLevelClick(self, obj, evt): | |
176 | 182 | self.onclick = True |
177 | 183 | mouse_x, mouse_y = self.interactor.GetEventPosition() |
178 | 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 | 187 | self.onclick = False |
182 | 188 | |
183 | 189 | |
... | ... | @@ -241,7 +247,7 @@ class Viewer(wx.Panel): |
241 | 247 | ps.Publisher().subscribe(self.OnSetViewAngle, |
242 | 248 | 'Set volume view angle') |
243 | 249 | |
244 | - ps.Publisher().subscribe(self.OnEnableBrightContrast, | |
250 | + ps.Publisher().subscribe(self.SetNewMode, | |
245 | 251 | ('Set interaction mode', const.MODE_WW_WL)) |
246 | 252 | ps.Publisher().subscribe(self.OnDisableBrightContrast, |
247 | 253 | ('Set interaction mode', | ... | ... |