コード例 #1
0
ファイル: testmap.py プロジェクト: hmeine/geomap
import map as spmap, maputils

print "\n- creating Map from maxima2/flowlines2..."
execfile("testSPWS")
pythonMap = spmap.GeoMap(maxima2, flowlines2, Size2D(39, 39))
pythonMap.sortEdgesEventually(0.2, 0.05)
pythonMap.initializeMap()

if pythonMap.unsortable:
    sys.stderr.write(
        "### UNSORTABLE HANDLING NOT DONE IN C++ YET, SKIPPING...\n")
else:
    cppmap = geomap.GeoMap([], [], Size2D(39, 39))
    cppnodes = [node and cppmap.addNode(node) for node in maxima2]
    assert cppnodes[-1].label() == len(maxima2) - 1, "Oops, label shift :-("
    maputils.addFlowLinesToMap(flowlines2, cppmap)
    cppmap.sortEdgesEventually(0.2, 0.05)
    cppmap.initializeMap()

# --------------------------------------------------------------------

print "\n- checking C++ sigma sorting against python one..."
execfile("maptest.py")
e = Experiment(filename, "grad")
gradientScale = 1.4
threshold = 0.05
e.performEdgeSplits = False
e.performBorderClosing = False
e("map")
checkConsistency(e.map)
コード例 #2
0
Size2D = Vector2

from geomap import GeoMap, contourPoly
#from map import GeoMap
execfile("testSPWS")

# --------------------------------------------------------------------
# 				flowline map creation / face.contains
# --------------------------------------------------------------------

# The following data contains edges that run out of the image range,
# which ATM leads to overlapping edges after border closing. That
# violates some assumptions and would lead to errors if we actually
# worked with that Map.
map = GeoMap(maxima2, [], Size2D(39, 39))
maputils.addFlowLinesToMap(flowlines2, map)
assert map.checkConsistency(), "graph inconsistent"
map.sortEdgesEventually(stepDist = 0.2, minDist = 0.05)
map.splitParallelEdges()
map.initializeMap()
assert map.checkConsistency(), "map inconsistent"
assert maputils.checkLabelConsistency(map), "map.labelImage() inconsistent"

# merge faces so that survivor has a hole:
hole = map.faceAt((16,17))
assert hole.contains((16,17))
assert contourPoly(hole.contour()).contains((16,17))

dart = hole.contour()
while True:
    while dart.startNode().hasMinDegree(3):
コード例 #3
0
import map as spmap, maputils

print "\n- creating Map from maxima2/flowlines2..."
execfile("testSPWS")
pythonMap = spmap.GeoMap(maxima2, flowlines2, Size2D(39, 39))
pythonMap.sortEdgesEventually(0.2, 0.05)
pythonMap.initializeMap()

if pythonMap.unsortable:
    sys.stderr.write("### UNSORTABLE HANDLING NOT DONE IN C++ YET, SKIPPING...\n")
else:
    cppmap = geomap.GeoMap([], [], Size2D(39, 39))
    cppnodes = [node and cppmap.addNode(node) for node in maxima2]
    assert cppnodes[-1].label() == len(maxima2)-1, "Oops, label shift :-("
    maputils.addFlowLinesToMap(flowlines2, cppmap)
    cppmap.sortEdgesEventually(0.2, 0.05)
    cppmap.initializeMap()

# --------------------------------------------------------------------

print "\n- checking C++ sigma sorting against python one..."
execfile("maptest.py")
e = Experiment(filename, "grad")
gradientScale = 1.4
threshold = 0.05
e.performEdgeSplits = False
e.performBorderClosing = False
e("map")
checkConsistency(e.map)
コード例 #4
0
ファイル: test_spws.py プロジェクト: hmeine/geomap
Size2D = Vector2

from geomap import GeoMap, contourPoly
#from map import GeoMap
execfile("testSPWS")

# --------------------------------------------------------------------
# 				flowline map creation / face.contains
# --------------------------------------------------------------------

# The following data contains edges that run out of the image range,
# which ATM leads to overlapping edges after border closing. That
# violates some assumptions and would lead to errors if we actually
# worked with that Map.
map = GeoMap(maxima2, [], Size2D(39, 39))
maputils.addFlowLinesToMap(flowlines2, map)
assert map.checkConsistency(), "graph inconsistent"
map.sortEdgesEventually(stepDist=0.2, minDist=0.05)
map.splitParallelEdges()
map.initializeMap()
assert map.checkConsistency(), "map inconsistent"
assert maputils.checkLabelConsistency(map), "map.labelImage() inconsistent"

# merge faces so that survivor has a hole:
hole = map.faceAt((16, 17))
assert hole.contains((16, 17))
assert contourPoly(hole.contour()).contains((16, 17))

dart = hole.contour()
while True:
    while dart.startNode().hasMinDegree(3):