Beispiel #1
0
#ntd = NucToDots(imp)
#ntd.stackCLAHE(imp)
#imp.show()
#ppimp =ntd.preprocess(imp) 
#ppimp.show()

#maximp = NucToDots(imp).run()
#maximp.show()

ntd = NucToDots(imp);
ntd.run()
for i in ntd.getXcoordA():
        print i
        
IJ.log('test ')
dlh = DLH(imp, 2, 15) # linkrange, distance
# becareful with the swapped X and Y axis
#dlh.setData(jarray.array(ntd.getXcoords(), 'i'), jarray.array(ntd.getYcoords(), 'i'),  jarray.array(ntd.getFrame(), 'i'))
dlh.setData(ntd.getXcoordA(), ntd.getYcoordA(),  ntd.getFrameA())
nearestneighbor = LinkCostsOnlyDistance()
dlh.doLinking(nearestneighbor, False)
# convert to Tracks object
tracks = VecTrajectoryToTracks().runsimple(dlh.getAll_traj())
tracks.accept(TrackReLinker())

# plotting part
vd = VD(imp)
#img2path = '/Volumes/D/Julia20130201-/NucleusSegmentationStudy/20130312/out_bernsen45.tif'
#outimp = IJ.openImage(img2path)
#vd.plotTracks(outimp)
Beispiel #2
0
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 ...')
dlh = DLH(imp, 3, 10) # linkrange, distance
#dlh.setData(ntd.getXcoordA(), ntd.getYcoordA(),  ntd.getFrameA())
dlh.setData(nodes) # a new way, 20130321
nearestneighbor = LinkCostsOnlyDistance()
dlh.doLinking(nearestneighbor, False)

# convert to Tracks object
vttt = VecTrajectoryToTracks()
#vttt.run(dlh.getAll_traj())
vttt.run(dlh.getAll_traj(), nodes)
tracks = vttt.getTracks()
print "tracks", str(tracks.size())
for t in tracks.values():
    #print t.getTrackID(), t.getNodes().get(0).getX(), t.getNodes().size(), t.getFrameStart()
    print t.getNodes().get(0).getOrgroi()
tracks.accept(TrackReLinker())
    for i in range(len(xpA)):
        # frame number starts from 1
        fulltA.append(j+1)

    # from here is just to test. 
    pointlist = []
    for i in range(len(xpA)):
        pointlist.append(Point(i, xpA[i], ypA[i], j))
        #pointlist.append(Nuc2D(xpA[i], ypA[i], j, i))
    if j < 4:
        print str(j), len(pointlist)
    #print pointlist[3].x
    frames.append(pointlist)

IJ.log('test ')
dlh = DLH(imp, 2, 15) # linkrange, distance
# becareful with the swapped X and Y axis
dlh.setData(jarray.array(fullxA, 'i'), jarray.array(fullyA, 'i'),  jarray.array(fulltA, 'i'))
nearestneighbor = LinkCostsOnlyDistance()
dlh.doLinking(nearestneighbor, False)
# convert to Tracks object
tracks = VecTrajectoryToTracks().runsimple(dlh.getAll_traj())
tracks.accept(TrackReLinker())

# plotting part
vd = VD(imp)
img2path = '/Volumes/D/Julia20130201-/NucleusSegmentationStudy/20130312/out_bernsen45.tif'
outimp = IJ.openImage(img2path)
#vd.plotTracks(outimp)
vd.plotTracks(tracks, outimp)