from log_parser import LogParser from cluster import Cluster, NodeFactory from converter import LogsToEventsConverter from events import EventLoop N = 4 WIDTH = HEIGHT = 600 TITLE = "Fast Paxos" LOGFILE = "../../../logs/test.log" factory = NodeFactory((20, 20), 8) cluster = Cluster(TITLE, N, (WIDTH, HEIGHT), factory) loop = EventLoop() logs = LogParser.parse(LOGFILE) converter = LogsToEventsConverter(cluster, loop) converter.convert(logs) loop.run() cluster.close()
### Segmentation Phase ### # 2 - Full dataset initial segmentation (see notes above) [memseg.add(('hnsWatershed', pb, wl if wl else wl_file, iseg), pb if wl else (pb, wl_file), iseg, 'waterlevel') for pb, iseg in izip(f_p_blur, f_is1)] # 3 - Training initial segmentation (pre-merging) (see notes above) [memseg.add(('hnsMerge', iseg1, pb, areaThreshold0, areaThreshold1, probThreshold, iseg2), (iseg1, pb), iseg2, ('pm-area-threshold-0', 'pm-area-threshold-1', 'pm-prob-threshold')) for iseg1, pb, iseg2 in izip(f_is1, f_p_blur, f_is2)] # 4 - Full dataset merge generation [memseg.add(('hnsGenMerges', iseg, pb, t, s), (iseg, pb), (t, s)) for iseg, pb, t, s in izip(f_is2, f_p_blur, f_tree, f_sal)] # 5 - Full dataset boundary feature generation (see notes above) [memseg.add(('hnsGenBoundaryFeatures', iseg, t, s, db, p, textondict, bcf), (iseg, t, s, db, p, textondict), bcf, can_run_on_cluster=True) for iseg, t, s, db, p, bcf in izip(f_is2, f_tree, f_sal, f_d_blur, f_p_mha, f_bcf)] # 8 - Generate Predictions rf_predict_procs(memseg, bcmodel, f_bcf, f_bcp) # 9 - Segment # Defaults used: # [4] labelOutputBinaryImageConnectedComponents -> 1 (must be 1) # [5] writeToUInt16Image -> 0 (means write uint32 label image which is what we want) [memseg.add(('hnsSegment', iseg, t, bcp, fseg), (iseg, t, bcp), fseg) for iseg, t, bcp, fseg in izip(f_is2, f_tree, f_bcp, f_fs)] ### Convert output files ### [memseg.add(('hnsGenOrderedContours', fseg, z, sp), fseg, sp) for fseg, z, sp in izip(f_fs, zs_f, seg_pts)] memseg.add(['combine_points',] + seg_pts + [seg_pts_all,], seg_pts, seg_pts_all) # TODO: -im and pixel spacing? memseg.add(('point2model', '-im', mrc_f_filename, seg_pts_all, mod_output), (mrc_f_filename,seg_pts_all), mod_output) # Run! memseg.run(cluster=cluster, verbose=True) # Cleanup if cluster: cluster.close()