def writeCSV(filePath, results, header): """ Write a table as an csv file """ rt = ResultsTable() for i in range(len(results[1])): rt.incrementCounter() for j in range(len(results)): rt.addValue(str(header[j]), results[j][i]) rt.show("Results") rt.saveAs(filePath);
#print allPearson #print average(allPearson) ort.show("Distance map") ort2.show("Point measurements") """ Saving the Results tables: Result tables will be saved to the directory specified in "savepath" """ dataname = imp_orig.getShortTitle() if automatic_save_results: # Gather filenames of the savedirectory filename_ort = dataname + "_Distance_Map_001.csv" savename_ort = savepath + "/" + filename_ort # Generate complete savepath print savename_ort ort.saveAs(savename_ort) # save # Gather filenames of the savedirectory # Gather filenames of the savedirectory filename_ort2 = dataname + "_PointMeasurements_001.csv" savename_ort2 = savepath + "/" + filename_ort2 # Generate complete savepath print savename_ort2 ort2.saveAs(savename_ort2) # save IJ.run(imp, "Select None", "") imp.changes = False
rm.runCommand("reset") time.sleep(0.5) ort = ResultsTable() ort.setPrecision(2) ort.incrementCounter() ort.addValue("Channel1", Channel1_count) ort.addValue("Channel2", Channel2_count) ort.addValue("Channel3", Channel3_count) ort.addValue("Channel4", Channel4_count) ort.show("Results") if automatic_save_results: dataname = imp1.getTitle() filename = dataname + ".csv" #files = glob.glob(savepath+"/"+dataname+"*.csv") savename = savepath + "/" + filename ort.saveAs(savename) Channel1.changes = False Channel1.close() Channel2.changes = False Channel2.close() Channel3.changes = False Channel3.close() Channel4.changes = False Channel4.close() imp1.close()