[vtkusers] Setting scalar point attributes in a contour
Marc Cotran
marc at cotran.ca
Sun Jun 10 12:23:06 EDT 2007
Hi Christian,
For 1) - You can use vtkMassProperties to get the number of polygons in
your isosurface. You may wish to use a vtkTriangleFilter first to ensure
that only triangle polys are present. You can also look at the
vtkPolyData instance directly. In your case,
yourContourFilter->GetOutput() is a vtkPolyData instance, which is
composed of:
* Points - a vtkPoints instance defining the geometry of the isosurface
* Cells - 4 vtkCellArray instances defining how the points are
connected together to make the isosurface's triangles, vertices,
lines, and triangle strips
You can either vtkPolyData::GetNumberOfPolys() or
vtkPolyData::GetPolys()::GetNumberOfCells. Before using any of these
methods, make sure you Update() the pipeline (eg.
yourContourFilter->Update) .
For 2) - Take a look at vtkFieldData and vtkDataObject (of which
vtkPolyData is a subclass). You can create your attribute scalar data
for the points as a vtkFieldData object, and then
vtkDataObject::SetFieldData with that object. You may wish to
vtkMapper::SetScalarVisibility(1) in order to visualize the scalars. If
you do so, you will need to vtkMapper::SetLookupTable as well.
hth
Marc
Christian Zemlin wrote:
> Dear vtk-experts,
>
> I would like to assign a scalar attribute to each vertex of an
> isosurface that I generated using vtkContourFilter.
> 1) How can I determine the number of triangles that a contour consists
> of ?
> 2) How can I assign scalar properties to a particular vertex of a contour?
>
> Thank you,
>
> Christian
>
> ------------------------------------------------------------------------
> _______________________________________________
> 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
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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
>
More information about the vtkusers
mailing list