def neurons_by_pose(self, poseinfo): pneurons = [] for n in self.neurons: pn_pos = poselib.projTranslateByBb(poselib.projCoord(n["pos"], poseinfo), self.bbpoints, n["name"], poseinfo) if pn_pos is None: continue pn = n.copy() pn["pos"] = pn_pos pn["diameter"] = poselib.projDiameter(n["diameter"], poseinfo) pneurons.append(pn) return pneurons
def draw_uvframe_neurons(uvframe, bbpoints, neurons, poseinfo, title): # Draw the image with neuron locations interposed f = plt.figure(title) imgplot = plt.imshow(uvframe, cmap=plt.cm.gray) ax = f.add_subplot(111) for p in bbpoints: pos = [p[0,1], p[0,0]] ax.add_patch(matplotlib.patches.Circle(pos, radius = 0.5, edgecolor = 'yellow', fill = 0)) for n in neurons: pos = poselib.projTranslateByBb(poselib.projCoord(n["pos"], poseinfo), bbpoints, n["name"], poseinfo) if pos is None: continue r = poselib.projDiameter(n["diameter"], poseinfo) / 2. print "showing", n["name"], "pos", pos, "r", r ax.add_patch(matplotlib.patches.Circle(pos, radius = r / 10., edgecolor = 'green', fill = 0)) ax.annotate(n["name"], xy = pos, color = 'green') plt.show()