Project

General

Profile

Anomalie #53 ยป pb_volume.py

Beatriz Marcotegui, 01/20/2009 02:23 PM

 
1

    
2

    
3

    
4
from morphee import *
5
from __main__ import *
6

    
7
nl = SquareSE
8

    
9
def GenerateHierarchy(imin,nl):
10
	imGrad = ImCreateSame( imin )
11
	ImMorphoGradient( imin, nl, imGrad )
12

    
13
	imMin=ImCreateSame(imGrad)
14
	ImMinima( imGrad, nl, imMin )
15
	imMarkers = ImCreateSame( imMin, "UINT16" ) # 32 si vraiment bcp labels
16
	ImLabel( imMin, nl, imMarkers )
17

    
18
	imFineSeg = ImCreateSame( imMarkers)
19
	MSTVol=ImHierarchicalSegmentation( imGrad, imMarkers, nl, HierarchicalSegmentationType.Volumic, imFineSeg)
20

    
21
	return MSTVol, imFineSeg
22
# ......................................................................
23
# 	READ ORI
24
# ......................................................................
25

    
26
im= fileRead(images_dir+"\\Gray\\cameraman.png")
27

    
28
# ......................................................................
29
# 	ALLOCATE AUXILIARY IMAGES
30
# ......................................................................
31
imFil = getSame(im)
32
imMark = getSame(im)
33
imRes = getSame(im)
34

    
35

    
36
MST,imFineSeg= GenerateHierarchy(im,nl)
37

    
38
print MST.getEdgesListAndWeights()
39

    
40
imSeg=ImCreateSame(imFineSeg)
41
ImCompare(imFineSeg,"==",(1759 +1),255,0,imSeg)
42
ImCompare(imFineSeg,"==",(1804 +1),255,imSeg,imSeg)
43
ImDisplayX(imSeg)
    (1-1/1)