SMIL  0.8
 All Classes Functions Variables Groups Pages
interactive_segmentation.py

1 from smilPython import *
2 
3 
4 im1 = Image("http://cmm.ensmp.fr/~faessel/smil/images/tools.png")
5 im2 = Image(im1)
6 im3 = Image(im1)
7 im4 = Image(im1)
8 imOverl = Image(im1)
9 
10 gradient(im1, im2)
11 
12 im1.show()
13 im3.show()
14 im4.showLabel()
15 
16 v = im1.getViewer()
17 
18 class slot(EventSlot):
19  def run(self, event=None):
20  v.getOverlay(imOverl)
21  watershed(im2, imOverl, im3, im4)
22 
23 s = slot()
24 
25 v.onOverlayModified.connect(s)
26 v.onOverlayModified.trigger()
27 
28 
29 print("1) Right click on im1")
30 print("2) In the \"Tools\" menu select \"Draw\"")
31 print("3) Draw markers (with different colors) on im1 and view the resulting segmentation")
32 
33 # Will crash if not in a "real" Qt loop
34 Gui.execLoop()
35