[vtkusers] Help with vtkDoubleArray and vtkWarpScalar

fred fredmfp at gmail.com
Tue May 15 16:52:21 EDT 2007


Janny Dong a écrit :
> Hi, all
>
> I have the data points like (X,Y,Z). (X,Y) is the position of the data 
> points on the map. Z is the height that I am trying to represent with 
> colors.
>
> For example, the data are like
>  
> {0,0,60.3}, {0,1, 60.2},{0,2,60.1},{0,3,60.0},
> {1,0,59.9},{1,1,59.8}, {1,2,59.7},{1,3,59.6},
> {2,0,59.6}, {2,1,59.5},{2,2,59.3},{2,3,59.5},
> {3,0,59.6}, {3,1,59.7}, {3,2,59.9}, {3,3,60.1}
>
>  I tried to put my data in vtkDoubleArray and then create 
> vtkImageData. Then I used vtkWarpScalar to get a 3D colored surface. 
> Basically I'd like to generate a surface as MATLAB functions surf() 
> and meshgrid() do. I must have done something wrong in this procedure 
> since I got nothing in the rendering window.
>
> Is there any sample code for this? Or is there any better way to 
> generate a color map out of such kind of data?
>
The short code attached should do the trick.
Then use your favorite 3D viz'.
With paraview, you should get what you want using ExtractSurface then 
Warp (scalar) filters.


HTH.

-- 
http://scipy.org/FredericPetit

-------------- next part --------------
A non-text attachment was scrubbed...
Name: janny.py
Type: text/x-python
Size: 825 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070515/af54100a/attachment.py>


More information about the vtkusers mailing list