Baris Demir wrote:
Hi all,

I need to develop a GUI for some scientific data processing operations and this GUI should work well with a 3D plotting module, also with NumPy and SciPy for sure. I made a search about packages but, there are plenty of these modules available. What kind of a package or a package of packages might be the best way for this work. BTW I do not want to use MayaVi. It is too much actually.

Thanks in advance.
BD



The attached example should give you some idea of embedding mayavi (and then using the very high-level mlab) and vtk in wxpython apps. This example requires wxpython, vtk, numpy, and ETS. If you are really after visualization of data, you will need to spend years to get even a fraction of the capability of mayavi. On the other hand, rolling out a py2exe'd version of a program is currently a major challenge if you need ETS.

The mayavi.mlab module is so easy to use and embed that I would recommend using it to create a rapid software prototype to compare against whatever system you decide to go with. It is designed with a seamless interface to numpy/scipy, and provides high-level routines to modify low-level properties.

Cheers,
Eric
"""
This example show how to embedded Mayavi in a wx aui notebook, and
also shows how to embed a generic vtk window 

This is a slightly more complex example than the wx_embedding.py one, and
can be used to see how a large wx application can use different
Mayavi views.
"""

from numpy import ogrid, sin

from enthought.traits.api import HasTraits, Instance
from enthought.traits.ui.api import View, Item

from enthought.mayavi.sources.api import ArraySource
from enthought.mayavi.modules.api import IsoSurface

from enthought.tvtk.pyface.scene_editor import SceneEditor
from enthought.mayavi.tools.mlab_scene_model import MlabSceneModel

class MayaviView(HasTraits):

    scene = Instance(MlabSceneModel, ())
    
    view = View(Item('scene', editor=SceneEditor(), resizable=True,
                    show_label=False),
                    resizable=True)

    def __init__(self):
        HasTraits.__init__(self)
        x, y, z = ogrid[-10:10:100j, -10:10:100j, -10:10:100j]
        scalars = sin(x*y*z)/(x*y*z)
        src = ArraySource(scalar_data=scalars)
        self.scene.engine.add_source(src)
        src.add_module(IsoSurface())
#
# Wx Code
import wx
import vtk
from vtk.wx import *
from enthought.mayavi import mlab 
class MainWindow(wx.Frame):

    def __init__(self, parent, id):
        wx.Frame.__init__(self, parent, id, 'Mayavi in a Wx notebook')
        self.notebook = wx.aui.AuiNotebook(self, id=-1, 
                style=wx.aui.AUI_NB_TAB_SPLIT | wx.aui.AUI_NB_CLOSE_ON_ALL_TABS
                        | wx.aui.AUI_NB_LEFT)
        sizer = wx.BoxSizer()
        sizer.Add(self.notebook,1, wx.EXPAND)
        self.SetSizer(sizer)

        self.mayavi_view = MayaviView()

        self.control = self.mayavi_view.edit_traits(
                        parent=self,
                        kind='subpanel').control
        self.notebook.AddPage(page=self.control, caption='Display 1')
        self.mayavi_view2 = MayaviView()

        self.control2 = self.mayavi_view2.edit_traits(
                        parent=self,
                        kind='subpanel').control
        self.notebook.AddPage(page=self.control2, caption='Display 2')
        #the following clears the second panel, 
        #then shows the output of test_contour3d in the same panel
        mlab.clf() #clear the figure in Display 2
        mlab.test_contour3d() #add some stuff there
        mlab.show_pipeline() #display the mayavi pipeline viewer
        

        #the following creates a VTK window and embeds in our notebook
        
self.notebook.AddPage(page=wxVTKRenderWindowInteractor.wxVTKRenderWindowInteractor(self,
 -1), caption='VTK Panel')

        widget =  self.notebook.GetPage(2)   
        widget.Enable(1)   
        widget.AddObserver('ExitEvent', lambda o,e,f=self: f.Close())   
        ren = vtk.vtkRenderer()   
        widget.GetRenderWindow().AddRenderer(ren)   
        cone = vtk.vtkConeSource()    
        cone.SetResolution(8)   
        coneMapper = vtk.vtkPolyDataMapper()   
        coneMapper.SetInput(cone.GetOutput())   
        coneActor = vtk.vtkActor()   
        coneActor.SetMapper(coneMapper)   
        ren.AddActor(coneActor)   
        style = vtk.vtkInteractorStyleTrackballCamera()   
        widget._Iren.SetInteractorStyle(style)  

        self.Show(True)

if __name__ == '__main__':
    app = wx.PySimpleApp()
    frame = MainWindow(None, wx.ID_ANY)
    app.MainLoop()
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to