# 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)
# Sample script for taking canvas snapshots. # Writes a snapshot of each canvas to disc. import voreen import time filename = voreen.getBasePath() + "/data/screenshots/snapshot-%d.png" start = time.time() count = voreen.canvasCount() print "canvas count is %d:" % count for i in range(0, count): voreen.snapshotCanvas(i, filename % (i + 1)) print " * saved snapshot to file %s" % (filename % (i + 1)) end = time.time() runtime = end - start print "total runtime: %fs" % runtime
# 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)
# Sample script for taking canvas snapshots. # Writes a snapshot of each canvas to disc. import voreen import time filename = voreen.getBasePath() + "/data/screenshots/snapshot-%d.png" start = time.time() count = voreen.canvasCount() print "canvas count is %d:" % count for i in range(0, count): voreen.snapshotCanvas(i, filename % (i + 1)) print " * saved snapshot to file %s" % (filename % (i + 1)) end = time.time() runtime = (end - start) print 'total runtime: %fs' % runtime