def main(): Settings.init() default_radius = 2 default_height = 5 # Load in image and seeds filename = 'testdata.tif' img = tif.imread(filename) seedfilename = 'testdata_maxima_binary.tif' seeds = s.get_seeds(seedfilename) cylinder = cyl.Cylinder(default_radius, default_height) vis.render_gauss(cylinder) best_score, best_theta, best_psi = Optimize.optimize_angle(cylinder, seeds[257], img)
sign = [] H = [] exclude = [] Sectors = [] Bins = [] #------------------------------------------------------------------------- # DEFINE MINIMUM VALUE OF Z FOR THRESHOLD #------------------------------------------------------------------------- minZ = -1.4 #------------------------------------------------------------------------- # SECTORS DATA #------------------------------------------------------------------------- PGi = Seed.Seed() Snew = Seed.Seed() Sp = Seed.Seed() Test = Seed.Seed() #------------------------------------------------------------------------- # SANITY CHECK PARAMETERS #------------------------------------------------------------------------- printArrayInformation = True saveArrayInformation = True
if (new == False): # print('Min seed: ', minSeed.getId(), ' x: ', minSeed.getX(), ', y: ', minSeed.getY(), ' cx: ', cx, ', cy: ', cy) minSeed.fc = fc # ave_flow_count += 1 total_flow += (cy - minSeed.y) ave_flow_rate = total_flow / ave_flow_count # minSeed.updateCoords(cx, cy) minSeed.setPX(cx) #MLN NEW minSeed.setPY(cy) #MLN NEW #mln was 100 if (new == True) and (cy <= 600): p = Seed.MySeed(sid, cx, cy, max_seeds_num, fc) seeds.append(p) sid += 1 num_seeds += 1 ################################################################################## # output current seed count and seed positions # ################################################################################## for i in seeds: i.setState(1) if (i.fc < fc): if (i.getY() < 600) and (i.getX() < 2000) and (i.getY() > 0) and ( i.getX() > 0): px = i.getX() py = i.getY() + 30 # f1.write(str(i.tracks[-1][0]) + ", " + str(i.tracks[-1][1]) + " to " + str(i.getX()) + ", " + str(i.getY()) + " -> " + str(px) + ", " + str(py) + "\n")
minSeed.fc = fc # mark the seed as assigned to a contour ave_flow_count += 1 total_flow += (cy - minSeed.y) # distance traveled ave_flow_rate = total_flow / ave_flow_count ave_area_count += 1 total_area += int(area) ave_area = total_area / ave_area_count minSeed.updateCoords( cx, cy) # set the current x and y values of the seed if (new == True) and (cy <= down_limit): p = Seed.MySeed( sid, cx, cy, 8, fc) # create a new seed and append it to the list p.setPX(cx) p.setPY(cy) seeds.append(p) sid += 1 num_seeds += 1 ######################################################################## # output current seed count and seed positions # ######################################################################## for i in seeds: i.setState(1) if (i.fc < fc): if (i.getY() <= down_limit) and (i.getY() > 0) and (i.getX() > 0):
def seed(self, a=None): """Seed the golang.math.rand generator.""" if a is None: a = Now().UnixNano() Seed(a)
from Centroid import Centroid from Vec2 import Vec2 from random import random from math import * from angle import angle from Seed import * Seed() class Swarm(list): def __init__(self, count): self.speed = 1.0 / 16.0 self.paused = False def __new__(cls, count): swarm = list.__new__(cls) for n in range(count): x = random() - random() y = random() - random() c = Centroid(x, y) c.inertia = Vec2(0, 0) swarm.append(c) return swarm def repel(self, step): for i in range(1, len(self)):
minSeed.fc = fc ave_flow_count += 1 total_flow += (cy - minSeed.y) ave_flow_rate = total_flow / ave_flow_count ave_area_count += 1 total_area += int(area) ave_area = total_area / ave_area_count minSeed.updateCoords(cx, cy) #minSeed.setPX(cx) #MLN NEW #minSeed.setPY(cy) #MLN NEW if (new == True) and (cy <= 600): p = Seed.MySeed(sid, cx, cy, 8, fc) p.setPX(cx) p.setPY(cy) seeds.append(p) sid += 1 num_seeds += 1 ################################################################################## # output current seed count and seed positions # ################################################################################## for i in seeds: i.setState(1) if (i.fc < fc): if (i.getY() < 600) and (i.getX() < 2000) and ( i.getY() > 0) and (i.getX() > 0): px = i.getX()