[vtkusers] Re: vtkThreshold Question

Goodwin Lawlor goodwin.lawlor at ucd.ie
Fri Mar 31 10:31:05 EST 2006


Andrea Gavana wrote:
> Hello NG,
>  
>     sorry if this question is simple, but I have searched over the web 
> and I have't found anything close to what I should so. Basically, I have 
> a vtkUnstructuredGrid in which I set the cell data using some property. 
> By switching with a wxPython radiobutton I can change on the fly the 
> property displayed on the grid (like permeability, saturation, cell 
> centroids and so on). Well, my group of data has also a property called 
> "ACTNUM", that tells which cells are active (ACTNUM=1) and which are not 
> active (ACTNUM=0). Active cells should be displayed while inactive cells 
> should be hidden.
> I have succeeded to use vtkThreshold to filter out inactive cells, but 
> only when I set cell_data=ACTNUM, using something like:
>  
> grid.GetCellData().SetScalars(ACTNUM)
>  
> What I would like to do is, whatever property is displayed on screen, to 
> hide inactive cells based on ACTNUM value. For example, I would like to 
> display cell centroids property on the grid filtering out inactive 
> cells. Something like:
>  
> grid.GetCellData().SetScalars(Whatever)
> ??? Apply threshold on grid using ACTNUM ???
>  
> Is there a way to do this?
>  
> Thank you very much for your help and suggestions.
>  
> Andrea.
Hi Andrea,

You could try vtkExtractCells to filter out cells. You would have to 
loop through ACTNUM and create the appropriate vtkIdList to apply to the 
filter. Alternatively, you could try to convert your scalars to RGBA 
values, where ACTNUM determines the A value (the opacity).

hth

Goodwin




More information about the vtkusers mailing list