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()
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()
Пример #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)
Пример #4
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)
# Voreen Python script
import voreen
import voreenqt

voreen.info()
voreenqt.info()

from os import listdir
from os.path import isfile, join
mypath="D:/document/work/time-varying-visualization/run/CT-Knee"
tfs = [f for f in listdir(mypath) if isfile(join(mypath, f)) and -1!=f.find(".tfi")]
print(tfs)

for f in tfs:
    tf_filename=join(mypath,f)
    voreen.loadTransferFunction("SingleVolumeRaycaster", "transferFunction", tf_filename)
    voreen.repaint()

    image_filename=tf_filename.replace(".tfi",".png")
    voreen.snapshotCanvas(0, image_filename)
    print("saved to image %s" % image_filename)
Пример #6
0
# Voreen Python script
import voreen
import voreenqt

voreen.info()
voreenqt.info()

for i in range(0, 150):

    voreen.setPropertyValue("VolumeSelector", "volumeID", i)

    tf_filename = "../../../../output/tjet/%03d.tfi" % i
    
    voreen.loadTransferFunction("SingleVolumeRaycaster", "transferFunction", tf_filename)
    
    print "loaded transfer function %s" % tf_filename

    voreen.repaint()
    
    image_filename = "../../../../output/tjet_output/%03d.png" % i
    voreen.snapshotCanvas(0, image_filename)

    print "saved to image %s" % image_filename

voreen.setPropertyValue("VolumeSelector", "volumeID", 0)