[vtkusers] extracting scalars using vtkBoxWidget

Prashanth prashanth.dumpuri at vanderbilt.edu
Wed Feb 6 11:34:48 EST 2008


All,
   I'm using vtkBoxWidget to extract Scalars (attached as a CellData 
attribute to my PolyData). Currently, I loop through all the cells in my 
Polydata to see if they lie inside the planes defined by the Box Widget 
and extract the scalars if the cells lie inside. My PolyData is 
relatively large (about 320,000 cells/polygons) and this takes me about 
5 minutes every time I update the Box Widget. Is there a faster way to 
extract the scalars ? Or is there a function similar to 
vtkExtractGeometry/vtkClipDataSet but one that will clip just the scalars ?

Thanks
Prashanth

Here is a pseudo-code of what I'm doing

# place the box widget
bw = vtkBoxWidget()
bw.SetInput(PolyData)
bw.SetInteractor(ir)
bw.PlaceWidget()

# use UpdateSurface to get the scalars for the cells that lie inside the 
planes defined by the box widget
bw.AddObserver("EndInteractionEvent",UpdateSurface)

# six planes defined by the box widget
planes = vtkPlanes()

# actual definition of the UpdateSurface function
def UpdateSurface():
     bw.GetPlanes(planes)
      for idx in xrange(  PolyData.GetNumberOfCells()):
              Find Centroid of the ith cell
              f_eval = EvaluateFunction(centroid)

             if (f_eval < 0) :
                   Extract Scalars for the current cell
 
 



More information about the vtkusers mailing list