[vtkusers] Problems with displaying text

payman labbaf payman_vtk at yahoo.co.uk
Tue Nov 22 22:38:32 EST 2005


      Dear All,
   
  I've been trying to visualise a 3D data cube (e.g 3*4*5 cubes in 3 dimention please look at the attachment) and I need to display text (currently numbers but preferably any text) withing each cube. I got as far as displaying the cubes in given dimentions but I don't seem to be able to find a neat way of displaying text withing each cubes.
   
  Basically I create a vtkStructuredGrid with respect to given dimention then I create a vtkGlyph3D which has vtkCubeSource as source and my vtkStructuredGrid as input and then pass the vtkGlyph3D to the renderer and I get exactly what I need. For displaying text within cubes I tried following but still haven't found a good solution
   
  1- My first strategy was to use vtkCellCentre filter that has my vtkGlyph3D as input and outputs a vtkPolyData that has the centre of every single cell as points(6 points per cube) then I tried vtkLabelMapper to display scalar data at each point (having created scalar data with required values to be displayed). But because the vtkLabelMapper displays labels at data level and the outcome is in 2D, all the labels for every single cell is being printed and that is not what I need. I need one label for each cube at the centre of the cell that is facing the camera and I don't want to see labels for those cubes that are not in the front (That makes it not readable as sometime I need to display over 5 cubes in each dimention). I couldn't even blank the points that I don't want labels for because its a poly data and not a structured grid and even if I could it doesn't sound like a good idea
   
  2- My second idea was again to use vtkCellCentre and get the vtkPolyData whose points are at the centre of each cell and then use vtkVectorText to display the text at the centre of cells. The advantage of using vtkVectorText is that the text is a poly data visualised in 3D and a text is rendered say on a cell of a cube in the third layer, that text would not be visible because it is obstructed by the first and second layer.
  But I have 2 problems with using vtkVectorText. First problem is that I can't orient the text so it is flat in relation to its cell. Orientation of vtkVectorText can only be done through its actor. The second problem is I can't use glyph3D to display my texts because the actual string must be given to vtkVectorText before give it to the glyph3D as source and that text will be applied to all points where as in my case different text are required to be displayed for each cell.
   
  Does anyone have any idea what to do?
   
  Thanks




		
---------------------------------
To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20051123/032d9451/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: datacube.JPG
Type: image/pjpeg
Size: 41082 bytes
Desc: 2917516653-datacube.JPG
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20051123/032d9451/attachment.bin>


More information about the vtkusers mailing list