<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.2800.1400" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial>Hi,</FONT></DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial>An example about displaying the cell id and point id of a 
sphere is shown below. </FONT></DIV>
<DIV><FONT face=Arial>Hope it help!</FONT></DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial>Yixun Liu</FONT></DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial>//test VTK about Volume Render<BR>//#include 
&lt;STDIO.H&gt;<BR>#include "vtkRenderer.h"<BR>#include 
"vtkRenderWindow.h"<BR>#include "vtkRenderWindowInteractor.h"<BR>#include 
"vtkVolume16Reader.h"<BR>#include "vtkPolyDataMapper.h"<BR>#include 
"vtkActor.h"<BR>#include "vtkOutlineFilter.h"<BR>#include 
"vtkCamera.h"<BR>#include "vtkProperty.h"<BR>#include 
"vtkPolyDataNormals.h"<BR>#include "vtkContourFilter.h"<BR>#include 
"vtkPoints.h"<BR>#include "vtkCellArray.h"<BR>#include 
"vtkPolyData.h"<BR>#include "vtkPolyDataMapper.h"<BR>#include 
"vtkActor.h"<BR>#include "vtkUnsignedCharArray.h"<BR>#include 
"vtkPointData.h"<BR>#include "vtkCellData.h"<BR>#include 
"vtkTiFFReader.h"<BR>#include "vtkImageViewer.h"<BR>#include 
"vtkImageFlip.h"<BR>#include "vtkStructuredPointsReader.h"<BR>#include 
"vtkImageCast.h"<BR>#include "vtkVolumeRayCastMapper.h"<BR>#include 
"vtkVolumeRayCastCompositeFunction.h"<BR>#include "vtkmath.h"<BR>#include 
"vtkDelaunay2D.h"<BR>#include "vtkExtractEdges.h"<BR>#include 
"vtkTubeFilter.h"<BR>#include "vtkSphereSource.h"<BR>#include 
"vtkGlyph3D.h"<BR>#include "vtkDelaunay3D.h"<BR>#include 
"vtkShrinkFilter.h"<BR>#include "vtkDataSetMapper.h"<BR>#include 
"vtkUnstructuredGrid.h"<BR>#include "vtkCellTypes.h"<BR>#include 
"vtkTetra.h"<BR>#include "vtkIdList.h"<BR>#include 
"vtkGenericCell.h"<BR>#include "vtkMeshQuality.h"<BR>#include 
"vtkPolyDataMapper2D.h"<BR>#include "vtkActor2D.h"<BR>#include 
"vtkIdFilter.h"<BR>#include "vtkSelectVisiblePoints.h"<BR>#include 
"vtkLabeledDataMapper.h"<BR>#include "vtkCellCenters.h"<BR>#include 
"vtkTextProperty.h"</FONT></DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial>int main(int argc, char *argv[])<BR>{<BR>//# Create a 
selection window.&nbsp; We will display the point and cell ids that<BR>//# lie 
within this window.<BR>&nbsp;int xmin = 200;<BR>&nbsp;int xLength = 
100;<BR>&nbsp;int xmax = xmin + xLength;</FONT></DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial>&nbsp;int ymin = 200;<BR>&nbsp;int yLength = 
100;<BR>&nbsp;int ymax = ymin + yLength;</FONT></DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial>&nbsp;vtkPoints *pts = 
vtkPoints::New();<BR>&nbsp;pts-&gt;InsertPoint(0, xmin, ymin, 
0);<BR>&nbsp;pts-&gt;InsertPoint(1, xmax, ymin, 
0);<BR>&nbsp;pts-&gt;InsertPoint(2, xmax, ymax, 
0);<BR>&nbsp;pts-&gt;InsertPoint(3, xmin, ymax, 0);</FONT></DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial>&nbsp;vtkCellArray *rect = 
vtkCellArray::New();<BR>&nbsp;rect-&gt;InsertNextCell(5);<BR>&nbsp;rect-&gt;InsertCellPoint(0);<BR>&nbsp;rect-&gt;InsertCellPoint(1);<BR>&nbsp;rect-&gt;InsertCellPoint(2);<BR>&nbsp;rect-&gt;InsertCellPoint(3);<BR>&nbsp;rect-&gt;InsertCellPoint(0);</FONT></DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial>&nbsp;vtkPolyData *selectRect = 
vtkPolyData::New();<BR>&nbsp;selectRect-&gt;SetPoints(pts);<BR>&nbsp;selectRect-&gt;SetLines(rect);</FONT></DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial>&nbsp;vtkPolyDataMapper2D *rectMapper = 
vtkPolyDataMapper2D::New();<BR>&nbsp;rectMapper-&gt;SetInput(selectRect);</FONT></DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial>&nbsp;vtkActor2D *rectActor = 
vtkActor2D::New();<BR>&nbsp;rectActor-&gt;SetMapper(rectMapper);</FONT></DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><BR><FONT face=Arial>//# Create a sphere and its associated mapper and 
actor.<BR>&nbsp;vtkSphereSource *sphere = 
vtkSphereSource::New();<BR>&nbsp;vtkPolyDataMapper *sphereMapper = 
vtkPolyDataMapper::New();<BR>&nbsp;sphereMapper-&gt;SetInput(sphere-&gt;GetOutput());<BR>&nbsp;sphereMapper-&gt;GlobalImmediateModeRenderingOn();<BR>&nbsp;vtkActor 
*sphereActor = 
vtkActor::New();<BR>&nbsp;sphereActor-&gt;SetMapper(sphereMapper);</FONT></DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial>//# Generate data arrays containing point and cell 
ids<BR>&nbsp;vtkIdFilter *ids = 
vtkIdFilter::New();<BR>&nbsp;ids-&gt;SetInput(sphere-&gt;GetOutput());<BR>&nbsp;ids-&gt;PointIdsOn();<BR>&nbsp;ids-&gt;CellIdsOn();<BR>&nbsp;ids-&gt;FieldDataOn();</FONT></DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial>//# Create the renderer here because 
vtkSelectVisiblePoints needs it.<BR>&nbsp;vtkRenderer *ren1 = 
vtkRenderer::New();</FONT></DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial>//# Create labels for 
points<BR>&nbsp;vtkSelectVisiblePoints *visPts = 
vtkSelectVisiblePoints::New();<BR>&nbsp;visPts-&gt;SetInput(ids-&gt;GetOutput());<BR>&nbsp;visPts-&gt;SetRenderer(ren1);<BR>&nbsp;visPts-&gt;SelectionWindowOn();<BR>&nbsp;visPts-&gt;SetSelection(xmin, 
xmax, ymin, ymax);</FONT></DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial>//# Create the mapper to display the point ids.&nbsp; 
Specify the<BR>//# format to use for the labels.&nbsp; Also create the 
associated actor.<BR>&nbsp;vtkLabeledDataMapper *ldm = 
vtkLabeledDataMapper::New();<BR>&nbsp;ldm-&gt;SetInput(visPts-&gt;GetOutput());<BR>&nbsp;ldm-&gt;SetLabelFormat("%g");<BR>&nbsp;ldm-&gt;SetLabelModeToLabelFieldData();</FONT></DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial>&nbsp;vtkActor2D *pointLabels = 
vtkActor2D::New();<BR>&nbsp;pointLabels-&gt;SetMapper(ldm);</FONT></DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial>//# Create labels for cells<BR>&nbsp;vtkCellCenters *cc = 
vtkCellCenters::New();<BR>&nbsp;cc-&gt;SetInput(ids-&gt;GetOutput());<BR>&nbsp;vtkSelectVisiblePoints 
*visCells = 
vtkSelectVisiblePoints::New();<BR>&nbsp;visCells-&gt;SetInput(cc-&gt;GetOutput());<BR>&nbsp;visCells-&gt;SetRenderer(ren1);<BR>&nbsp;visCells-&gt;SelectionWindowOn();<BR>&nbsp;visCells-&gt;SetSelection(xmin, 
xmax, ymin, ymax);</FONT></DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial>//# Create the mapper to display the cell ids.&nbsp; 
Specify the<BR>//# format to use for the labels.&nbsp; Also create the 
associated actor.<BR>&nbsp;vtkLabeledDataMapper *cellMapper = 
vtkLabeledDataMapper::New();<BR>&nbsp;cellMapper-&gt;SetInput(visCells-&gt;GetOutput());<BR>&nbsp;cellMapper-&gt;SetLabelFormat("%g");<BR>&nbsp;cellMapper-&gt;SetLabelModeToLabelFieldData();<BR>&nbsp;cellMapper-&gt;GetLabelTextProperty()-&gt;SetColor(0, 
1, 0);<BR>&nbsp;vtkActor2D *cellLabels = 
vtkActor2D::New();<BR>&nbsp;cellLabels-&gt;SetMapper(cellMapper);</FONT></DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial>//# Create the RenderWindow and 
RenderWindowInteractor<BR>&nbsp;vtkRenderWindow *renWin = 
vtkRenderWindow::New();<BR>&nbsp;renWin-&gt;AddRenderer(ren1);<BR>&nbsp;<BR>&nbsp;vtkRenderWindowInteractor 
*iren = 
vtkRenderWindowInteractor::New();<BR>&nbsp;iren-&gt;SetRenderWindow(renWin);</FONT></DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial>//# Add the actors to the renderer; set the background and 
size;<BR>&nbsp;ren1-&gt;AddActor(sphereActor);<BR>&nbsp;ren1-&gt;AddActor2D(rectActor);<BR>&nbsp;ren1-&gt;AddActor2D(pointLabels);<BR>&nbsp;ren1-&gt;AddActor2D(cellLabels);</FONT></DIV>
<DIV><FONT face=Arial></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial>&nbsp;ren1-&gt;SetBackground(1, 1, 
1);<BR>&nbsp;renWin-&gt;SetSize(500, 
500);<BR>&nbsp;<BR>//&nbsp;renWin-&gt;Render();<BR>&nbsp;iren-&gt;Initialize();<BR>&nbsp;iren-&gt;Start();<BR>&nbsp;return 
0;<BR>}<BR></FONT></DIV></BODY></HTML>