コード例 #1
0
ファイル: extractKeyFrames.py プロジェクト: cmci/DotLinker
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()
'''

IJ.log('Linking ...')
コード例 #2
0
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)
    stk.addSlice(binip)
'''
ImagePlus("res", stk).show()