From 434b1edae6097e2011d5800f68b0d08e297a78ed Mon Sep 17 00:00:00 2001 From: paulojamorim Date: Fri, 5 Mar 2010 18:55:01 +0000 Subject: [PATCH] ENH: Colour's of the measures --- invesalius/constants.py | 18 ++++++++++++------ invesalius/data/measures.py | 20 ++++++++++---------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/invesalius/constants.py b/invesalius/constants.py index 9c76305..38ed439 100644 --- a/invesalius/constants.py +++ b/invesalius/constants.py @@ -28,7 +28,7 @@ from project import Project #--------------- # Measurements -MEASURE_NAME_PATTERN = _("M %d") +MEASURE_NAME_PATTERN = _("M %d") MEASURE_LINEAR = 101 MEASURE_ANGULAR = 102 @@ -36,7 +36,7 @@ DEFAULT_MEASURE_COLOUR = (1,0,0) DEFAULT_MEASURE_BG_COLOUR = (250/255.0, 247/255.0, 218/255.0) DEFAULT_MEASURE_RADIUS = 1 DEFAULT_MEASURE_TYPE = MEASURE_LINEAR - + # VTK text TEXT_SIZE_SMALL = 11 @@ -205,6 +205,12 @@ MASK_COLOUR = [[0.33, 1, 0.33], #(0.66666666666666663, 0.792156862745098, 1.0)] +MEASURE_COLOUR = [[1, 0, 0], + [1, 0.4, 0], + [0, 0, 1], + [1, 0, 1], + [0, 0.6, 0]] + SURFACE_COLOUR = [(0.33, 1, 0.33), (1, 1, 0.33), (0.33, 0.91, 1), @@ -304,7 +310,7 @@ RAYCASTING_FILES = {_("Airways"): "Airways.plist", _("Bone + Skin"): "Bone + Skin.plist", _("Bone + Skin II"): "Bone + Skin II.plist", _("Dark Bone"): "Dark Bone.plist", - _("Glossy"): "Glossy.plist", + _("Glossy"): "Glossy.plist", _("Glossy II"): "Glossy II.plist", _("Gold Bone"): "Gold Bone.plist", _("High Contrast"): "High Contrast.plist", @@ -335,7 +341,7 @@ RAYCASTING_TYPES = [_(filename.split(".")[0]) for filename in os.listdir(folder) if os.path.isfile(os.path.join(folder,filename))] - + LOG_FOLDER = os.path.join(os.path.expanduser('~'), '.invesalius', 'logs') if not os.path.isdir(LOG_FOLDER): os.makedirs(LOG_FOLDER) @@ -343,7 +349,7 @@ if not os.path.isdir(LOG_FOLDER): folder = os.path.join(os.path.expanduser('~'), '.invesalius', 'presets') if not os.path.isdir(folder): os.makedirs(folder) - + USER_RAYCASTING_PRESETS_DIRECTORY = folder RAYCASTING_TYPES += [_(filename.split(".")[0]) for filename in @@ -469,7 +475,7 @@ SLICE_STYLES.append(STATE_DEFAULT) SLICE_STYLES.append(SLICE_STATE_EDITOR) VOLUME_STYLES = TOOL_STATES + [VOLUME_STATE_SEED, STATE_MEASURE_DISTANCE, - STATE_MEASURE_ANGLE] + STATE_MEASURE_ANGLE] VOLUME_STYLES.append(STATE_DEFAULT) diff --git a/invesalius/data/measures.py b/invesalius/data/measures.py index 994cdae..3ee261c 100644 --- a/invesalius/data/measures.py +++ b/invesalius/data/measures.py @@ -65,7 +65,7 @@ class MeasurementManager(object): else: mr = AngularMeasure(m.colour) self.current = (m, mr) - + x, y, z = position actors = self.current[1].AddPoint(x, y, z) ps.Publisher().sendMessage(("Add actors", location), actors) @@ -116,7 +116,7 @@ class Measurement(): Measurement.general_index += 1 self.index = Measurement.general_index self.name = const.MEASURE_NAME_PATTERN %(self.index+1) - self.colour = random.choice(const.MASK_COLOUR) + self.colour = random.choice(const.MEASURE_COLOUR) self.value = 0 self.location = const.SURFACE # AXIAL, CORONAL, SAGITTAL self.type = const.LINEAR # ANGULAR @@ -154,10 +154,10 @@ class CirclePointRepresentation(object): sphere = vtk.vtkSphereSource() sphere.SetCenter(x, y, z) sphere.SetRadius(self.radius) - + # c = vtk.vtkCoordinate() # c.SetCoordinateSystemToWorld() - + m = vtk.vtkPolyDataMapper() m.SetInputConnection(sphere.GetOutputPort()) # m.SetTransformCoordinate(c) @@ -181,7 +181,7 @@ class CrossPointRepresentation(object): self.camera = camera self.colour = colour self.size = size - + def GetRepresentation(self, x, y, z): pc = self.camera.GetPosition() # camera position pf = self.camera.GetFocalPoint() # focal position @@ -199,7 +199,7 @@ class CrossPointRepresentation(object): vtk.vtkMath.Cross(vcp, vcf, n) # then normalize n to only indicate the direction of this vector vtk.vtkMath.Normalize(n) - # then + # then p1 = [i*self.size + j for i,j in zip(n, pp)] p2 = [i*-self.size + j for i,j in zip(n, pp)] @@ -323,7 +323,7 @@ class LinearMeasure(object): if self.point_actor1: self.render.RemoveActor(self.point_actor1) renderer.AddActor(self.point_actor1) - + if self.point_actor2: self.render.RemoveActor(self.point_actor2) renderer.AddActor(self.point_actor2) @@ -363,7 +363,7 @@ class LinearMeasure(object): if self.point_actor1: self.render.RemoveActor(self.point_actor1) del self.point_actor1 - + if self.point_actor2: self.render.RemoveActor(self.point_actor2) del self.point_actor2 @@ -555,7 +555,7 @@ class AngularMeasure(object): if self.point_actor1: self.render.RemoveActor(self.point_actor1) del self.point_actor1 - + if self.point_actor2: self.render.RemoveActor(self.point_actor2) del self.point_actor2 @@ -576,7 +576,7 @@ class AngularMeasure(object): if self.point_actor1: self.render.RemoveActor(self.point_actor1) renderer.AddActor(self.point_actor1) - + if self.point_actor2: self.render.RemoveActor(self.point_actor2) renderer.AddActor(self.point_actor2) -- libgit2 0.21.2