[vtkusers] Again On vtkThreshold...

Amy Squillacote amy.squillacote at kitware.com
Tue Apr 4 11:48:51 EDT 2006


At 11:42 AM 4/4/2006, Andrea Gavana wrote:
>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()
>

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().

- Amy

>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/>http://xoomer.virgilio.it/infinity77/
>
>_______________________________________________
>This is the private VTK discussion list.
>Please keep messages on-topic. Check the FAQ at: 
>http://www.vtk.org/Wiki/VTK_FAQ
>Follow this link to subscribe/unsubscribe:
>http://www.vtk.org/mailman/listinfo/vtkusers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060404/863c1f45/attachment.htm>


More information about the vtkusers mailing list