Пример #1
0
def fromVolumeFile(filename, options):
    img = VolumeImage(filename)
    morse = VectorField(img,
                        threshold = options.threshold,
                        filename = options.field)

    if options.morse:
        printMorseBoundary(morse, img)

    dim = lambda v: img.cellDimension(v)
    val = lambda v: img.scalarForCell(v) if v else infinity
    idx = lambda v: img.index(v) if v else -1

    weights = dict((tuple(v), x) for v, x in morse.weights())

    return tuple((val(v), val(w), dim(v), idx(v), v, idx(w), w, weights.get(tuple(v), 0))
                 for v, w in morse.birthsAndDeaths())
Пример #2
0
def fromVolumeFile(filename, options):
    img = VolumeImage(filename)
    morse = VectorField(img,
                        threshold=options.threshold,
                        filename=options.field)

    if options.morse:
        printMorseBoundary(morse, img)

    dim = lambda v: img.cellDimension(v)
    val = lambda v: img.scalarForCell(v) if v else infinity
    idx = lambda v: img.index(v) if v else -1

    weights = dict((tuple(v), x) for v, x in morse.weights())

    return tuple((val(v), val(w), dim(v), idx(v), v, idx(w), w,
                  weights.get(tuple(v), 0))
                 for v, w in morse.birthsAndDeaths())