From: Bryan C. <br...@co...> - 2006-05-21 07:39:20
|
On Sat, 2006-05-20 at 22:57 +0200, Emanuele Olivetti wrote: > I need to use a 3D visualization toolkit together with the > amazing numpy. On the scipy website mayavi/VTK are suggested but > as far as I tried, mayavi uses only Numeric and doesn't like > numpy arrays (and mayavi, last release, dates 13 September 2005 > so a bit earlier for numpy). You can safely install Numeric along side numpy; you'll need to do this in order to run mayavi. Alternatively, you could try Paraview (http://www.paraview.org). Like mayavi, Paraview is based on VTK, but it's written in Tcl/Tk rather than python. It's more feature complete than mayavi and easier to use, in my view. I quick test shows that VTK-5 is happy to accept numpy arrays as "Void Pointers" for its vtkDataArrays. Using this method, you can construct any vtkDataObject from numpy arrays. If you just want to turn your 3D array into vtkImageData, you can use the vtkImageImport filter. Once you've got a vtkDataSet (vtkImageData or some other form), you can save this as a .vtk file, which either mayavi or paraview can then open. If you're not already familiar with VTK programming, then another way to get going is to convert your numpy array directly to a VTK data file using a pure python script. The file formats are documented at http://www.vtk.org/pdf/file-formats.pdf and the can be written in either binary or ascii form. The 'legacy' .vtk formats and are quite simple to construct. If you want to use mayavi from a script, then you need to convert your numpy arrays to Numeric arrays (using the Numeric.asarray function) for transfer to mayavi as needed. HTH Bryan > Do you know something about it or > could suggest alternative 3D visualization packages? > Basically my needs are related to this task: I've 3D matrices > and I'like to see them not only as 2D slices. > > Thanks in advance, > > Emanuele > > > ------------------------------------------------------- > 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 |