[vtkusers] vtkStreamTracer

Dan ONICA onicadan at yahoo.com
Thu Jun 9 06:52:12 EDT 2005


Hi, 

I would need some advice in using VtkStreamTracer, at the INPUT part. I am doing the next thing: I am setting as input of the VtkStreamTracer a vtkImageData which has set as vectors a vtkDoubleArray and I am doing that for each vector field in a for cycle.(the result is the same if I use SetInput or AddInput). 

My concern is that the integrator has access at only one vector field at a time, so even if I use RK45 the resulted stream lines are not smooth (is almost like  Euler’s integration method, which considers the slope only at the beginning of the interval).

My question is HOW TO BUILD the INPUT such that the integrator has access to all the vector fields.

I'll be thankfull for any information .Thanks a lot ! 

Dan

I attached some code below:

 

              self.vector2D= vtkImageData()

              motion2D = vtkImageData()

              self.streamtracer = vtkStreamTracer()

              .........................

              vectors=vtkDoubleArray()

              vectors.SetNumberOfComponents(3)

              vectors.SetNumberOfTuples(self.dims[0]*self.dims[1]*self.dims[2])

              # Vectors to use with streamtracer

              for k in range(self.nbimages):

                 # Append reader  for every vector field image

                 self.reader.append(vtkImageReader())

                 








..    

                 self.reader[k].SetFileName(fname)

                 # Read motion data stored in a 2 components ACR image file

                 ............................................

                 # Store 2D Motion in ImageData and update vector2D

                 motion2D =self.reader[k].GetOutput()

                 ......................................

                 for y in range(self.dims[1]):

                     jOffset = y * self.dims[0]

                     for x in range(self.dims[0]):

                         v[0]=motion2D.GetScalarComponentAsDouble(x,y,0,0)

                         v[1]=motion2D.GetScalarComponentAsDouble(x,y,0,1)

                         offset = x + jOffset

                         vectors.InsertTuple3(offset,v[0],v[1],0)

                 self.vector2D.GetPointData().SetVectors(vectors)

                 # Perform StreamTracer process (on vector field)

                 # Set motion field  & seeds

                 self.streamtracer.AddInput(self.vector2D)

                 #self.streamtracer.SetInput(self.vectorField)

                 self.streamtracer.SetSource(self.seedgrid[k])

                 self.streamtracer.Update()

 




Onica Dan 

 

 

 

 

 


		
---------------------------------
Discover Yahoo!
 Have fun online with music videos, cool games, IM & more. Check it out!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20050609/e0c28217/attachment.htm>


More information about the vtkusers mailing list