Commit d0658e0b020c37c7c50e56e6e2d78fc3e4a035bb
1 parent
a02ad1c8
Exists in
master
and in
68 other branches
STL: Using colour instead of color
Showing
1 changed file
with
18 additions
and
18 deletions
Show diff stats
invesalius/data/measures.py
@@ -22,12 +22,12 @@ class CirclePointRepresentation(object): | @@ -22,12 +22,12 @@ class CirclePointRepresentation(object): | ||
22 | """ | 22 | """ |
23 | This class represents a circle that indicate a point in the surface | 23 | This class represents a circle that indicate a point in the surface |
24 | """ | 24 | """ |
25 | - def __init__(self, color=(1, 0, 0), radius=1.0): | 25 | + def __init__(self, colour=(1, 0, 0), radius=1.0): |
26 | """ | 26 | """ |
27 | - color: the color of the representation | 27 | + colour: the colour of the representation |
28 | radius: the radius of circle representation | 28 | radius: the radius of circle representation |
29 | """ | 29 | """ |
30 | - self.color = color | 30 | + self.colour = colour |
31 | self.radius = radius | 31 | self.radius = radius |
32 | 32 | ||
33 | def GetRepresentation(self, x, y, z): | 33 | def GetRepresentation(self, x, y, z): |
@@ -47,7 +47,7 @@ class CirclePointRepresentation(object): | @@ -47,7 +47,7 @@ class CirclePointRepresentation(object): | ||
47 | 47 | ||
48 | a = vtk.vtkActor2D() | 48 | a = vtk.vtkActor2D() |
49 | a.SetMapper(m) | 49 | a.SetMapper(m) |
50 | - a.GetProperty().SetColor(self.color) | 50 | + a.GetProperty().SetColor(self.colour) |
51 | 51 | ||
52 | return a | 52 | return a |
53 | 53 | ||
@@ -55,14 +55,14 @@ class CrossPointRepresentation(object): | @@ -55,14 +55,14 @@ class CrossPointRepresentation(object): | ||
55 | """ | 55 | """ |
56 | This class represents a cross that indicate a point in the surface | 56 | This class represents a cross that indicate a point in the surface |
57 | """ | 57 | """ |
58 | - def __init__(self, camera, color=(1, 0, 0), size=1.0): | 58 | + def __init__(self, camera, colour=(1, 0, 0), size=1.0): |
59 | """ | 59 | """ |
60 | - color: the color of the representation | 60 | + colour: the colour of the representation |
61 | size: the size of the representation | 61 | size: the size of the representation |
62 | camera: the active camera, to get the orientation to draw the cross | 62 | camera: the active camera, to get the orientation to draw the cross |
63 | """ | 63 | """ |
64 | self.camera = camera | 64 | self.camera = camera |
65 | - self.color = color | 65 | + self.colour = colour |
66 | self.size = size | 66 | self.size = size |
67 | 67 | ||
68 | def GetRepresentation(self, x, y, z): | 68 | def GetRepresentation(self, x, y, z): |
@@ -114,12 +114,12 @@ class CrossPointRepresentation(object): | @@ -114,12 +114,12 @@ class CrossPointRepresentation(object): | ||
114 | 114 | ||
115 | a = vtk.vtkActor2D() | 115 | a = vtk.vtkActor2D() |
116 | a.SetMapper(m) | 116 | a.SetMapper(m) |
117 | - a.GetProperty().SetColor(self.color) | 117 | + a.GetProperty().SetColor(self.colour) |
118 | return a | 118 | return a |
119 | 119 | ||
120 | class LinearMeasure(object): | 120 | class LinearMeasure(object): |
121 | - def __init__(self, render, color=(1, 0, 0), representation=None): | ||
122 | - self.color = color | 121 | + def __init__(self, render, colour=(1, 0, 0), representation=None): |
122 | + self.colour = colour | ||
123 | self.points = [] | 123 | self.points = [] |
124 | self.point_actor1 = None | 124 | self.point_actor1 = None |
125 | self.point_actor2 = None | 125 | self.point_actor2 = None |
@@ -128,7 +128,7 @@ class LinearMeasure(object): | @@ -128,7 +128,7 @@ class LinearMeasure(object): | ||
128 | if not representation: | 128 | if not representation: |
129 | representation = CirclePointRepresentation() | 129 | representation = CirclePointRepresentation() |
130 | self.representation = representation | 130 | self.representation = representation |
131 | - print color | 131 | + print colour |
132 | 132 | ||
133 | def SetPoint1(self, x, y, z): | 133 | def SetPoint1(self, x, y, z): |
134 | self.points.append((x, y, z)) | 134 | self.points.append((x, y, z)) |
@@ -159,7 +159,7 @@ class LinearMeasure(object): | @@ -159,7 +159,7 @@ class LinearMeasure(object): | ||
159 | 159 | ||
160 | a = vtk.vtkActor2D() | 160 | a = vtk.vtkActor2D() |
161 | a.SetMapper(m) | 161 | a.SetMapper(m) |
162 | - a.GetProperty().SetColor(self.color) | 162 | + a.GetProperty().SetColor(self.colour) |
163 | self.line_actor = a | 163 | self.line_actor = a |
164 | self.render.AddActor(self.line_actor) | 164 | self.render.AddActor(self.line_actor) |
165 | 165 | ||
@@ -171,7 +171,7 @@ class LinearMeasure(object): | @@ -171,7 +171,7 @@ class LinearMeasure(object): | ||
171 | textsource = vtk.vtkTextSource() | 171 | textsource = vtk.vtkTextSource() |
172 | textsource.SetText(text) | 172 | textsource.SetText(text) |
173 | textsource.SetBackgroundColor((250/255.0, 247/255.0, 218/255.0)) | 173 | textsource.SetBackgroundColor((250/255.0, 247/255.0, 218/255.0)) |
174 | - textsource.SetForegroundColor(self.color) | 174 | + textsource.SetForegroundColor(self.colour) |
175 | 175 | ||
176 | m = vtk.vtkPolyDataMapper2D() | 176 | m = vtk.vtkPolyDataMapper2D() |
177 | m.SetInputConnection(textsource.GetOutputPort()) | 177 | m.SetInputConnection(textsource.GetOutputPort()) |
@@ -199,8 +199,8 @@ class LinearMeasure(object): | @@ -199,8 +199,8 @@ class LinearMeasure(object): | ||
199 | 199 | ||
200 | 200 | ||
201 | class AngularMeasure(object): | 201 | class AngularMeasure(object): |
202 | - def __init__(self, render, color=(1, 0, 0), representation=None): | ||
203 | - self.color = color | 202 | + def __init__(self, render, colour=(1, 0, 0), representation=None): |
203 | + self.colour = colour | ||
204 | self.points = [0, 0, 0] | 204 | self.points = [0, 0, 0] |
205 | self.number_of_points = 0 | 205 | self.number_of_points = 0 |
206 | self.point_actor1 = None | 206 | self.point_actor1 = None |
@@ -211,7 +211,7 @@ class AngularMeasure(object): | @@ -211,7 +211,7 @@ class AngularMeasure(object): | ||
211 | if not representation: | 211 | if not representation: |
212 | representation = CirclePointRepresentation() | 212 | representation = CirclePointRepresentation() |
213 | self.representation = representation | 213 | self.representation = representation |
214 | - print color | 214 | + print colour |
215 | 215 | ||
216 | def SetPoint1(self, x, y, z): | 216 | def SetPoint1(self, x, y, z): |
217 | self.points[0] = (x, y, z) | 217 | self.points[0] = (x, y, z) |
@@ -256,7 +256,7 @@ class AngularMeasure(object): | @@ -256,7 +256,7 @@ class AngularMeasure(object): | ||
256 | 256 | ||
257 | a = vtk.vtkActor2D() | 257 | a = vtk.vtkActor2D() |
258 | a.SetMapper(m) | 258 | a.SetMapper(m) |
259 | - a.GetProperty().SetColor(self.color) | 259 | + a.GetProperty().SetColor(self.colour) |
260 | self.line_actor = a | 260 | self.line_actor = a |
261 | return a | 261 | return a |
262 | 262 | ||
@@ -296,7 +296,7 @@ class AngularMeasure(object): | @@ -296,7 +296,7 @@ class AngularMeasure(object): | ||
296 | textsource = vtk.vtkTextSource() | 296 | textsource = vtk.vtkTextSource() |
297 | textsource.SetText(text) | 297 | textsource.SetText(text) |
298 | textsource.SetBackgroundColor((250/255.0, 247/255.0, 218/255.0)) | 298 | textsource.SetBackgroundColor((250/255.0, 247/255.0, 218/255.0)) |
299 | - textsource.SetForegroundColor(self.color) | 299 | + textsource.SetForegroundColor(self.colour) |
300 | 300 | ||
301 | m = vtk.vtkPolyDataMapper2D() | 301 | m = vtk.vtkPolyDataMapper2D() |
302 | m.SetInputConnection(textsource.GetOutputPort()) | 302 | m.SetInputConnection(textsource.GetOutputPort()) |