1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
#!/usr/bin/env python
###
# This file is part of a set of example programs for the Coin library.
# Copyright (C) 2000-2003 by Systems in Motion. All rights reserved.
#
# <URL:http://www.coin3d.org>
#
# This sourcecode can be redistributed and/or modified under the
# terms of the GNU General Public License version 2 as published by
# the Free Software Foundation. See the file COPYING at the root
# directory of the distribution for more details.
#
# As a special exception, all sourcecode of the demo examples can be
# used for any purpose for licensees of the Coin Professional
# Edition License, without the restrictions of the GNU GPL. See our
# web pages for information about how to acquire a Professional Edition
# License.
#
# Systems in Motion, <URL:http://www.sim.no>, <mailto:support@sim.no>
#
SOGUI_BINDING = "SoQt"
import sys
from pivy.coin import *
from pivy.sogui import *
from pivy.simvoleon import *
import utility
def main():
window = SoGui.init(sys.argv[0])
SoVolumeRendering.init()
if len(sys.argv) != 2:
sys.stdout.write("Usage: %s filename.vol\n" % sys.argv[0])
sys.exit(1)
root = SoSeparator()
volumedata = SoVolumeData()
# Add SoVolumeData to the scene graph
filereader = SoVRVolFileReader()
filereader.setUserData(sys.argv[1])
volumedata.setReader(filereader)
root.addChild(volumedata)
# Add TransferFunction (color map) to scene graph
transfunc = SoTransferFunction()
root.addChild(transfunc)
# Add VolumeRender to scene graph
volrend = SoVolumeRender()
root.addChild(volrend)
ortho = SoOrthoSlice()
ortho.alphaUse = SoOrthoSlice.ALPHA_AS_IS
ortho.sliceNumber = 33
root.addChild(ortho)
viewer = SoGuiExaminerViewer(window)
viewer.setBackgroundColor(SbColor(0.1, 0.3, 0.5))
viewer.setSceneGraph(root)
viewer.show()
SoGui.show(window)
SoGui.mainLoop()
if __name__ == '__main__':
main()
|