[vtkusers] Contours are not being done!

Amy Henderson amy.henderson at kitware.com
Tue Apr 20 08:55:21 EDT 2004


Hi David,

The points in your data set need to be connected together in order to be 
able to create contours. Try running either the vtkDelaunay2D or 
vtkDelaunay3D filter on your data set before you try to contour it. Also, 
you data needs to have scalar values so that it has values from which to 
compute contours.

- Amy

At 12:22 AM 4/20/2004, david  michell wrote:

>   Hi everyone,
>Iam curretnly trying to figure out to use contour filters.
>I have written something ,but when I execute it all i get is a popup 
>window saying "no data to contour".
>I dont know what is wrong, I have attached the code, please help me out.
>What Iam trying to do is create a unstructured grid of random points and 
>then draw a contour. I dont know what mistake I have done.
>Thank you,
>David Michell
>
>main()
>{
>double data[1500];
>for (int i=0;i<1500;i++)
>{
>data[i*3+0]=rand()/126345.23;
>data[i*3+1]=rand()/346345.33;
>data[i*3+2]=rand()/456345.34;
>}
>
>vtkIdType *type;
>type=new vtkIdType[500];
>for(int counter=0;counter<500;counter++)
>{
>type[counter]=counter;
>}
>
>vtkCellArray *cellarray=vtkCellArray::New();
>cellarray->Allocate(cellarray->EstimateSize(500,1));
>cellarray->InsertNextCell(500);
>cellarray->ReplaceCell(0,500,type);
>
>int celltype[500];
>memset(celltype,1,sizeof(int)*500);
>
>vtkDoubleArray *pointset=vtkDoubleArray::New();
>pointset->SetNumberOfComponents(3);
>pointset->SetNumberOfTuples(500);
>pointset->SetArray(data,1500,1);
>
>vtkPoints *points=vtkPoints::New();
>points->Allocate(1500);
>points->SetData(pointset);
>
>vtkUnstructuredGrid *grid=vtkUnstructuredGrid::New();
>grid->Allocate(1500);
>grid->SetPoints(points);
>grid->SetCells(celltype,cellarray);
>
>vtkCountourFilter *contour=vtkContourFilter::New();
>countour->SetInput(grid);
>contour->GenerateValues(13,0.0,0.42);
>
>//code for mapper ,actor renderer, render window and interactor goes here
>}
>
>
>
>
>
>
>
><http://clients.rediff.com/signature/track_sig.asp>
>[]
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20040420/5f076f41/attachment.htm>


More information about the vtkusers mailing list