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