[vtkusers] Again On vtkThreshold...
Andrea Gavana
andrea.gavana at gmail.com
Tue Apr 4 12:06:13 EDT 2006
Hello Amy & NG,
thank you very much for your answer, yes, effectively, calling Update()
shows me the right number of cells... now I have just to figure out why in
the world I am getting duplicate cells...
Thank you very much Amy.
Andrea.
On 4/4/06, Amy Squillacote <amy.squillacote at kitware.com> wrote:
>
> 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/
>
> _______________________________________________
> 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
>
>
--
"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/fd34df3a/attachment.htm>
More information about the vtkusers
mailing list