From 74706f4e642b423c4bac41279797154251f246c0 Mon Sep 17 00:00:00 2001 From: tfmoraes Date: Thu, 23 Jul 2009 14:02:00 +0000 Subject: [PATCH] ENH: The gaps in the RectangleCursor was filled --- invesalius/data/cursor_actors.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/invesalius/data/cursor_actors.py b/invesalius/data/cursor_actors.py index 566f72d..b94aea6 100644 --- a/invesalius/data/cursor_actors.py +++ b/invesalius/data/cursor_actors.py @@ -31,16 +31,16 @@ class CursorCircle: """ Function to plot the circle """ - + disk = self.disk disk.SetInnerRadius(self.radius-1) # filled = self.radius disk.SetOuterRadius(self.radius) # filled = 0x disk.SetRadialResolution(50) disk.SetCircumferentialResolution(50) - + mapper = self.mapper mapper.SetInput(disk.GetOutput()) - + actor = self.actor actor.SetMapper(mapper) actor.GetProperty().SetOpacity(self.opacity) @@ -48,7 +48,7 @@ class CursorCircle: actor.SetPosition(self.position) actor.SetVisibility(1) actor.PickableOff() - + def __calculate_area_pixels(self): """ Return the cursor's pixels. @@ -62,7 +62,7 @@ class CursorCircle: xs, ys, zs = self.spacing orientation_based_spacing = {"AXIAL" : (xs, ys), "SAGITAL" : (ys, zs), - "CORONAL" : (xs, zs) } + "CORONAL" : (xs, zs)} xs, ys = orientation_based_spacing[self.orientation] self.pixel_list = [] radius = self.radius @@ -149,6 +149,8 @@ class CursorRectangle: self.dimension = (self.x_length, self.y_length) self.position = (0 ,0) + self.orientation = "AXIAL" + self.spacing = (1, 1, 1) self.mapper = vtk.vtkPolyDataMapper() @@ -229,7 +231,7 @@ class CursorRectangle: retangle = self.retangle retangle.SetXLength(self.x_length) retangle.SetYLength(self.y_length) - + seeds_yi = self.seeds_yi seeds_yi.SetPoint1(0, 0, 0) seeds_yi.SetPoint2(0, self.y_length, 0) @@ -270,9 +272,14 @@ class CursorRectangle: xc = 0 yc = 0 z = 0 + xs, ys, zs = self.spacing + orientation_based_spacing = {"AXIAL" : (xs, ys), + "SAGITAL" : (ys, zs), + "CORONAL" : (xs, zs)} + xs, ys = orientation_based_spacing[self.orientation] self.pixel_list = [] - for i in xrange(int(yc - self.y_length/2), int(yc + self.y_length/2)): - for k in xrange(xc - self.x_length/2, xc + self.x_length/2): + for i in utils.frange(yc - self.y_length/2, yc + self.y_length/2, ys): + for k in utils.frange(xc - self.x_length/2, xc + self.x_length/2, xs): self.pixel_list.append((k, i)) @@ -292,4 +299,4 @@ class CursorRectangle: "CORONAL": [px+(pixel_0/xs), py, pz+(pixel_1/zs)], "SAGITAL": [px, py+(pixel_0/ys), pz+(pixel_1/zs)]} yield abs_pixel[orient] - \ No newline at end of file + -- libgit2 0.21.2