Thomas Lecocq | 27 Jun 2006 12:33
Picon
Favicon

WAS [Enthought-dev] mayavi domains application...

Hi Prabhu & Fred,
 
> I wonder if there are some people/applications that use Mayavi2
> in geophysics.
 
Yes, indeed, I do use Mayavi1.5 for rendering geophysical data (ERT profiles, ERT 3D) and now I'm using Mayavi2. The person that co-directed my Master Thesis often uses Mayavi 1.5 for this kind of purposes : ERT profiles, GPR, DEM, etc...
 
Feel free to ask for more details is needed,
 
Best regards,
 
Thomas


********************************
Thomas Lecocq
thlecocq <at> msn.com
NO SPAM PLEASE - RESPECT THE LAW
********************************
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
MayaVi-users mailing list
MayaVi-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mayavi-users
Antonis Giannopoulos | 29 Jun 2006 02:03
Picon
Picon

Problem running on Mac OSX 10.4

I have installed VTK 5.0 and Python 2.4 and all seems OK as the  
test_vtk.py in the doc directory runs fine. However, when I try to  
run MayaVi either from the command line or inside python I get:

oban:~/Desktop/MayaVi-1.5 antonis$ ./mayavi
Traceback (most recent call last):
   File "./mayavi", line 317, in ?
     app = MayaViTkGUI (r)
   File "/Library/Frameworks/Python.framework/Versions/2.4/lib/ 
python2.4/site-packages/mayavi/Main.py", line 1009, in __init__
     self.renwin = Misc.RenderWindow.RenderWindow (self.renwin_frame)
   File "/Library/Frameworks/Python.framework/Versions/2.4/lib/ 
python2.4/site-packages/mayavi/Misc/RenderWindow.py", line 89, in  
__init__
     height=505)
   File "/Library/Frameworks/Python.framework/Versions/2.4/lib/ 
python2.4/site-packages/vtk/tk/vtkTkRenderWidget.py", line 81, in  
__init__
     vtkLoadPythonTkWidgets(master.tk)
   File "/Library/Frameworks/Python.framework/Versions/2.4/lib/ 
python2.4/site-packages/vtk/tk/vtkLoadPythonTkWidgets.py", line 63,  
in vtkLoadPythonTkWidgets
     interp.call('load', filename)
_tkinter.TclError: image not found

I have checked the patch in the common installation problems and it  
seems that it is implemented on the version of VTK I have.

Any ideas?

Thanks

Antonis

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
Hans Fangohr | 29 Jun 2006 15:23
Picon

keeping mayavi window interactive while visualising time dependent data (while simulation runs)

Dear friends of Mayavi, dear Prabhu,

We would like to plot some data (say a vector field on a mesh) using
Mayavi while a simulation computes the time development of that field.
In particular, every now and then we would like to update the data that is
displayed in the mayavi window. (We can do this and if there is interest I
can email out a very basic example showing hows this can be done; just let
me know).

So the idea is this (assuming we have a simulation that computers the
time development of a vector field):

(i) fire up mayavi and display initial vectorfield
(ii) start simulation for n simulation time steps
(iii) update the data in mayavi so that the display window shows the most recent data
(iv) carry on with simulation for n simulation time steps
(v) go back to (iii).

All this is working, but(!) while our simulation carries on (step (iv)),
we can't interact with the Mayavi window. In particular, we can't zoom in
and out and rotate the scene.

This is what I would like to be able to do.

Any suggestions?

I provide two small examples that (I believe) demonstrate the underlying
difficulty. Here is the first one:

import mayavi
my_mayavi = mayavi.mayavi()
my_mayavi.open_vtk('heart.vtk')
my_mayavi.load_module('SurfaceMap')
import time
time.sleep(60)

This just opens a mayavi window and displays a surface map of the scalar
data in the 'heart.vtk' data set that comes with Mayavi. Note the last
line: The sleep command imitates our simulation running, i.e. there is
some other activity going on before we update the data in the mayavi
windows (this last part is not represented in the program above). While
the sleep command is running, the MAyavi windows is displayed, but one
cannot interact with it. This is the problem we'd like to solve.

There is a 'solution' to the small problem presented here (but it doesn't
solve the big problem with the interactive display of real-time simulation
data):

import mayavi
my_mayavi = mayavi.mayavi()
my_mayavi.open_vtk('heart.vtk')
my_mayavi.load_module('SurfaceMap')

raw_input()

This program (identical to the one above, apart from the last two lines),
allows to interact with Mayavi once the raw_input() command has been
reached. However, we can't use this for our simulation, because we want to
compute stuff instead of waiting for thhe user to respond to raw_input().

Any suggestion welcome. If there is no simple solution to this, I'd like
to hear that, too.

Many thanks,

Hans

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
Prabhu Ramachandran | 29 Jun 2006 15:56

Re: Problem running on Mac OSX 10.4

>>>>> "Antonis" == Antonis Giannopoulos <A.Giannopoulos <at> ed.ac.uk> writes:

    Antonis> I have installed VTK 5.0 and Python 2.4 and all seems OK
    Antonis> as the test_vtk.py in the doc directory runs
    Antonis> fine. However, when I try to run MayaVi either from the
    Antonis> command line or inside python I get:

    Antonis> "/Library/Frameworks/Python.framework/Versions/2.4/lib/
    Antonis> python2.4/site-packages/vtk/tk/vtkLoadPythonTkWidgets.py",
    Antonis> line 63, in vtkLoadPythonTkWidgets interp.call('load',
    Antonis> filename) _tkinter.TclError: image not found

    Antonis> I have checked the patch in the common installation
    Antonis> problems and it seems that it is implemented on the
    Antonis> version of VTK I have.

