[vtkusers] string labels on cellcenters

Raphael Walker web at busino.ch
Thu Oct 18 03:24:13 EDT 2007


Vidyadhar wrote:
> The documentation for vtkLabeledDataMapper works only with dataset 
> points. As I understand it this means it can only use PointData and not 
> CellData. May be somebody will correct me.

Hello Vidyadhar

If you start the script, you see, that you can have scalar values on the 
cell centers.
The following example shows the cell ids on the cell centers. This 
example works fine:

cc = vtk.vtkCellCenters()
cc.SetInputConnection(ids.GetOutputPort())

cellMapper = vtk.vtkLabeledDataMapper()
cellMapper.SetInputConnection(cc.GetOutputPort())
cellMapper.SetLabelFormat("%g")
cellMapper.SetLabelModeToLabelFieldData()

cellLabels = vtk.vtkActor2D()
cellLabels.SetMapper(cellMapper)

But i would like to have a sting like 'one' instead of '1'. As label on 
the cell center. but i only get 'null', with the example i posted above.

> Vidyadhar

Thank you for the input

raphael




More information about the vtkusers mailing list