Commit cfebcefbee7623ea104ac9ca7b54b634baab16ee
1 parent
ab0a1070
Exists in
master
and in
68 other branches
ENH: Colors of the slice plane border
Showing
1 changed file
with
78 additions
and
20 deletions
Show diff stats
invesalius/data/viewer_volume.py
... | ... | @@ -316,7 +316,10 @@ class Viewer(wx.Panel): |
316 | 316 | class SlicePlane: |
317 | 317 | |
318 | 318 | def __init__(self): |
319 | + project = prj.Project() | |
320 | + self.original_orientation = project.original_orientation | |
319 | 321 | self.Create() |
322 | + | |
320 | 323 | |
321 | 324 | def Create(self): |
322 | 325 | |
... | ... | @@ -327,8 +330,6 @@ class SlicePlane: |
327 | 330 | plane_x.TextureVisibilityOn() |
328 | 331 | plane_x.SetLeftButtonAction(1) |
329 | 332 | plane_x.SetRightButtonAction(0) |
330 | - prop1 = plane_x.GetPlaneProperty() | |
331 | - prop1.SetColor(0, 0, 1) | |
332 | 333 | cursor_property = plane_x.GetCursorProperty() |
333 | 334 | cursor_property.SetOpacity(0) |
334 | 335 | |
... | ... | @@ -339,8 +340,6 @@ class SlicePlane: |
339 | 340 | plane_y.TextureVisibilityOn() |
340 | 341 | plane_y.SetLeftButtonAction(1) |
341 | 342 | plane_y.SetRightButtonAction(0) |
342 | - prop1 = plane_y.GetPlaneProperty() | |
343 | - prop1.SetColor(0, 1, 0) | |
344 | 343 | cursor_property = plane_y.GetCursorProperty() |
345 | 344 | cursor_property.SetOpacity(0) |
346 | 345 | |
... | ... | @@ -351,11 +350,39 @@ class SlicePlane: |
351 | 350 | plane_z.TextureVisibilityOn() |
352 | 351 | plane_z.SetLeftButtonAction(1) |
353 | 352 | plane_z.SetRightButtonAction(0) |
354 | - prop1 = plane_z.GetPlaneProperty() | |
355 | - prop1.SetColor(1, 0, 0) | |
356 | 353 | cursor_property = plane_z.GetCursorProperty() |
357 | 354 | cursor_property.SetOpacity(0) |
358 | - | |
355 | + | |
356 | + if(self.original_orientation == const.AXIAL): | |
357 | + prop3 = plane_z.GetPlaneProperty() | |
358 | + prop3.SetColor(1, 0, 0) | |
359 | + | |
360 | + prop1 = plane_x.GetPlaneProperty() | |
361 | + prop1.SetColor(0, 0, 1) | |
362 | + | |
363 | + prop2 = plane_y.GetPlaneProperty() | |
364 | + prop2.SetColor(0, 1, 0) | |
365 | + | |
366 | + elif(self.original_orientation == const.SAGITAL): | |
367 | + prop3 = plane_y.GetPlaneProperty() | |
368 | + prop3.SetColor(1, 0, 0) | |
369 | + | |
370 | + prop1 = plane_z.GetPlaneProperty() | |
371 | + prop1.SetColor(0, 0, 1) | |
372 | + | |
373 | + prop2 = plane_x.GetPlaneProperty() | |
374 | + prop2.SetColor(0, 1, 0) | |
375 | + | |
376 | + else: | |
377 | + prop3 = plane_y.GetPlaneProperty() | |
378 | + prop3.SetColor(1, 0, 0) | |
379 | + | |
380 | + prop1 = plane_x.GetPlaneProperty() | |
381 | + prop1.SetColor(0, 0, 1) | |
382 | + | |
383 | + prop2 = plane_z.GetPlaneProperty() | |
384 | + prop2.SetColor(0, 1, 0) | |
385 | + | |
359 | 386 | ps.Publisher().sendMessage('Set Widget Interactor', plane_x) |
360 | 387 | ps.Publisher().sendMessage('Set Widget Interactor', plane_y) |
361 | 388 | ps.Publisher().sendMessage('Set Widget Interactor', plane_z) |
... | ... | @@ -372,13 +399,27 @@ class SlicePlane: |
372 | 399 | if (evt_pubsub): |
373 | 400 | label = evt_pubsub.data |
374 | 401 | |
375 | - if(label == "Axial"): | |
376 | - self.plane_z.On() | |
377 | - elif(label == "Coronal"): | |
378 | - self.plane_x.On() | |
379 | - elif(label == "Sagital"): | |
380 | - self.plane_y.On() | |
381 | - | |
402 | + if(self.original_orientation == const.AXIAL): | |
403 | + if(label == "Axial"): | |
404 | + self.plane_z.On() | |
405 | + elif(label == "Coronal"): | |
406 | + self.plane_x.On() | |
407 | + elif(label == "Sagital"): | |
408 | + self.plane_y.On() | |
409 | + elif(self.original_orientation == const.SAGITAL): | |
410 | + if(label == "Axial"): | |
411 | + self.plane_y.On() | |
412 | + elif(label == "Coronal"): | |
413 | + self.plane_x.On() | |
414 | + elif(label == "Sagital"): | |
415 | + self.plane_z.On() | |
416 | + else: | |
417 | + if(label == "Axial"): | |
418 | + self.plane_y.On() | |
419 | + elif(label == "Coronal"): | |
420 | + self.plane_z.On() | |
421 | + elif(label == "Sagital"): | |
422 | + self.plane_x.On() | |
382 | 423 | else: |
383 | 424 | self.plane_z.On() |
384 | 425 | self.plane_x.On() |
... | ... | @@ -390,12 +431,29 @@ class SlicePlane: |
390 | 431 | if (evt_pubsub): |
391 | 432 | label = evt_pubsub.data |
392 | 433 | |
393 | - if(label == "Axial"): | |
394 | - self.plane_z.Off() | |
395 | - elif(label == "Coronal"): | |
396 | - self.plane_x.Off() | |
397 | - elif(label == "Sagital"): | |
398 | - self.plane_y.Off() | |
434 | + if(self.original_orientation == const.AXIAL): | |
435 | + if(label == "Axial"): | |
436 | + self.plane_z.Off() | |
437 | + elif(label == "Coronal"): | |
438 | + self.plane_x.Off() | |
439 | + elif(label == "Sagital"): | |
440 | + self.plane_y.Off() | |
441 | + | |
442 | + elif(self.original_orientation == const.SAGITAL): | |
443 | + if(label == "Axial"): | |
444 | + self.plane_y.Off() | |
445 | + elif(label == "Coronal"): | |
446 | + self.plane_x.Off() | |
447 | + elif(label == "Sagital"): | |
448 | + self.plane_z.Off() | |
449 | + else: | |
450 | + if(label == "Axial"): | |
451 | + self.plane_y.Off() | |
452 | + elif(label == "Coronal"): | |
453 | + self.plane_z.Off() | |
454 | + elif(label == "Sagital"): | |
455 | + self.plane_x.Off() | |
456 | + | |
399 | 457 | else: |
400 | 458 | self.plane_z.Off() |
401 | 459 | self.plane_x.Off() | ... | ... |