<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1264" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=宋体 size=2>Hi, </FONT></DIV>
<DIV><FONT face=宋体 size=2></FONT> </DIV>
<DIV><FONT face=宋体 size=2>Following is my pipeline: But I cannot get the contour
but a grid</FONT></DIV>
<DIV><FONT face=宋体
size=2>///////////////////////////////////////////////////////////////////////////////////</FONT></DIV>
<DIV><FONT face=宋体 size=2><IMG alt="" hspace=0
src="cid:003401c3b786$15cccd70$c0a9fea9@zengqin" align=baseline
border=0></FONT></DIV>
<DIV><FONT face=宋体 size=2></FONT> </DIV>
<DIV><FONT face=宋体 size=2>int i;</FONT></DIV>
<DIV><FONT face=宋体 size=2> vtkFloatArray* pcoords =
vtkFloatArray::New();</FONT></DIV>
<DIV><FONT face=宋体 size=2> pcoords->SetNumberOfComponents(3);<BR>
pcoords->SetNumberOfTuples(10512);<BR></FONT></DIV>
<DIV><FONT face=宋体 size=2> float pts[10512][3];<BR> float * temdata =
new
float[10512]; <BR>/////////////////////////////////////////////////////////////////////////////////////<BR> nc_reader
myreader("test.dat");</FONT></DIV>
<DIV><FONT face=宋体 size=2> if (!(myreader.get_float_2d(temdata,2000)))
return false;</FONT></DIV>
<DIV><FONT face=宋体 size=2>// This is my function to read data from file, it is
OK.</FONT></DIV>
<DIV><FONT face=宋体 size=2>// The grid is global meteorological data 2.5x2.5
</FONT></DIV>
<DIV><FONT face=宋体
size=2>//////////////////////////////////////////////////////////////////////////////////////<BR>
int indexs=0;<BR> float ii,jj;<BR> for (ii =0;ii>=73 ;ii =
ii++)<BR> {<BR> for (jj = 0 ;jj<=144;jj
=jj++)<BR> {<BR> pts[jj + ii*73 ][0] = jj;pts[jj +
ii*73][1] = ii; pts[jj + ii*73][2] =
100;<BR> }<BR> <BR> }</FONT></DIV>
<DIV><FONT face=宋体 size=2></FONT> </DIV>
<DIV><FONT face=宋体 size=2> for (i=0; i<10512;
i++)<BR> {<BR> pcoords->SetTuple(i,
pts[i]);<BR> }</FONT></DIV>
<DIV><FONT face=宋体 size=2></FONT> </DIV>
<DIV><FONT face=宋体 size=2> // Create vtkPoints and assign pcoords as the
internal data array.<BR> vtkPoints* points = vtkPoints::New();<BR>
points->SetData(pcoords);</FONT></DIV>
<DIV><FONT face=宋体 size=2></FONT> </DIV>
<DIV><FONT face=宋体 size=2> // Create the cells. In this case, a cell
is a pixel with four vertices<BR><BR> vtkCellArray* cells =
vtkCellArray::New();</FONT></DIV>
<DIV><BR><FONT face=宋体 size=2> for (ii =0;ii>=73 ;ii =
ii++)<BR> {<BR> for (jj = 0 ;jj<=144;jj
=jj++)<BR> { </FONT></DIV>
<DIV><FONT face=宋体 size=2> index = jj+
ii*73;<BR> cells->InsertNextCell(4);<BR> cells->InsertCellPoint(indexs+144);<BR> cells->InsertCellPoint(indexs+144
+1);<BR> cells->InsertCellPoint(indexs);<BR> cells->InsertCellPoint(indexs+1);<BR> }<BR> <BR> }</FONT></DIV>
<DIV><FONT face=宋体 size=2></FONT> </DIV>
<DIV><FONT face=宋体 size=2> vtkIntArray* temperature =
vtkIntArray::New();<BR> temperature->SetName("Temperature");<BR>
for (i=0; i<10512; i++)<BR> {<BR>
temperature->InsertNextValue(temdata[i]);<BR>
}</FONT></DIV>
<DIV><FONT face=宋体 size=2></FONT> </DIV>
<DIV><FONT face=宋体 size=2> vtkPolyData* polydata =
vtkPolyData::New();<BR> </FONT></DIV>
<DIV><FONT face=宋体 size=2> polydata->SetPoints(points);<BR>
polydata->SetPolys(cells);<BR>
polydata->GetPointData()->SetScalars(temperature);<BR> <BR>
std::cout<<"cell size:"<<
polydata->GetNumberOfCells()<<std::endl; </FONT></DIV>
<DIV><BR><FONT face=宋体 size=2> vtkPolyDataMapper* mapper =
vtkPolyDataMapper::New();<BR> mapper->SetInput(polydata);</FONT></DIV>
<DIV><FONT face=宋体 size=2></FONT> </DIV>
<DIV><FONT face=宋体 size=2> //datarange is 4000~6000<BR>
mapper->SetScalarRange(4000, 6000);</FONT></DIV>
<DIV><FONT face=宋体 size=2></FONT> </DIV>
<DIV><FONT face=宋体 size=2> vtkActor* actor = vtkActor::New();<BR>
actor->SetMapper(mapper);<BR>
std::cout<<"fsdfs"<<std::endl;<BR> // Create the rendering
objects.<BR> vtkRenderer* ren = vtkRenderer::New();<BR>
ren->AddActor(actor);<BR>
ren->SetBackground(0.2,0.2,0.4); <BR> vtkRenderWindow* renWin =
vtkRenderWindow::New();<BR> renWin->AddRenderer(ren);</FONT></DIV>
<DIV><FONT face=宋体 size=2></FONT> </DIV>
<DIV><FONT face=宋体 size=2> vtkRenderWindowInteractor* iren =
vtkRenderWindowInteractor::New();<BR>
iren->SetRenderWindow(renWin);<BR> iren->Initialize();<BR>
iren->Start();</FONT></DIV>
<DIV><FONT face=宋体 size=2></FONT> </DIV>
<DIV><FONT face=宋体 size=2> pcoords->Delete();<BR>
points->Delete();<BR> cells->Delete();<BR>
temperature->Delete();</FONT></DIV>
<DIV><FONT face=宋体 size=2></FONT> </DIV>
<DIV><FONT face=宋体 size=2> polydata->Delete();<BR>
mapper->Delete();<BR> actor->Delete();<BR>
ren->Delete();<BR> renWin->Delete();<BR>
iren->Delete();<BR> delete []temdata;<BR> return
0;<BR>}</FONT></DIV>
<DIV><FONT face=宋体 size=2></FONT><FONT face=宋体 size=2>
<DIV><FONT face=宋体 size=2></FONT> </DIV></FONT></DIV>
<DIV><FONT face=宋体 size=2></FONT> </DIV></BODY></HTML>