Commit 45fcc00e8b0283535faf15abdbe23bce19435feb
1 parent
0e4def26
Exists in
master
and in
68 other branches
FIX: Problem with volume viewer bindings - Volume disabled after [1660]
Showing
2 changed files
with
20 additions
and
11 deletions
Show diff stats
invesalius/constants.py
| @@ -428,11 +428,16 @@ STATE_SPIN = 1002 | @@ -428,11 +428,16 @@ STATE_SPIN = 1002 | ||
| 428 | STATE_ZOOM = 1003 | 428 | STATE_ZOOM = 1003 |
| 429 | STATE_ZOOM_SL = 1004 | 429 | STATE_ZOOM_SL = 1004 |
| 430 | STATE_PAN = 1005 | 430 | STATE_PAN = 1005 |
| 431 | -SLICE_STATE_CROSS = 1006 | ||
| 432 | -SLICE_STATE_SCROLL = 1007 | ||
| 433 | -SLICE_STATE_EDITOR = 1008 | 431 | +STATE_ANNOTATE = 1006 |
| 432 | +STATE_MEASURE_DISTANCE = 1007 | ||
| 433 | +STATE_MEASURE_ANGLE = 1008 | ||
| 434 | + | ||
| 435 | +SLICE_STATE_CROSS = 3006 | ||
| 436 | +SLICE_STATE_SCROLL = 3007 | ||
| 437 | +SLICE_STATE_EDITOR = 3008 | ||
| 438 | + | ||
| 434 | VOLUME_STATE_SEED = 2001 | 439 | VOLUME_STATE_SEED = 2001 |
| 435 | -STATE_LINEAR_MEASURE = 3001 | 440 | +#STATE_LINEAR_MEASURE = 3001 |
| 436 | 441 | ||
| 437 | 442 | ||
| 438 | TOOL_STATES = [ STATE_WL, STATE_SPIN, STATE_ZOOM, | 443 | TOOL_STATES = [ STATE_WL, STATE_SPIN, STATE_ZOOM, |
| @@ -445,18 +450,20 @@ SLICE_STYLES = TOOL_STATES + TOOL_SLICE_STATES | @@ -445,18 +450,20 @@ SLICE_STYLES = TOOL_STATES + TOOL_SLICE_STATES | ||
| 445 | SLICE_STYLES.append(STATE_DEFAULT) | 450 | SLICE_STYLES.append(STATE_DEFAULT) |
| 446 | SLICE_STYLES.append(SLICE_STATE_EDITOR) | 451 | SLICE_STYLES.append(SLICE_STATE_EDITOR) |
| 447 | 452 | ||
| 448 | -VOLUME_STYLES = TOOL_STATES + [VOLUME_STATE_SEED, STATE_LINEAR_MEASURE] | 453 | +VOLUME_STYLES = TOOL_STATES + [VOLUME_STATE_SEED, STATE_MEASURE_DISTANCE] |
| 449 | VOLUME_STYLES.append(STATE_DEFAULT) | 454 | VOLUME_STYLES.append(STATE_DEFAULT) |
| 450 | 455 | ||
| 451 | 456 | ||
| 452 | STYLE_LEVEL = {SLICE_STATE_EDITOR: 1, | 457 | STYLE_LEVEL = {SLICE_STATE_EDITOR: 1, |
| 453 | SLICE_STATE_CROSS: 2, | 458 | SLICE_STATE_CROSS: 2, |
| 454 | SLICE_STATE_SCROLL: 2, | 459 | SLICE_STATE_SCROLL: 2, |
| 460 | + STATE_ANNOTATE: 2, | ||
| 455 | STATE_DEFAULT: 0, | 461 | STATE_DEFAULT: 0, |
| 462 | + STATE_MEASURE_ANGLE: 2, | ||
| 463 | + STATE_MEASURE_DISTANCE: 2, | ||
| 456 | STATE_WL: 2, | 464 | STATE_WL: 2, |
| 457 | STATE_SPIN: 2, | 465 | STATE_SPIN: 2, |
| 458 | STATE_ZOOM: 2, | 466 | STATE_ZOOM: 2, |
| 459 | STATE_ZOOM_SL: 2, | 467 | STATE_ZOOM_SL: 2, |
| 460 | STATE_PAN:2, | 468 | STATE_PAN:2, |
| 461 | - VOLUME_STATE_SEED:1, | ||
| 462 | - STATE_LINEAR_MEASURE: 2} | 469 | + VOLUME_STATE_SEED:1} |
invesalius/data/viewer_volume.py
| @@ -262,6 +262,8 @@ class Viewer(wx.Panel): | @@ -262,6 +262,8 @@ class Viewer(wx.Panel): | ||
| 262 | pass | 262 | pass |
| 263 | 263 | ||
| 264 | def SetInteractorStyle(self, state): | 264 | def SetInteractorStyle(self, state): |
| 265 | + print "SetInteractorStyle" | ||
| 266 | + print "state: ", state | ||
| 265 | action = { | 267 | action = { |
| 266 | const.STATE_PAN: | 268 | const.STATE_PAN: |
| 267 | { | 269 | { |
| @@ -294,7 +296,7 @@ class Viewer(wx.Panel): | @@ -294,7 +296,7 @@ class Viewer(wx.Panel): | ||
| 294 | { | 296 | { |
| 295 | "LeftButtonPressEvent": self.OnInsertSeed | 297 | "LeftButtonPressEvent": self.OnInsertSeed |
| 296 | }, | 298 | }, |
| 297 | - const.STATE_LINEAR_MEASURE: | 299 | + const.STATE_MEASURE_DISTANCE: |
| 298 | { | 300 | { |
| 299 | "LeftButtonPressEvent": self.OnInsertLinearMeasurePoint | 301 | "LeftButtonPressEvent": self.OnInsertLinearMeasurePoint |
| 300 | } | 302 | } |
| @@ -310,6 +312,9 @@ class Viewer(wx.Panel): | @@ -310,6 +312,9 @@ class Viewer(wx.Panel): | ||
| 310 | self.text.Hide() | 312 | self.text.Hide() |
| 311 | self.interactor.Render() | 313 | self.interactor.Render() |
| 312 | 314 | ||
| 315 | + if state == const.STATE_MEASURE_DISTANCE: | ||
| 316 | + self.interactor.SetPicker(self.measure_picker) | ||
| 317 | + | ||
| 313 | if (state == const.STATE_ZOOM_SL): | 318 | if (state == const.STATE_ZOOM_SL): |
| 314 | style = vtk.vtkInteractorStyleRubberBandZoom() | 319 | style = vtk.vtkInteractorStyleRubberBandZoom() |
| 315 | self.interactor.SetInteractorStyle(style) | 320 | self.interactor.SetInteractorStyle(style) |
| @@ -319,9 +324,6 @@ class Viewer(wx.Panel): | @@ -319,9 +324,6 @@ class Viewer(wx.Panel): | ||
| 319 | self.interactor.SetInteractorStyle(style) | 324 | self.interactor.SetInteractorStyle(style) |
| 320 | self.style = style | 325 | self.style = style |
| 321 | 326 | ||
| 322 | - if state == const.STATE_LINEAR_MEASURE: | ||
| 323 | - self.interactor.SetPicker(self.measure_picker) | ||
| 324 | - | ||
| 325 | # Check each event available for each mode | 327 | # Check each event available for each mode |
| 326 | for event in action[state]: | 328 | for event in action[state]: |
| 327 | # Bind event | 329 | # Bind event |