Commit 434b1edae6097e2011d5800f68b0d08e297a78ed

Authored by Paulo Henrique Junqueira Amorim
1 parent ff84d81a

ENH: Colour's of the measures

invesalius/constants.py
... ... @@ -28,7 +28,7 @@ from project import Project
28 28 #---------------
29 29  
30 30 # Measurements
31   -MEASURE_NAME_PATTERN = _("M %d")
  31 +MEASURE_NAME_PATTERN = _("M %d")
32 32 MEASURE_LINEAR = 101
33 33 MEASURE_ANGULAR = 102
34 34  
... ... @@ -36,7 +36,7 @@ DEFAULT_MEASURE_COLOUR = (1,0,0)
36 36 DEFAULT_MEASURE_BG_COLOUR = (250/255.0, 247/255.0, 218/255.0)
37 37 DEFAULT_MEASURE_RADIUS = 1
38 38 DEFAULT_MEASURE_TYPE = MEASURE_LINEAR
39   -
  39 +
40 40  
41 41 # VTK text
42 42 TEXT_SIZE_SMALL = 11
... ... @@ -205,6 +205,12 @@ MASK_COLOUR = [[0.33, 1, 0.33],
205 205 #(0.66666666666666663, 0.792156862745098, 1.0)]
206 206  
207 207  
  208 +MEASURE_COLOUR = [[1, 0, 0],
  209 + [1, 0.4, 0],
  210 + [0, 0, 1],
  211 + [1, 0, 1],
  212 + [0, 0.6, 0]]
  213 +
208 214 SURFACE_COLOUR = [(0.33, 1, 0.33),
209 215 (1, 1, 0.33),
210 216 (0.33, 0.91, 1),
... ... @@ -304,7 +310,7 @@ RAYCASTING_FILES = {_("Airways"): "Airways.plist",
304 310 _("Bone + Skin"): "Bone + Skin.plist",
305 311 _("Bone + Skin II"): "Bone + Skin II.plist",
306 312 _("Dark Bone"): "Dark Bone.plist",
307   - _("Glossy"): "Glossy.plist",
  313 + _("Glossy"): "Glossy.plist",
308 314 _("Glossy II"): "Glossy II.plist",
309 315 _("Gold Bone"): "Gold Bone.plist",
310 316 _("High Contrast"): "High Contrast.plist",
... ... @@ -335,7 +341,7 @@ RAYCASTING_TYPES = [_(filename.split(".")[0]) for filename in
335 341 os.listdir(folder) if
336 342 os.path.isfile(os.path.join(folder,filename))]
337 343  
338   -
  344 +
339 345 LOG_FOLDER = os.path.join(os.path.expanduser('~'), '.invesalius', 'logs')
340 346 if not os.path.isdir(LOG_FOLDER):
341 347 os.makedirs(LOG_FOLDER)
... ... @@ -343,7 +349,7 @@ if not os.path.isdir(LOG_FOLDER):
343 349 folder = os.path.join(os.path.expanduser('~'), '.invesalius', 'presets')
344 350 if not os.path.isdir(folder):
345 351 os.makedirs(folder)
346   -
  352 +
347 353  
348 354 USER_RAYCASTING_PRESETS_DIRECTORY = folder
349 355 RAYCASTING_TYPES += [_(filename.split(".")[0]) for filename in
... ... @@ -469,7 +475,7 @@ SLICE_STYLES.append(STATE_DEFAULT)
469 475 SLICE_STYLES.append(SLICE_STATE_EDITOR)
470 476  
471 477 VOLUME_STYLES = TOOL_STATES + [VOLUME_STATE_SEED, STATE_MEASURE_DISTANCE,
472   - STATE_MEASURE_ANGLE]
  478 + STATE_MEASURE_ANGLE]
473 479 VOLUME_STYLES.append(STATE_DEFAULT)
474 480  
475 481  
... ...
invesalius/data/measures.py
... ... @@ -65,7 +65,7 @@ class MeasurementManager(object):
65 65 else:
66 66 mr = AngularMeasure(m.colour)
67 67 self.current = (m, mr)
68   -
  68 +
69 69 x, y, z = position
70 70 actors = self.current[1].AddPoint(x, y, z)
71 71 ps.Publisher().sendMessage(("Add actors", location), actors)
... ... @@ -116,7 +116,7 @@ class Measurement():
116 116 Measurement.general_index += 1
117 117 self.index = Measurement.general_index
118 118 self.name = const.MEASURE_NAME_PATTERN %(self.index+1)
119   - self.colour = random.choice(const.MASK_COLOUR)
  119 + self.colour = random.choice(const.MEASURE_COLOUR)
120 120 self.value = 0
121 121 self.location = const.SURFACE # AXIAL, CORONAL, SAGITTAL
122 122 self.type = const.LINEAR # ANGULAR
... ... @@ -154,10 +154,10 @@ class CirclePointRepresentation(object):
154 154 sphere = vtk.vtkSphereSource()
155 155 sphere.SetCenter(x, y, z)
156 156 sphere.SetRadius(self.radius)
157   -
  157 +
158 158 # c = vtk.vtkCoordinate()
159 159 # c.SetCoordinateSystemToWorld()
160   -
  160 +
161 161 m = vtk.vtkPolyDataMapper()
162 162 m.SetInputConnection(sphere.GetOutputPort())
163 163 # m.SetTransformCoordinate(c)
... ... @@ -181,7 +181,7 @@ class CrossPointRepresentation(object):
181 181 self.camera = camera
182 182 self.colour = colour
183 183 self.size = size
184   -
  184 +
185 185 def GetRepresentation(self, x, y, z):
186 186 pc = self.camera.GetPosition() # camera position
187 187 pf = self.camera.GetFocalPoint() # focal position
... ... @@ -199,7 +199,7 @@ class CrossPointRepresentation(object):
199 199 vtk.vtkMath.Cross(vcp, vcf, n)
200 200 # then normalize n to only indicate the direction of this vector
201 201 vtk.vtkMath.Normalize(n)
202   - # then
  202 + # then
203 203 p1 = [i*self.size + j for i,j in zip(n, pp)]
204 204 p2 = [i*-self.size + j for i,j in zip(n, pp)]
205 205  
... ... @@ -323,7 +323,7 @@ class LinearMeasure(object):
323 323 if self.point_actor1:
324 324 self.render.RemoveActor(self.point_actor1)
325 325 renderer.AddActor(self.point_actor1)
326   -
  326 +
327 327 if self.point_actor2:
328 328 self.render.RemoveActor(self.point_actor2)
329 329 renderer.AddActor(self.point_actor2)
... ... @@ -363,7 +363,7 @@ class LinearMeasure(object):
363 363 if self.point_actor1:
364 364 self.render.RemoveActor(self.point_actor1)
365 365 del self.point_actor1
366   -
  366 +
367 367 if self.point_actor2:
368 368 self.render.RemoveActor(self.point_actor2)
369 369 del self.point_actor2
... ... @@ -555,7 +555,7 @@ class AngularMeasure(object):
555 555 if self.point_actor1:
556 556 self.render.RemoveActor(self.point_actor1)
557 557 del self.point_actor1
558   -
  558 +
559 559 if self.point_actor2:
560 560 self.render.RemoveActor(self.point_actor2)
561 561 del self.point_actor2
... ... @@ -576,7 +576,7 @@ class AngularMeasure(object):
576 576 if self.point_actor1:
577 577 self.render.RemoveActor(self.point_actor1)
578 578 renderer.AddActor(self.point_actor1)
579   -
  579 +
580 580 if self.point_actor2:
581 581 self.render.RemoveActor(self.point_actor2)
582 582 renderer.AddActor(self.point_actor2)
... ...