1from smilPython import *
2
3
4imIn = Image("https://smil.cmm.minesparis.psl.eu/images/DNA_small.png")
5imIn.show()
6
7imThr = Image(imIn)
8threshold(imIn, imThr)
9
10imLbl = Image(imIn, "UINT16")
11label(imThr, imLbl)
12imLbl.showLabel()
13
14
15bboxes = blobsBoundBox(imLbl)
16imRec = Image(imIn)
17drawRectangles(imRec, bboxes)
18imIn.getViewer().drawOverlay(imRec)
19
20
21blobs = computeBlobs(imLbl)
22
23areas = blobsArea(imLbl, blobs)
24
25barys = blobsBarycenter(imLbl, blobs)
26
27vols = blobsVolume(imIn, blobs)
28print("Label\tarea\tvolume\tbarycenter (x,y)")
29for lbl in blobs.keys():
30 print(str(lbl) + "\t" + str(areas[lbl]) + "\t" + str(vols[lbl]) + "\t" + str(barys[lbl]))
31