Пример #1
0
	def exportTransformedCoordinates_triggered(self):
		'''export coordinate file list of tranformed points for all layers'''
		for i in xrange(1,self.ui.fileWidget.count()):
			listItem = self.ui.fileWidget.item(i)
			filename = listItem.data(QtCore.Qt.DisplayRole).toString()
			name = QtCore.QFileInfo(filename).fileName() # without path
			newfilename = QtGui.QFileDialog.getSaveFileName(self.main_window, "Save Coordinate List %s" % name, filter="Coordinate List (*.txt)")
			if not newfilename.contains('.'):
				newfilename += ".txt" # add default extension
			dimensions, points = coords.readfile(filename)
			p_transformed = self.transformcontroller.doTransform(points[:,0:2], i)
			points[:,0:2] = p_transformed
			coords.writefile(newfilename, dimensions[0:2], points)
	beadMeans, beadScatter = detectBeads(dims, cc)

	print "number of beads: ", len(beadMeans)
	#~ print singleConsidered, "single detections considered."
	#~ print skipped, "beads skipped."
	print "mean variance: %f" % (np.mean(beadScatter, axis=0)[1])

	#plot:
	import matplotlib.pyplot as plt
	xx,yy=np.hsplit(np.array(beadScatter),np.array([1]))
	plt.plot(xx,yy,'rx')
	plt.xlabel('Beat Intensity')
	plt.ylabel('stddev of detected position')
	plt.title('STORM: localisation precision at different beat intensities')
	plt.ylabel('stddev of detected position')
	plt.savefig(filename+"_beadVariance.png")

	plt.figure()
	xx,yy=np.hsplit(np.array(beadMeans),np.array([1]))
	plt.plot(xx,yy,'ro')
	plt.title(filename)
	plt.xlabel('x')
	plt.ylabel('y')
	plt.savefig(filename+"_beads.png")
	plt.show()

	if len(beadMeans) > 0:
		meanData_np = np.array(beadMeans)
		outData = np.hstack([meanData_np, np.arange(len(meanData_np)).reshape(-1,1)]) # add index column
		coord2im.writefile(filename+"_beads.txt", dims, outData)