Commit eb3e7a37bed9ad893064cffbe7bf3d5d9cb0d2cb
1 parent
a816bc72
Exists in
master
and in
25 other branches
Cycling through measurements colours instead of randomized
Showing
2 changed files
with
7 additions
and
6 deletions
Show diff stats
invesalius/constants.py
@@ -21,6 +21,7 @@ import os.path | @@ -21,6 +21,7 @@ import os.path | ||
21 | import platform | 21 | import platform |
22 | import sys | 22 | import sys |
23 | import wx | 23 | import wx |
24 | +import itertools | ||
24 | 25 | ||
25 | from project import Project | 26 | from project import Project |
26 | 27 | ||
@@ -219,11 +220,11 @@ MASK_COLOUR = [[0.33, 1, 0.33], | @@ -219,11 +220,11 @@ MASK_COLOUR = [[0.33, 1, 0.33], | ||
219 | #(0.66666666666666663, 0.792156862745098, 1.0)] | 220 | #(0.66666666666666663, 0.792156862745098, 1.0)] |
220 | 221 | ||
221 | 222 | ||
222 | -MEASURE_COLOUR = [[1, 0, 0], | ||
223 | - [1, 0.4, 0], | ||
224 | - [0, 0, 1], | ||
225 | - [1, 0, 1], | ||
226 | - [0, 0.6, 0]] | 223 | +MEASURE_COLOUR = itertools.cycle([[1, 0, 0], |
224 | + [1, 0.4, 0], | ||
225 | + [0, 0, 1], | ||
226 | + [1, 0, 1], | ||
227 | + [0, 0.6, 0]]) | ||
227 | 228 | ||
228 | SURFACE_COLOUR = [(0.33, 1, 0.33), | 229 | SURFACE_COLOUR = [(0.33, 1, 0.33), |
229 | (1, 1, 0.33), | 230 | (1, 1, 0.33), |
invesalius/data/measures.py
@@ -348,7 +348,7 @@ class Measurement(): | @@ -348,7 +348,7 @@ class Measurement(): | ||
348 | Measurement.general_index += 1 | 348 | Measurement.general_index += 1 |
349 | self.index = Measurement.general_index | 349 | self.index = Measurement.general_index |
350 | self.name = const.MEASURE_NAME_PATTERN %(self.index+1) | 350 | self.name = const.MEASURE_NAME_PATTERN %(self.index+1) |
351 | - self.colour = random.choice(const.MEASURE_COLOUR) | 351 | + self.colour = const.MEASURE_COLOUR.next() |
352 | self.value = 0 | 352 | self.value = 0 |
353 | self.location = const.SURFACE # AXIAL, CORONAL, SAGITTAL | 353 | self.location = const.SURFACE # AXIAL, CORONAL, SAGITTAL |
354 | self.type = const.LINEAR # ANGULAR | 354 | self.type = const.LINEAR # ANGULAR |