This is wierd because test_vtk.py runs.  If it does then mayavi should
usually run as well.  Are you certain you did not get any errors
running it?

vtkLoadPythonTkWidgets is trying to load a file called
'vtkRenderingPythonTkWidgets.dyld' or
'vtkRenderingPythonTkWidgets.so'.  For some reason Tcl is unable to
find it.  Try copying the file to the mayavi directory and check.

cheers,
prabhu

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
Prabhu Ramachandran | 29 Jun 2006 16:43

Re: keeping mayavi window interactive while visualising time dependent data (while simulation runs)

>>>>> "Hans" == Hans Fangohr <H.FANGOHR <at> soton.ac.uk> writes:

    Hans> All this is working, but(!) while our simulation carries on
    Hans> (step (iv)), we can't interact with the Mayavi window. In
    Hans> particular, we can't zoom in and out and rotate the scene.

    Hans> This is what I would like to be able to do.

    Hans> Any suggestions?

A few possibilities:

 1. Using mayavi's start_animation method to call things is a good
    idea.  An example is attached below.

 2. Use a thread to run the compute intensive code.  The only problem
    is you will need to make sure the mayavi/tkinter calls are made
    only from their own thread and not from the compute intensive
    code.  You can do this using the MayaViTkGUI's do_callback method.

 3. You can generate the data separately.  Then from a separate Python
    program you can poll the file as done in the example below to
    display things.   Option 2 is nicer.

I wish I had a quick example for option 2 but I don't have it handy
right now.

Here is the example yanked from a message I sent in Feb 2003.

########## Code ##########
import os
from Tkinter import *
import mayavi

r = Tk()
r.withdraw()
v = mayavi.Main.MayaViTkGUI(r)

# open the data.
data = v.open_vtk('data.vtk', 0)

# create a visualization
f = v.load_filter('PolyDataNormals', 0)
f.fil.SetFeatureAngle(45.0)
polydata = v.load_module('PolyData', 0)

# now stat the data file and poll it to see if it changes.
last_stat = os.stat('data.vtk')

def anim():
    global last_stat
    s = os.stat('data.vtk')
    if s[-2] == last_stat[-2]:
        return
    last_stat = s
    data.reader.Modified()
    data.reader.Update()
    data.update_references()
    v.Render()

v.start_animation(1500, anim)
r.mainloop()
########## Code ##########

Let me see if I can get an example of threaded code if I get the time
tonight.

cheers,
prabhu

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
Prabhu Ramachandran | 29 Jun 2006 20:19

Re: keeping mayavi window interactive while visualising time dependent data (while simulation runs)

>>>>> "Hans" == Hans Fangohr <H.FANGOHR <at> soton.ac.uk> writes:

    Hans> All this is working, but(!) while our simulation carries on
    Hans> (step (iv)), we can't interact with the Mayavi window. In
    Hans> particular, we can't zoom in and out and rotate the scene.

Attached is a simple example that does just this using mayavi's
do_callback along with the thread module.  The code is illustrative
but you might want to use the 'threading' module instead for cleaner
code.

cheers,
prabhu

import Tkinter
import thread
import mayavi

def big_computation():
    i = 0
    while i < 10000000:
        i += 1
    return

def show(v):
    v.renwin.camera.Azimuth(10)
    v.Render()

def work(v):
    for i in range(10):
        print "computing...",
        big_computation()
        print "done."
        v.do_callback(show, v)

def main():
    r = Tkinter.Tk()
    r.withdraw()

    v = mayavi.mayavi()
    v.open_vtk('heart.vtk', 0)
    v.load_module('SurfaceMap', 0)

    thread.start_new_thread(work, (v,))
    r.mainloop()

if __name__ == '__main__':
    main()
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
MayaVi-users mailing list
MayaVi-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mayavi-users
Prabhu Ramachandran | 30 Jun 2006 13:19

Re: Problem running on Mac OSX 10.4

>>>>> "Antonis" == Antonis Giannopoulos <A.Giannopoulos <at> ed.ac.uk> writes:

    Antonis> Thanks for that but I could not locate the libraries you
    Antonis> mention

    Antonis> vtkRenderingPythonTkWidgets.dyld or
    Antonis> vtkRenderingPythonTkWidgets.so

    Antonis> The test_vtk.py runs with no problem as all dialogs work
    Antonis> fine and the final Vtk cone is displayed and I can
    Antonis> manipulate it with the mouse and press "q" to quit.

Hmm, did you run it from the command line?  If you did not then please
run it from the command line.  Actually, it might be easier if you
test the following:

 python

 >>> from vtk.tk import vtkTkRenderWidget

Let me know if you have any errors.

Also, can you run the vtkTkRenderWidget.py example and see if that
works.

    Antonis> I don't know if I miss anything in the compilation of
    Antonis> vtk. I have used the Apple's Tcl/tk (8.4) and the
    Antonis> MacPython 2.4 for Python.

When compiling did you set the paths to Tcl/Tk?  If
vtkRenderingPythonTkWidgets was not built then you can't use Mayavi.
So please build it by setting the paths to Tcl/Tk when you configure
the VTK build.

cheers,
prabhu

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

Gmane