Script execution
This commit is contained in:
@@ -56,53 +56,26 @@ renderer = show_panel(ip.bufferedImage)
|
||||
|
||||
#renderer = show_panel(op.bufferedImage)
|
||||
#line.show()
|
||||
vals = []
|
||||
for i in range (180):
|
||||
ydata = []
|
||||
xdata = range (0,180,2)
|
||||
for i in xdata:
|
||||
l = line.duplicate()
|
||||
l.getProcessor().setBackgroundValue(0.0)
|
||||
l.getProcessor().rotate(float(i))
|
||||
op = op_fft(ip, l, "correlate")
|
||||
bi = op.getBufferedImage()
|
||||
p = integrateVertically(bi)
|
||||
vals.append(sum(p))
|
||||
ydata.append(sum(p))
|
||||
|
||||
#renderer = show_panel(op.bufferedImage)
|
||||
#time.sleep(0.001)
|
||||
p = plot(vals)[0]
|
||||
p = plot(ydata)[0]
|
||||
|
||||
|
||||
peaks = estimate_peak_indexes(ydata, xdata, (min(ydata) + max(ydata))/2, 25.0)
|
||||
print "Peak indexes: " + str(map(lambda x:xdata[x], peaks))
|
||||
print "Peak values: " + str(map(lambda x:ydata[x], peaks))
|
||||
|
||||
threshold = (min(vals) + max(vals))/2
|
||||
min_peak_distance = 10.0
|
||||
xdata=Arr.indexesInt(len(vals))
|
||||
|
||||
peaks = estimate_peak_indexes(vals, xdata, threshold, min_peak_distance)
|
||||
print "Peak indexes: " + str(peaks)
|
||||
print "Peak x: " + str(map(lambda x:xdata[x], peaks))
|
||||
print "Peak y: " + str(map(lambda x:vals[x], peaks))
|
||||
|
||||
gaussians = fit_gaussians(vals, xdata, peaks)
|
||||
|
||||
for i in range(len(peaks)):
|
||||
peak = peaks[i]
|
||||
(normalization, mean_val, sigma) = gaussians[i]
|
||||
if abs(mean_val - xdata[peak]) < min_peak_distance:
|
||||
print "Peak -> " + str(mean_val)
|
||||
p.addMarker(mean_val, None, "N="+str(round(normalization,2)), Color(210,0,0))
|
||||
else:
|
||||
print "Invalid gaussian fit: " + str(mean_val)
|
||||
|
||||
|
||||
#image_fft(ip)
|
||||
|
||||
|
||||
|
||||
"""
|
||||
(r,output) = analyse_particles(ip, 200000,500000,
|
||||
fill_holes = True, exclude_edges = False, print_table=True,
|
||||
output_image = "outlines", minCirc = 0.3
|
||||
, maxCirc = 1.0)
|
||||
|
||||
|
||||
show_panel(output.bufferedImage)
|
||||
"""
|
||||
p.addMarker(peaks[i], None, "N="+str(round(peaks[i],2)), Color(80,0,80))
|
||||
Reference in New Issue
Block a user