[vtkusers] Problems visualing vector data using streamlines
Sandro Carlotti
sandro_carlotti at hotmail.com
Sun Feb 11 08:41:25 EST 2001
Hello,
I am student using vtk as my final year project, my project involves reading
in point data with associated vector and scalar data for each point (for
example flow around an airfoil), and then visualising the flow.
I am stuck at the moment and I would greatly appreciate any help. I have
outlined my problem below:
I am trying to visualise a vector field using streamlines and have tried
following the examples in the two books and on the cd, but can not seem to
make any headway.
I have structured the data following the text as field data with 7 arrays
x,y,z,u,v,w,p.
I then read in the data and set the appropriate arrays to point, scalar and
vector data. Then try and visualise the flow using streamlines.
When I run the program it gives the following error:
ERROR: In vtkTubeFilter.cxx, line 121
vtkTubeFilter (0x1c5372d8): : No input data!
Please could someone have a look at the code and let me know if they can see
any obvious mistakes. Or if I am going about this in the wrong manner can
you please point me in the right direction.
The following is the code I am trying to use to visualise the data:
catch {load vtktcl}
# get the interactor ui
source examplesTcl/vtkInt.tcl
source examplesTcl/colors.tcl
source examplesTcl/vtkInclude.tcl
set xAxis x
set yAxis y
set zAxis z
set vectoru u
set vectorv v
set vectorw w
set scalar p
vtkDataObjectReader read
read SetFileName merged_grid_data.vtk2
vtkDataObjectToDataSetFilter do2ds
do2ds SetInput [read GetOutput]
do2ds SetDataSetTypeToPolyData
do2ds DefaultNormalizeOff
do2ds SetPointComponent 0 $xAxis 0
do2ds SetPointComponent 1 $yAxis 0
do2ds SetPointComponent 2 $zAxis 0
vtkFieldDataToAttributeDataFilter fd2ad
fd2ad SetInput [do2ds GetOutput]
fd2ad SetInputFieldToDataObjectField
fd2ad SetOutputAttributeDataToPointData
fd2ad DefaultNormalizeOff
fd2ad SetScalarComponent 0 $scalar 0
fd2ad SetVectorComponent 0 $vectoru 0
fd2ad SetVectorComponent 1 $vectorv 0
fd2ad SetVectorComponent 2 $vectorw 0
fd2ad Update
# draw outline of area
vtkOutlineFilter outline
outline SetInput [fd2ad GetOutput]
vtkPolyDataMapper outlineMapper
outlineMapper SetInput [outline GetOutput]
vtkLODActor outlineActor
outlineActor SetMapper outlineMapper
set outlineProp [outlineActor GetProperty]
# spherical seed point
vtkPointSource rake
rake SetCenter -5 0 0.46875
rake SetNumberOfPoints 10
vtkStreamLine streamers
streamers SetInput [fd2ad GetOutput]
streamers SetSource [rake GetOutput]
streamers SetMaximumPropagationTime 1000
# streamers SpeedScalarsOn
streamers SetStepLength .025
streamers SetIntegrationDirectionToIntegrateBothDirections
vtkTubeFilter tubes
tubes SetInput [streamers GetOutput]
tubes SetNumberOfSides 8
tubes SetRadius 0.8
tubes SetVaryRadiusToVaryRadiusByVector
vtkPolyDataMapper mapTubes
mapTubes SetInput [tubes GetOutput]
eval mapTubes SetScalarRange [[fd2ad GetOutput] GetScalarRange]
vtkLODActor tubesActor
tubesActor SetMapper mapTubes
vtkRenderer ren1
vtkRenderWindow renWin
renWin AddRenderer ren1
vtkRenderWindowInteractor iren
iren SetRenderWindow renWin
# Add the actors to the renderer, set the background colour and size
ren1 AddActor tubesActor
ren1 AddActor outlineActor
vtkCamera aCam
aCam SetFocalPoint 0.00657892 0 2.41026
aCam SetPosition -1.94838 -47.1275 39.4607
aCam ComputeViewPlaneNormal
aCam SetViewPlaneNormal -0.0325936 -0.785725 0.617717
aCam SetViewUp 0.00653193 0.617865 0.786257
aCam SetClippingRange 1 100
ren1 SetBackground .1 .2 .4
ren1 SetActiveCamera aCam
renWin SetSize 600 600
iren Initialize
renWin Render
# render the image
#
iren SetUserMethod {wm deiconify .vtkInteract}
renWin Render
# render the image
iren SetUserMethod {wm deiconify .vtkInteract}
# prevent the tk window from showing up then start the event loop
wm withdraw .
Thanks for your time
Regards
Sandro
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
More information about the vtkusers
mailing list