imgpath = '/Users/miura/Dropbox/people/julia/NucSegmentStudy/l5c1_350_CLAHE.tif' #imgpath = '/Users/miura/Dropbox/people/julia/NucSegmentStudy/L1CH2_maxp_300-374sampleframe.tif' #imgpath = '/Users/miura/Dropbox/people/julia/NucSegmentStudy/l5c1_CLAHE.tif' imp = IJ.openImage(imgpath) ntd = NucToDots(imp); #ntd.run() imp2 = ntd.preprocessCoreStack(imp) # for imp that is already stackCLAHEed. #for i in ntd.getXcoordA(): # print i imp2.show() print "Extracting Nucleus ..." #subwwhh = 110 # this must be guessed in the pre-run, by doing particle analysis and get the approximate sizes. en = NucleusExtractor(imp) #en.constructNodesByPA(imp2) ns = en.getPerNucleusBinImgProcessors(imp, imp2) # for i in range(10): # ImagePlus(str(i), ns.get(i).getBinip()).show() #print "x", ns.get(i).getOrgroi().getBounds().x, "y", ns.get(i).getOrgroi().getBounds().y #print "w", ns.get(i).getOrgroi().getBounds().width, "h", ns.get(i).getOrgroi().getBounds().height en.reassignNodes(ns); ''' #print 'node length before filtering: ' + str(en.getNodes().size()) #en.analyzeDotsandBinImages() #print 'node length after filtering: ' + str(en.getNodes().size())
#imgpath = '/Volumes/D/Julia20130201-/almfscreen/samples_112712/l3/l3c1.tif' #imgpath = '/Volumes/D/Julia20130201-/almfscreen/samples_112712/l4/l4c1.tif' imgpath = '/Volumes/D/Julia20130201-/almfscreen/samples_112712/l5/l5c1.tif' imp = IJ.openImage(imgpath) ntd = NucToDots(imp); ntd.run() # runs CLAHE first, takes a bit of time. #ntd.runmain() # for imp that is already stackCLAHEed. #for i in ntd.getXcoordA(): # print i print "Extracting Nucleus ..." subwwhh = 130 # this must be guessed in the pre-run, by doing particle analysis and get the approximate sizes. WATERSHED_THRESHOLD = 0.10; en = NucleusExtractor(imp, ntd.getXcoordA(), ntd.getYcoordA(), ntd.getFrameA()) en.constructNodesByDots(subwwhh, WATERSHED_THRESHOLD) print 'node length before filtering: ' + str(en.getNodes().size()) en.analyzeDotsandBinImages() print 'node length after filtering: ' + str(en.getNodes().size()) nodes = en.getNodes() ''' stk = ImageStack(subwwhh, subwwhh) for n in nodes: binip = n.getBinip() stk.addSlice(binip) ImagePlus("tt", stk).show() '''
#maximp = NucToDots(imp).run() #maximp.show() ntd = NucToDots(imp); ntd.run() subwwhh = 120 # size of sub image # from here is the extraction ''' nrp = NRP() nrp.getPerNucleusBinImgProcessors(imp, subwwhh, ntd.getXcoordA(), ntd.getYcoordA(), ntd.getFrameA()) stk = nrp.getBinStack(); ''' en = NucleusExtractor(imp, ntd.getXcoordA(), ntd.getYcoordA(), ntd.getFrameA()) en.constructNodes(subwwhh) en.analyzeDotsandBinImages() nodes = en.getNodes() stk = ImageStack(subwwhh, subwwhh) for n in nodes: binip = n.getBinip() stk.addSlice(binip) ''' stk = ImageStack(subwwhh, subwwhh) for i, f in enumerate(ntd.getFrameA()): ip = imp.getStack().getProcessor(f) roi = nrp.makeRoi(ip, ntd.getXcoordA()[i], ntd.getYcoordA()[i], subwwhh, subwwhh) subip = nrp.extract(ip, roi) binip = nrp.binarize(subip)