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()
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 5
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)
Exemplo n.º 6
0
# Voreen Python script
import voreen
import voreenqt

voreen.info()
voreenqt.info()

for i in range(0, 48):
    voreen.setPropertyValue("VolumeSelector", "volumeID", i)
    filename = "../../../../_uchar/isabel_TC/%02d.mhd" % i
    voreen.setPropertyValue("VolumeSave", "outputFilename", filename)
    voreen.repaint()
    print filename

voreen.setPropertyValue("VolumeSelector", "volumeID", 0)
Exemplo n.º 7
0
# Voreen Python script
import voreen
import voreenqt
import time
from time import gmtime, strftime

voreen.info()
voreenqt.info()

t = strftime("%Y%m%d_%H%M%S", gmtime())
voreen.setPropertyValue("VolumeCreate", "regenerate", 0)
filename = "../../../../evaluation/volume_" + t + ".mhd"
print filename
voreen.setPropertyValue("VolumeSave", "outputFilename", filename)
voreen.repaint()
# Voreen Python script
import voreen
import voreenqt

voreen.info()
voreenqt.info()

index=range(1,24)+range(25,100)
index=range(1,100)
for i in range(0, len(index)):
    voreen.setPropertyValue("VolumeSelector", "volumeID", i)

    tf_filename="D:/document/work/time-varying-visualization/~plot/vorts%d_optimized_parallelsearch.tfi" % index[i]
    voreen.loadTransferFunction("SingleVolumeRaycaster", "transferFunction", tf_filename)
    print("loaded transfer function %s" % tf_filename)

    voreen.repaint()

    image_filename="D:/document/work/time-varying-visualization/~vorts_optimized/%02d.png" % index[i]
    voreen.snapshotCanvas(0, image_filename)
    print("saved to image %s" % image_filename)

voreen.setPropertyValue("VolumeSelector", "volumeID", 0)
# Voreen Python script
import voreen
import voreenqt

voreen.info()
voreenqt.info()

list=["D:\\document\\work\\time-varying-visualization\\ar\\nucleon_naive_optimized_green_1000.tfi", "D:\\document\\work\\time-varying-visualization\\ar\\nucleon_naive_optimized_green_1000_0.tfi", "D:\\document\\work\\time-varying-visualization\\ar\\nucleon_naive_optimized_green_1000_1.tfi", "D:\\document\\work\\time-varying-visualization\\ar\\nucleon_naive_optimized_green_1000_2.tfi", "D:\\document\\work\\time-varying-visualization\\ar\\nucleon_naive_optimized_green_1000_3.tfi", "D:\\document\\work\\time-varying-visualization\\ar\\nucleon_naive_optimized_red_1000.tfi", "D:\\document\\work\\time-varying-visualization\\ar\\nucleon_naive_optimized_red_1000_0.tfi", "D:\\document\\work\\time-varying-visualization\\ar\\nucleon_naive_optimized_red_1000_1.tfi", "D:\\document\\work\\time-varying-visualization\\ar\\nucleon_naive_optimized_red_1000_2.tfi", "D:\\document\\work\\time-varying-visualization\\ar\\nucleon_naive_optimized_red_1000_3.tfi", "D:\\document\\work\\time-varying-visualization\\ar\\nucleon_naive.tfi", "D:\\document\\work\\time-varying-visualization\\ar\\nucleon_naive_0.tfi", "D:\\document\\work\\time-varying-visualization\\ar\\nucleon_naive_1.tfi", "D:\\document\\work\\time-varying-visualization\\ar\\nucleon_naive_2.tfi", "D:\\document\\work\\time-varying-visualization\\ar\\nucleon_naive_3.tfi", "D:\\document\\work\\time-varying-visualization\\ar\\nucleon_strong_red.tfi", "D:\\document\\work\\time-varying-visualization\\ar\\nucleon_strong_red_0.tfi", "D:\\document\\work\\time-varying-visualization\\ar\\nucleon_strong_red_1.tfi", "D:\\document\\work\\time-varying-visualization\\ar\\nucleon_strong_red_2.tfi", "D:\\document\\work\\time-varying-visualization\\ar\\nucleon_strong_red_3.tfi", "D:\\document\\work\\time-varying-visualization\\ar\\nucleon_weak_red.tfi", "D:\\document\\work\\time-varying-visualization\\ar\\nucleon_weak_red_0.tfi", "D:\\document\\work\\time-varying-visualization\\ar\\nucleon_weak_red_1.tfi", "D:\\document\\work\\time-varying-visualization\\ar\\nucleon_weak_red_2.tfi", "D:\\document\\work\\time-varying-visualization\\ar\\nucleon_weak_red_3.tfi"]

for i in range(len(list)):
    s=list[i]
    voreen.loadTransferFunction("SingleVolumeRaycaster", "transferFunction", s)
    print("loaded transfer function %s" % s)
    if i%5<2:
        voreen.setPropertyValue("Background", "texture", "D:/document/work/time-varying-visualization/ar/background.jpg")
        voreen.setPropertyValue("Background", "backgroundModeAsString", "texture")
    else:
        voreen.setPropertyValue("Background", "backgroundModeAsString", "monochrome")

    voreen.repaint()
    image_filename=s.replace(".tfi",".png")
    voreen.snapshotCanvas(0, image_filename)
    print("saved to image %s" % image_filename)