[vtkusers] vtkImageGradient, vtkAssignAttribute, arrows and DEM data (conversion needed?)

dschulle dschuller_topgun at yahoo.com
Fri Nov 16 17:33:03 EST 2007


Dear VTK Users; Hi-

I'm reading DEM (Digital Elevation Model) data and wanting to map arrows
associated with the slope of the terrain.  Here is my pipeline for the
arrows and attached is my output file "output8.GIF": 

vtkDEMReader -> vtkImageShrink3D -> vtkImageGradient -> vtkGlyphSource2D ->
vtkGlyph3D -> vtkPolyDataMapper -> vtkActor -> renderer

In the image, it shows arrows underneath the elevation data (not a real big
deal for now- can fix later).  But, you'll notice that the arrows aren't
angled, so this is where I need guidance please (i.e. the arrows are colored
and scaled to the magnitude, but the vector direction is not shown).

My question is: do I need to convert the vtkImageGradient output data to
vectors in order to obtain a direction for the arrows?  For conversion, I
thought I'd use vtkAssignAttribute but I guess I am interpreting the
implementation if vtkAssignAttribute incorrectly because it is not
converting?

Here is my code (java):
...

vtkImageGradient grad = new vtkImageGradient();
grad.SetDimensionality(3);  
grad.SetInputConnection(DEMdata.GetOutputPort());

// trying to use vtkAssignAttribute here to label the scalar fields as
vectors
vtkAssignAttribute testaa = new vtkAssignAttribute();
testaa.SetInputConnection(grad.GetOutputPort());
testaa.Assign(0,1,0); // dont know how this is actually supposed to work ???
testaa.Update();

vtkGlyphSource2D arrow = new vtkGlyphSource2D();
arrow.SetGlyphTypeToArrow();
arrow.SetScale(20000);  // this was A MAJOR ISSUE
arrow.FilledOn();  // this was also MAJOR ISSUE

// glyph the gradient vector (with arrows)
vtkGlyph3D glyph = new vtkGlyph3D();
glyph.SetSource(arrow.GetOutput());
glyph.SetInputConnection(testaa.GetOutputPort());

...

Any and all help would be greatly appreciated. 

Thank you, Daniel http://www.nabble.com/file/p13799057/output8.gif 
-- 
View this message in context: http://www.nabble.com/vtkImageGradient%2C-vtkAssignAttribute%2C-arrows-and-DEM-data-%28conversion-needed-%29-tf4823132.html#a13799057
Sent from the VTK - Users mailing list archive at Nabble.com.




More information about the vtkusers mailing list