Package SmootLight :: Package operationscore :: Module PixelAssembler
[hide private]
[frames] | no frames]

Source Code for Module SmootLight.operationscore.PixelAssembler

 1  from operationscore.SmootCoreObject import * 
 2  import util.Geo as Geo 
 3  import pdb 
4 -class PixelAssembler(SmootCoreObject):
5 - def init(self):
6 self.validateArgs('PixelAssembler.params') 7 self.initLayout()
8 - def layoutFunc(self, lastLocation): #Must be defined by inheriting class.
9 #Returns tuple pair (x,y) 10 pass
11 - def getPixelLocations(self): #returns a complete list of locations of Pixels
12 #for a strip 13 locations = [self.argDict['originLocation']] 14 for pixelIndex in range(self['numPixels']-1): #-1 because origin 15 #already exists 16 newLocation = self.layoutFunc(locations[-1]) 17 if newLocation == None: 18 raise Exception('Location cannot be null. layoutFunc not \ 19 defined or improperly defined.') 20 if Geo.dist(newLocation, locations[-1]) > \ 21 self['pixelToPixelSpacing']: 22 raise Exception('Illegal pixel location. Distance \ 23 between adjacent pixels must be less than \ 24 pixelToPixelSpacing. Illegal distance is between '+str(pixelIndex) + ' and'\ 25 + str(pixelIndex+1)) 26 locations.append(newLocation) 27 if self['Reverse']: 28 locations.reverse() 29 return locations
30 - def initLayout(self):
31 pass
32 - def getStripArgs(self): #TODO: triage and remove
33 return self.argDict 34