[vtkusers] Query Cell ID

David E DeMarle dave.demarle at kitware.com
Tue May 15 11:59:53 EDT 2007


Hello,

The ID for a cell is defined by the application when it creates a vtkIdType
array and stores an ID for each cell into it.

So, the ID for a cell is retrieved by something like this:

vtkIdType cellID
=pvtkPolydata->GetCellData()->GetArray("My_IDs")->GetValue(index);

In the latest VTK library, one can use the GLOBALIDS attribute in
vtkDataSetAttributes to designate a particular array as the IDS. It works
like the SCALAR or VECTOR attribute. If tha application has done that them
the ID for a cell can be retrieved like this:

vtkIdType cellID =
pvtkPolydata->GetCellData()->GetGlobalIDs()->GetValue(index)

If the application has not made an ID array, then the ID is just the offset
into the array, which is "index" in your code snippet.

cheers
Dave DeMarle



On 5/15/07, Lim, Theodore <T.Lim at hw.ac.uk> wrote:
>
>  Hi Everybody,
>
> How can a vtkCell ID be reterived?
>
> It would be great if vtkCell had a function say GetID() but there isn't
> one.
>
> I can parse through the polydata to get cells:
>
> for (int index = 0; index < pvtkPolydata->GetNumberOfCells(); index++)
> {
>      vtkCell *C = pvtkPolydata->GetCell(index);
>      vtkIdType cellID = C->GetID() // how? would like but function not
> available... help!
> }
>
> Please point me in the right direction.
>
> Many thanks, Theo.
>
> _______________________________________________
> 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/20070515/7fee3681/attachment.htm>


More information about the vtkusers mailing list