[vtkusers] WarpScalar with an StructuredGrid and Scalar Values - How?
Simon Clift
ssclift at gmail.com
Wed Aug 5 23:34:41 EDT 2009
Hi folks,
I'm new to VTK (but not visualization, used mostly OpenDX, AVS in the past)
and I'm having a terrible time with a simple case that I think vtkWarpScalar
should solve for me. I've been through the examples, but none of them seem to
apply exactly to my case and I was wondering if the users list might have some
insights, please.
I have a vtkStructuredGrid with dimensions (N_x, N_y, 1 ) and the points are
set, but the data is 2D and the z-axis is 0 on all points. I would like to
visualize one of several vtkDoubleArray() values over the same grid with the
values specifying the z-distance from the grid. The grid and the points are
generated internally in the program and are not loaded from a file (they will
eventually show up in a GUI).
If I visualize this (for example in my Python code):
self.xyGrid = vtk.vtkStructuredGrid()
self.xyGrid.SetDimensions( gDim )
self.xyGrid.SetInput( pts ) # pts is an N_x*N_y vtkPoints
...
self.xyGrid.GetPointData().SetScalars( self.value_1 )
self.map_xyGrid = vtk.vtkDataSetMapper()
self.map_xyGrid.SetInput( self.xyGrid )
... # render stuff
I get a flat structured grid on the display with no elevation. It has colours
that make sense for the data, so I think it is correctly set up.
However, I can't figure out how to feed the xyGrid to vtkWarpScalar to warp it
using the scalar (or active scalar?). It seems to have to go via a
vtkAlgorithm but when I try vtkDataObjectToDataSetFilter then feed this to
vtkWarpScalar I get an empty data set. The input xyGrid lists (on print) a
credible list of data and points, but the output from any of the filters I have
tried is nothing.
I'm wondering if something in my basic approach is off? Should I be using a
vtkAlgorithm sub-class to create my structured grid, rather than creating it
directly?
Best regards
-- Simon
--
1129 Ibbetson Lane
Mississauga, Ontario
L5C 1K9 Canada
More information about the vtkusers
mailing list