[vtkusers] Again On vtkThreshold...

Andrea Gavana andrea.gavana at gmail.com
Tue Apr 4 11:42:22 EDT 2006


Hello NG,

    I am sorry to bother you again with dumb questions, but I have some
doubt about the way I am using vtkThresold right now...
I have a vtkUnstructuredGrid called "grid", a mapper called "surfaceMapper"
and an actor "surfaceActor". The grid is already displayed on a VTK window.
Now, suppose that the user changes the property he wishes to view, and this
property should be filtered by means of another property. This is what I do:

# Create the threshold
threshold = vtk.vtkThreshold()

# Give as input my vtkUnstructuredGrid
threshold.SetInput(thresh)

# Give the array on which performing the threshold
threshold.SetInputArrayToProcess(0, 0, 0, 1, "ACTNUM")

# Do the thresholding
threshold.ThresholdBetween(1, 100)

# Get the output
thresh = threshold.GetOutput()
# Do the rendering things...
# IS THIS CORRECT???
#

surfaceMapper.SetInput(thresh)
data_range = grid.GetScalarRange()
surfaceMapper.SetScalarRange(data_range)
surfaceMapper.SetResolveCoincidentTopologyToPolygonOffset()

# Refresh the wxPython frame (also Render() the surfaceActor)
MyFrame.Refresh()

If there is no filter to do, I simply change the line:

surfaceMapper.SetInput(thresh)

With:

surfaceMapper.SetInput(grid)

Now, apart of the problem of duplicated cells (which should be filtered out
using the threshold, so they should be invisible), every time I do:

thresh.GetNumberOfCells()

I get 0 (zero). Well, it seems to me (if I have read correctly the docs)
that vtkThreshold should return a vtkUnstructuredGrid. Well, how comes that
this output has no cells? The code seems to work and to display the right
thing (thresholded OK) until I zoom and rotate...

Thank you for your suggestions.

Andrea.


--
"Imagination Is The Only Weapon In The War Against Reality."

http://xoomer.virgilio.it/infinity77/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060404/e550589e/attachment.htm>


More information about the vtkusers mailing list