From d7fa8b4f2eb9e9ee0891f6c2552e64d98db8c1a9 Mon Sep 17 00:00:00 2001 From: tatiana Date: Mon, 20 Jul 2009 18:38:48 +0000 Subject: [PATCH] ENC: Inserted frange inside utils --- invesalius/data/cursor_actors.py | 32 +++++--------------------------- invesalius/data/viewer_slice.py | 5 ++++- invesalius/utils.py | 23 ++++++++++++++++++++++- 3 files changed, 31 insertions(+), 29 deletions(-) diff --git a/invesalius/data/cursor_actors.py b/invesalius/data/cursor_actors.py index b7bcf54..998aba8 100644 --- a/invesalius/data/cursor_actors.py +++ b/invesalius/data/cursor_actors.py @@ -1,28 +1,6 @@ from math import * - import vtk - -def frange(start, end=None, inc=None): - "A range function, that does accept float increments..." - - if end == None: - end = start + 0.0 - start = 0.0 - - if inc == None: - inc = 1.0 - - L = [] - while 1: - next = start + len(L) * inc - if inc > 0 and next >= end: - break - elif inc < 0 and next <= end: - break - L.append(next) - - return L - +import utils class CursorCircle: # TODO: Think and try to change this class to an actor @@ -51,8 +29,8 @@ class CursorCircle: """ disk = self.disk - disk.SetInnerRadius(self.radius) - disk.SetOuterRadius(0) # filled + disk.SetInnerRadius(self.radius-1) # filled = self.radius + disk.SetOuterRadius(self.radius) # filled = 0x disk.SetRadialResolution(50) disk.SetCircumferentialResolution(50) @@ -84,7 +62,7 @@ class CursorCircle: xs, ys = orientation_based_spacing[self.orientation] self.pixel_list = [] radius = self.radius - for i in frange(yc - radius, yc + radius, ys): + for i in utils.frange(yc - radius, yc + radius, ys): # distance from the line to the circle's center d = yc - i # line size @@ -94,7 +72,7 @@ class CursorCircle: # line final xf = line/2 + xc yi = i - for k in frange(xi,xf,xs): + for k in utils.frange(xi,xf,xs): self.pixel_list.append((k, yi)) def SetSize(self, radius): diff --git a/invesalius/data/viewer_slice.py b/invesalius/data/viewer_slice.py index 9a13c79..a8088b0 100755 --- a/invesalius/data/viewer_slice.py +++ b/invesalius/data/viewer_slice.py @@ -269,7 +269,10 @@ class Viewer(wx.Panel): def SetInput(self, imagedata): self.imagedata = imagedata - + + print "************************************" + print "spacing:", imagedata.GetSpacing() + print "************************************" ren = self.ren interactor = self.interactor diff --git a/invesalius/utils.py b/invesalius/utils.py index 02c96da..b16d0e7 100755 --- a/invesalius/utils.py +++ b/invesalius/utils.py @@ -60,4 +60,25 @@ class TwoWaysDictionary(dict): """ Find the value given a key. """ - return self[key] \ No newline at end of file + return self[key] + +def frange(start, end=None, inc=None): + "A range function, that accepts float increments." + + if end == None: + end = start + 0.0 + start = 0.0 + + if inc == None: + inc = 1.0 + + L = [] + while 1: + next = start + len(L) * inc + if inc > 0 and next >= end: + break + elif inc < 0 and next <= end: + break + L.append(next) + + return L \ No newline at end of file -- libgit2 0.21.2