Commit 9076ea01696f1ca0cae289d0d833acfcd6fad9b5
1 parent
3977a49c
Exists in
master
and in
68 other branches
ENH: Sending type/orientation on add measures
Showing
2 changed files
with
21 additions
and
5 deletions
Show diff stats
invesalius/data/viewer_slice.py
| 1 | +#!/usr/bin/env python | |
| 2 | +# -*- coding: utf-8 -*- | |
| 1 | 3 | #-------------------------------------------------------------------------- |
| 2 | 4 | # Software: InVesalius - Software de Reconstrucao 3D de Imagens Medicas |
| 3 | 5 | # Copyright: (C) 2001 Centro de Pesquisas Renato Archer |
| ... | ... | @@ -41,6 +43,12 @@ from data import measures |
| 41 | 43 | ID_TO_TOOL_ITEM = {} |
| 42 | 44 | STR_WL = "WL: %d WW: %d" |
| 43 | 45 | |
| 46 | +ORIENTATIONS = { | |
| 47 | + "AXIAL": _("Axial"), | |
| 48 | + "CORONAL": _("Coronal"), | |
| 49 | + "SAGITAL": _("Sagital"), | |
| 50 | + } | |
| 51 | + | |
| 44 | 52 | class Viewer(wx.Panel): |
| 45 | 53 | |
| 46 | 54 | def __init__(self, prnt, orientation='AXIAL'): |
| ... | ... | @@ -62,6 +70,8 @@ class Viewer(wx.Panel): |
| 62 | 70 | self.layout = (1, 1) |
| 63 | 71 | self.orientation_texts = [] |
| 64 | 72 | |
| 73 | + self.measures = [] | |
| 74 | + | |
| 65 | 75 | self.__init_gui() |
| 66 | 76 | |
| 67 | 77 | self.orientation = orientation |
| ... | ... | @@ -80,7 +90,6 @@ class Viewer(wx.Panel): |
| 80 | 90 | self.pick = vtk.vtkPropPicker() |
| 81 | 91 | self.cross_actor = vtk.vtkActor() |
| 82 | 92 | |
| 83 | - self.measures = [] | |
| 84 | 93 | |
| 85 | 94 | self.__bind_events() |
| 86 | 95 | self.__bind_events_wx() |
| ... | ... | @@ -1370,6 +1379,8 @@ class Viewer(wx.Panel): |
| 1370 | 1379 | def set_slice_number(self, index): |
| 1371 | 1380 | self.slice_number = index |
| 1372 | 1381 | # Showing off all the measures |
| 1382 | + if self.measures and not self.measures[-1][1].IsComplete(): | |
| 1383 | + del self.measures[-1] | |
| 1373 | 1384 | [m[1].SetVisibility(0) for m in self.measures] |
| 1374 | 1385 | for n, slice_data in enumerate(self.slice_data_list): |
| 1375 | 1386 | ren = slice_data.renderer |
| ... | ... | @@ -1442,7 +1453,8 @@ class Viewer(wx.Panel): |
| 1442 | 1453 | m.AddPoint(x, y, z) |
| 1443 | 1454 | if m.IsComplete(): |
| 1444 | 1455 | ps.Publisher().sendMessage("Add measure to list", |
| 1445 | - ("3D", _("%.3f mm3" % m.GetValue()))) | |
| 1456 | + (ORIENTATIONS[self.orientation], | |
| 1457 | + _(u"%.3f mm" % m.GetValue()))) | |
| 1446 | 1458 | self.interactor.Render() |
| 1447 | 1459 | |
| 1448 | 1460 | def OnInsertAngularMeasurePoint(self, obj, evt): |
| ... | ... | @@ -1463,5 +1475,6 @@ class Viewer(wx.Panel): |
| 1463 | 1475 | m.AddPoint(x, y, z) |
| 1464 | 1476 | if m.IsComplete(): |
| 1465 | 1477 | ps.Publisher().sendMessage("Add measure to list", |
| 1466 | - ("3D", _("%.3f" % m.GetValue()))) | |
| 1478 | + (ORIENTATIONS[self.orientation], | |
| 1479 | + _(u"%.3fº" % m.GetValue()))) | |
| 1467 | 1480 | self.interactor.Render() | ... | ... |
invesalius/data/viewer_volume.py
| 1 | +#!/usr/bin/env python | |
| 2 | +# -*- coding: utf-8 -*- | |
| 3 | + | |
| 1 | 4 | #-------------------------------------------------------------------------- |
| 2 | 5 | # Software: InVesalius - Software de Reconstrucao 3D de Imagens Medicas |
| 3 | 6 | # Copyright: (C) 2001 Centro de Pesquisas Renato Archer |
| ... | ... | @@ -634,7 +637,7 @@ class Viewer(wx.Panel): |
| 634 | 637 | m.AddPoint(x, y, z) |
| 635 | 638 | if m.IsComplete(): |
| 636 | 639 | ps.Publisher().sendMessage("Add measure to list", |
| 637 | - ("3D", _("%.3f mm3" % m.GetValue()))) | |
| 640 | + (u"3D", _(u"%.3f mm" % m.GetValue()))) | |
| 638 | 641 | self.interactor.Render() |
| 639 | 642 | |
| 640 | 643 | def OnInsertAngularMeasurePoint(self, obj, evt): |
| ... | ... | @@ -652,7 +655,7 @@ class Viewer(wx.Panel): |
| 652 | 655 | m.AddPoint(x, y, z) |
| 653 | 656 | if m.IsComplete(): |
| 654 | 657 | ps.Publisher().sendMessage("Add measure to list", |
| 655 | - ("3D", _("%.3f" % m.GetValue()))) | |
| 658 | + (u"3D", _(u"%.3fº" % m.GetValue()))) | |
| 656 | 659 | self.interactor.Render() |
| 657 | 660 | |
| 658 | 661 | ... | ... |