Carotid artery 2D demo - Max-tree signature

MainPage

 1 from iamxt import MaxTreeAlpha
 2 import numpy as np
 3 import ia870
 4 import ia636
 5 
 6 
 7 img = adreadgray(find_attachment_file('homeroberto/carotid_demo/carotid_slice.png'))
 8 
 9 Bc = np.zeros((3,3),dtype = bool)
10 Bc[1,:] = True
11 Bc[:,1] = True
12 mxt = MaxTreeAlpha(img,Bc)
13 adshow(img, "Original Image (%d shapes, %d maxima)" %(mxt.node_array.shape[1],(mxt.node_array[1,:] == 0).sum()))
14 
15 A = mxt.node_array[3,:]
16 ext = mxt.computeExtinctionValues(A,"area")
17 leaf = argsort(ext)[::-1]
18 rc = leaf[11]
19 lc = leaf[28]
20 
21 rc_cc = mxt.recConnectedComponent(rc)
22 rc_cc = ia870.iadil(rc_cc,ia870.iasedisk(5))
23 
24 
25 lc_cc = mxt.recConnectedComponent(lc)
26 lc_cc = ia870.iadil(lc_cc,ia870.iasedisk(5))
27 
28 img2 = ia870.iagshow(img,lc_cc,rc_cc)
29 adshow(img2,'2 Regional maxima selected')
30 
31 to_keep = np.zeros(mxt.node_array.shape[1],dtype = bool)
32 anc1 = mxt.getAncestors(rc)
33 anc2 = mxt.getAncestors(lc)
34 to_keep[anc1] = True
35 to_keep[anc2] = True
36 mxt.contractDR(to_keep)
37 
38 
39 cc_graph = mxt.generateCCGraph(parent_scale = True)
40 mmgraphviz(cc_graph, title='simplified max-tree')

Original Image (43368 shapes, 15571 maxima)

2 Regional maxima selected

/media/_xsb/iamxt/carotid_signature/GRVIZ83023_001.png

simplified max-tree