Can delete cells from vtkPolyData?
Will Schroeder
will.schroeder at kitware.com
Mon Nov 15 14:32:41 EST 1999
Hi Tim-
>At 05:35 PM 11/15/99 +0000, Tim Hutton wrote:
>I'm having a little trouble understanding what I'm doing wrong. I want to
>perform a test on each cell in a vtkPolyData, to decide whether to deletit or not. vtkPolyData::DeleteCell() seems to have no effect; when I
>visualise the mesh all the cells are still there, even if I call it for all
>of them! Help!
The unstructured data structures in VTK (vtkUnstructuredGrid, vtkPolyData) have been designed to represent large collections of data in compact form. It's not easy to edit them, because typically contiguous arrays are used.
The DeleteCell() method is used to "mark" a cell deleted, even though the cell is not actually discarded (or removed from the contiguous vtkCellArray) array. You have to refer to what's being marked to determine if the cell has actually been deleted. That's a bit tricky.
If you look in vtkDecimatePro, you'll see DeleteCell() in action. DeleteCell() is used to mark triangles deleted. Later, GetCellType() is used to determine whether a cell has been deleted (i.e., whether the type has been set to VTK_EMPTY_CELL).
What's happening is this: the cell connectivity is maintained in instances of vtkCellArray. When direct access is required, vtkCellTypes is created on the fly; and when topological information (like cell neighbors) is required, the class vtkCellLinks is created. The DeleteCell() method simply marks the type in vtkCellTypes as VTK_EMPTY_CELL, but does not actually remove the data from vtkCellArray.
After marking things deleted, vtkDecimatePro makes a final pass through the data structures extracting all non-deleted cells, and then passing this data to the output. It does this because filters ignore the CellTypes information because it is not passed to the upstream filter's output (to conserve memory, mainly).
What we've been seeing lately is that the VTK users are getting very sophisticated, and are running against the limits of the design. For example: editing data - should we add a new dataset type to VTK that supports a full topological hierarchy and allows cell-by-cell, face-by-face, edge-by-edge, and/or point-by-point editing? Another idea is to modify theCellArray so that deleted cells are marked in some fashion, so the rendering classes (and other filters) skip the deleted cells. I don't know, but we're interested in feedback on this issue.
Will
-----------------------------------------------------------------------------
This is the private VTK discussion list. Please keep messages on-topic.
Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at gsao.med.ge.com>. For help, send message body containing
"info vtkusers" to the same address. Live long and prosper.
-----------------------------------------------------------------------------
More information about the vtkusers
mailing list