<html>
<body>
At 11:42 AM 4/4/2006, Andrea Gavana wrote:<br>
<blockquote type=cite class=cite cite="">Hello NG,<br>
<br>
I am sorry to bother you again with dumb questions,
but I have some doubt about the way I am using vtkThresold right
now...<br>
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: <br>
<br>
# Create the threshold<br>
threshold = vtk.vtkThreshold()<br>
<br>
# Give as input my vtkUnstructuredGrid<br>
threshold.SetInput(thresh)<br>
<br>
# Give the array on which performing the threshold<br>
threshold.SetInputArrayToProcess(0, 0, 0, 1, "ACTNUM")<br>
<br>
# Do the thresholding<br>
threshold.ThresholdBetween(1, 100)<br>
<br>
# Get the output<br>
thresh = threshold.GetOutput()<br>
# Do the rendering things...<br>
# IS THIS CORRECT???<br>
#<br>
<br>
surfaceMapper.SetInput(thresh)<br>
data_range = grid.GetScalarRange()<br>
surfaceMapper.SetScalarRange(data_range)<br>
surfaceMapper.SetResolveCoincidentTopologyToPolygonOffset()<br>
<br>
# Refresh the wxPython frame (also Render() the surfaceActor)<br>
MyFrame.Refresh()<br>
<br>
If there is no filter to do, I simply change the line:<br>
<br>
surfaceMapper.SetInput(thresh)<br>
<br>
With:<br>
<br>
surfaceMapper.SetInput(grid)<br>
<br>
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:<br>
<br>
thresh.GetNumberOfCells()<br>
<br>
</blockquote><br>
Where are you making the above call? Most likely the pipeline is
not up-to-date when you are calling GetNumberOfCells on the vtkThreshold
filter. Try calling Update() on this filter before calling
GetNumberOfCells().<br><br>
- Amy<br><br>
<blockquote type=cite class=cite cite="">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... <br>
<br>
Thank you for your suggestions.<br>
<br>
Andrea.<br>
<br><br>
-- <br>
"Imagination Is The Only Weapon In The War Against
Reality."<br><br>
<a href="http://xoomer.virgilio.it/infinity77/">
http://xoomer.virgilio.it/infinity77/</a><br>
<br>
_______________________________________________<br>
This is the private VTK discussion list. <br>
Please keep messages on-topic. Check the FAQ at:
<a href="http://www.vtk.org/Wiki/VTK_FAQ" eudora="autourl">
http://www.vtk.org/Wiki/VTK_FAQ</a><br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" eudora="autourl">
http://www.vtk.org/mailman/listinfo/vtkusers</a></blockquote></body>
</html>