Commit 74706f4e642b423c4bac41279797154251f246c0

Authored by tfmoraes
1 parent dd3709f6

ENH: The gaps in the RectangleCursor was filled

Showing 1 changed file with 16 additions and 9 deletions   Show diff stats
invesalius/data/cursor_actors.py
... ... @@ -31,16 +31,16 @@ class CursorCircle:
31 31 """
32 32 Function to plot the circle
33 33 """
34   -
  34 +
35 35 disk = self.disk
36 36 disk.SetInnerRadius(self.radius-1) # filled = self.radius
37 37 disk.SetOuterRadius(self.radius) # filled = 0x
38 38 disk.SetRadialResolution(50)
39 39 disk.SetCircumferentialResolution(50)
40   -
  40 +
41 41 mapper = self.mapper
42 42 mapper.SetInput(disk.GetOutput())
43   -
  43 +
44 44 actor = self.actor
45 45 actor.SetMapper(mapper)
46 46 actor.GetProperty().SetOpacity(self.opacity)
... ... @@ -48,7 +48,7 @@ class CursorCircle:
48 48 actor.SetPosition(self.position)
49 49 actor.SetVisibility(1)
50 50 actor.PickableOff()
51   -
  51 +
52 52 def __calculate_area_pixels(self):
53 53 """
54 54 Return the cursor's pixels.
... ... @@ -62,7 +62,7 @@ class CursorCircle:
62 62 xs, ys, zs = self.spacing
63 63 orientation_based_spacing = {"AXIAL" : (xs, ys),
64 64 "SAGITAL" : (ys, zs),
65   - "CORONAL" : (xs, zs) }
  65 + "CORONAL" : (xs, zs)}
66 66 xs, ys = orientation_based_spacing[self.orientation]
67 67 self.pixel_list = []
68 68 radius = self.radius
... ... @@ -149,6 +149,8 @@ class CursorRectangle:
149 149  
150 150 self.dimension = (self.x_length, self.y_length)
151 151 self.position = (0 ,0)
  152 + self.orientation = "AXIAL"
  153 + self.spacing = (1, 1, 1)
152 154  
153 155 self.mapper = vtk.vtkPolyDataMapper()
154 156  
... ... @@ -229,7 +231,7 @@ class CursorRectangle:
229 231 retangle = self.retangle
230 232 retangle.SetXLength(self.x_length)
231 233 retangle.SetYLength(self.y_length)
232   -
  234 +
233 235 seeds_yi = self.seeds_yi
234 236 seeds_yi.SetPoint1(0, 0, 0)
235 237 seeds_yi.SetPoint2(0, self.y_length, 0)
... ... @@ -270,9 +272,14 @@ class CursorRectangle:
270 272 xc = 0
271 273 yc = 0
272 274 z = 0
  275 + xs, ys, zs = self.spacing
  276 + orientation_based_spacing = {"AXIAL" : (xs, ys),
  277 + "SAGITAL" : (ys, zs),
  278 + "CORONAL" : (xs, zs)}
  279 + xs, ys = orientation_based_spacing[self.orientation]
273 280 self.pixel_list = []
274   - for i in xrange(int(yc - self.y_length/2), int(yc + self.y_length/2)):
275   - for k in xrange(xc - self.x_length/2, xc + self.x_length/2):
  281 + for i in utils.frange(yc - self.y_length/2, yc + self.y_length/2, ys):
  282 + for k in utils.frange(xc - self.x_length/2, xc + self.x_length/2, xs):
276 283 self.pixel_list.append((k, i))
277 284  
278 285  
... ... @@ -292,4 +299,4 @@ class CursorRectangle:
292 299 "CORONAL": [px+(pixel_0/xs), py, pz+(pixel_1/zs)],
293 300 "SAGITAL": [px, py+(pixel_0/ys), pz+(pixel_1/zs)]}
294 301 yield abs_pixel[orient]
295   -
296 302 \ No newline at end of file
  303 +
... ...