def back():
    print(voreen.getPropertyValue(processor, cameraProp))
    initCam = ((70, -150, 80), (70.0, 60.0, 80), (0.0, 0.0, -1.0))
    voreen.setPropertyValue(processor, cameraProp, initCam)
    voreen.repaint()
    voreenqt.processEvents()
    # start loop for animation
    counter = 0
    angleIncr = 2 * math.pi / frames  # do a full rotation
    start = time.time()
    while (counter < frames):
        counter = counter + 1
        # update camera for current frame
        voreen.rotateCamera(processor, cameraProp, angleIncr, rotAxis)
        # render network state
        voreen.repaint()
    end = time.time()
Example #2
0
def benchmark():
    # store current canvas size and camera settings
    prevDim = voreen.getPropertyValue(canvas, "canvasSize")
    prevCam = voreen.getPropertyValue(processor, cameraProp)

    # resize canvas and initialize camera
    voreen.setPropertyValue(canvas, "canvasSize", canvasDim)
    voreen.setPropertyValue(processor, cameraProp, initCam)
    voreen.repaint()

    # make sure all Qt events have been processed before starting
    voreenqt.processEvents()

    # start loop for animation
    counter = 0
    angleIncr = 2 * math.pi / frames  # do a full rotation
    start = time.time()
    while (counter < frames):
        counter = counter + 1

        # update camera for current frame
        voreen.rotateCamera(processor, cameraProp, angleIncr, rotAxis)

        # render network state
        voreen.repaint()
    end = time.time()

    # restore canvas and camera
    voreen.setPropertyValue(canvas, "canvasSize", prevDim)
    voreen.setPropertyValue(processor, cameraProp, prevCam)
    voreen.repaint()

    # evaluate results
    runtime = (end - start)
    if runtime > 0:
        fps = frames / runtime
    else:
        fps = -1

    message = 'frames: %i\n' % (frames)
    message += 'total runtime: %f\n' % (runtime)
    message += 'fps: %f' % (fps)
    print message
    voreenqt.messageBox("Finished!\n" + message)
Example #3
0
def benchmark():
    # store current canvas size and camera settings
    prevDim = voreen.getPropertyValue(canvas, "canvasSize")
    prevCam = voreen.getPropertyValue(processor, cameraProp)

    # resize canvas and initialize camera
    voreen.setPropertyValue(canvas, "canvasSize", canvasDim)
    voreen.setPropertyValue(processor, cameraProp, initCam)
    voreen.repaint()

    # make sure all Qt events have been processed before starting
    voreenqt.processEvents()  

    # start loop for animation
    counter = 0
    angleIncr = 2*math.pi / frames  # do a full rotation
    start = time.time()
    while (counter < frames):
        counter = counter + 1

        # update camera for current frame
        voreen.rotateCamera(processor, cameraProp, angleIncr, rotAxis)

        # render network state
        voreen.repaint()
    end = time.time()

    # restore canvas and camera
    voreen.setPropertyValue(canvas, "canvasSize", prevDim)
    voreen.setPropertyValue(processor, cameraProp, prevCam)
    voreen.repaint()

    # evaluate results
    runtime = (end - start)
    if runtime > 0:
        fps = frames / runtime
    else:
        fps = -1

    message =  'frames: %i\n' % (frames)
    message += 'total runtime: %f\n' % (runtime)
    message += 'fps: %f' %(fps)
    print message
    voreenqt.messageBox("Finished!\n" + message)
def bottom():
    initCam    = ((0.0, 0.0, 2.75), (0.0, 0.0, 0.0), (0.0, 1.0, 0.0))
    # store current canvas size and camera settings
    prevDim = voreen.getPropertyValue(canvas, "canvasSize")
    prevCam = voreen.getPropertyValue(processor, cameraProp)
    print(prevCam)
    # resize canvas and initialize camera
    voreen.setPropertyValue(canvas, "canvasSize", canvasDim)
    voreen.setPropertyValue(processor, cameraProp, initCam)
    voreen.repaint()
    # make sure all Qt events have been processed before starting
    voreenqt.processEvents()  
    # start loop for animation
    counter = 0
    angleIncr = 2*math.pi / frames  # do a full rotation
    start = time.time()
    while (counter < frames):
        counter = counter + 1
        # update camera for current frame
        voreen.rotateCamera(processor, cameraProp, angleIncr, rotAxis)
        # render network state
        voreen.repaint()
    end = time.time()
Example #5
0
# Consecutively loads the ten time steps of the golf ball data set
# (http://www.voreen.org/files/volumedynamics.zip), 
# and takes a snapshot of each frame.

import voreen
import voreenqt

golfBallPath = voreen.getBasePath() + "/data/volumes/golfball"
snapshotPath = voreen.getBasePath() + "/data/screenshots"

for i in range(0, 10):
    # usage: voreen.loadVolume(filepath, [VolumeSource processor]) 
    voreen.loadVolume(golfBallPath + "/golfball0_%d-512x256x256.dat" % (i))
    
    # alternative: use VolumeSeriesSource as data supplier
    #voreen.setPropertyValue("VolumeSeriesSource", "step", i) 

    voreen.repaint()
    voreenqt.processEvents() # to see each frame on screen
    voreen.snapshot(snapshotPath + "/golfball0_%d.png" % (i))

voreenqt.messageBox("Wrote ten frames to %s/golfball0_*.png" % snapshotPath)