Prabhu Ramachandran | 31 Mar 19:11 2009
Picon

Re: newbie question with regards to data structures.

On 03/30/09 17:00, Jason Leung wrote:
> i was finally able to reduce my dataset size from 28M to bout 12M as 
> well as get my data passed properly into scalar_scatter(), however, when 
> i tried to run delauney3d() the window crashed (not surprised).

Well, that is unlikely to work well.  I would suggest that you instead 
look at using the GaussianSplatter filter.  There is a nice example by 
Gael illustrating its use in examples/mayavi/protein.py.  Here is 
another simple one:

from enthought.mayavi import mlab
from numpy import *
x = random.random(10000)
y = random.random(10000)
z = random.random(10000)
s = x*x + 0.5*y*y + 3*z*z
src = mlab.pipeline.scalar_scatter(x, y, z, s)

g = mlab.pipeline.glyph(src, mode='point')
gs = mlab.pipeline.gaussian_splatter(src)
gs.filter.radius = 0.25
o = mlab.pipeline.outline(gs)
cp = mlab.pipeline.scalar_cut_plane(gs)
iso=mlab.pipeline.iso_surface(gs)

Now, you can play with the filter's radius to get better results.  you 
should really use contour_grid_plane but there seems to be a mlab bug, 
however, you can create one from the menus for now.

> i went through your August 20th, 2008 talk on 3d visualization with TVTK 
> and Mayavi as well as a few of the posted examples. however i can't say 
> i'm too clear on how to determine/define cells as well as determining 
> cell_types.
> 
> looking at ( 
>
http://code.enthought.com/projects/mayavi/docs/development/html/mayavi/data.html#vtk-data-structures 
> ), please correct me if i'm wrong. but the points i presume are the 
> points of the tetrahedral and the hexahedral vericies. however, i'm not 
> too sure aht the cells array define. are they they location of the 
> cells? as well, how would you know what cell types to define when you're 
> not too sure waht your final image is?

The cells array define the cell in terms of the indices to the point 
array.  So if you have a triangle between the first three points the 
cell defining the triangle will be [0, 1, 2].

The cell types are defined in the VTK file format documentation.

> i did some simple scatter plots in matlab to better illustrate how the 
> data will be distributed. as you can kind of see from the isometric 
> view, there are 4 different spherical surfaces rotating about a common 
> point, which results in points throughout a volume. ideally, in the end 
> there should columns of high intensity normal to the xy plane, and 
> regions of low intensities between these columns.

I think the example above should show you how to view the same with mlab 
and also do isosurface/cut plane of the data.

HTH.
cheers,
prabhu

Gmane