>>>>> "Peter" == Peter Schmitt <[EMAIL PROTECTED]> writes:
Peter> I want to load a custom gradient table color transfer
Peter> function (*.grad file) via a MayaVi2 script.
Peter> # start MayaVi, load data, etc. ... vol = Volume()
Peter> mayavi.add_module(vol) </end snip>
Sorry for the extremely delayed response. Here is a simple script
that shows you how. It is a bit of a pain and I'll check in something
that makes it easier but here is something that works:
# ---- vol.py -----
mayavi.new_scene()
from enthought.mayavi.sources.vtk_file_reader import VTKFileReader
s = VTKFileReader()
s.initialize('/tmp/t.vtk') # Replace with your datafile.
mayavi.add_source(s)
from enthought.mayavi.modules.volume import Volume
from enthought.tvtk.util.gradient_editor import GradientTable
gt = GradientTable(300)
gt.load('/tmp/junk.grad') # Replace with your gradient file.
v = Volume()
gt.store_to_vtk_volume_prop(v.volume_property, (0.0, 1.0))
mayavi.add_module(v)
# ---- vol.py -----
Just run this like so:
mayavi2 -x vol.py
This should do the job.
The trouble with discovering how to do this is that mayavi2 itself
saves something different and not the .grad file. So I hadn't
bothered adding the functionality to load the grad file from a script.
I'll check something in to fix this shortly.
cheers,
prabhu
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
MayaVi-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mayavi-users