[vtkusers] vtkContourFilter produces no data as its output

David Doria daviddoria+vtk at gmail.com
Tue Jan 5 09:35:18 EST 2010


On Tue, Jan 5, 2010 at 12:19 AM, Rakesh Patil <rakeshthp at in.com> wrote:
>
>
>
> ---------- Original message ----------
> From:David Doria< daviddoria+vtk at gmail.com >
> Date: 04 Jan 10 19:10:45
> Subject: Re: [vtkusers] vtkContourFilter produces no data as its output
> To: rakeshthp at in.com
>
> On Mon, Jan 4, 2010 at 8:14 AM, Bill Lorensen wrote:
>> ContourFilter produces isosurfaces from the scalar data in a dataset.
>> Your unstructured grid has no scalar data as far as I can see.
>>
>>
>> On Mon, Jan 4, 2010 at 4:56 AM, Rakesh Patil wrote:
>>> Hello there
>>>
>>> After debugging for a long time, i found out that data exists till this
>>> part
>>> of code
>>>
>>>
>>> vtkPoints *pts = vtkPoints::New();
>>> pts->SetData(scatter_data); // scatter_data is an instance of
>>> vtkDoubleArray
>>> with three components
>>>
>>> unsigned int num_ids = scatter_data->GetNumbe rOfTuples();
>>>
>>> vtkPolyVertex *poly = vtkPolyVertex::New();
>>> poly->GetPointIds()->SetNumberOfIds(num_ids);
>>>
>>> for ( unsigned int i = 0; i < num_ids; i++ )
>>> poly->GetPointIds()->SetId(i,i);
>>>
>>> vtkUnstructuredGrid *ugrid = vtkUnstructuredGrid::New();
>>> ugrid->Allocate(1);
>>> ugrid->InsertNextCell (poly->GetCellType(), poly->GetP ointIds());
>>> ugrid->SetPoints(pts);
>>>
>>> vtkDelaunay2D *del = vtkDelaunay2D::New();
>>> del->SetInput(ugrid);
>>> del->SetTolerance(0.001);
>>>
>>> Once i execute, the following code,
>>>
>>> vtkContourFilter *cf = vtkContourFilter::New();
>>> cf-&g t;SetInputConnection(del->GetOutputPort());
>>> cf->GenerateValues(10, -5, 20);
>>> cf->Update();
>>>
>>> all data vanishes..
>>>
>>> I mean to say that, initially, the grid had, 22,000 points.. After
>>> traingulating, i got 20000 of cells..
>>>
>>> But after executing the contour filter class, i get 0 cells and 0 points
>>> as
>>> output.. Where the data disappears all of a sudden, i'm not able to
>>> understand.. Please i need a guidance from the most experienced and
>>> senior
>>> person.. My mind is totally blank..
>>>
>>> Thanks in advance
>>>
>>>
>>>
>>> Dear vtkusers ! Get Yourself a cool, short @in.com Email ID now!
>>> _______________________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.ht ml
>>>
>>> Please keep messages on-topic and check the VTK FAQ at:
>>> http://www.vtk.org/Wiki/VTK_FAQ
>>>
>
> As Bill said, the vtkContourFilter does this:
> http://www.vtk.org/doc/nightly/html/classvtkContourFilter.html#_details
>
> Maybe you can come up with a very simple data set and describe exactly
> what you are expecting to happen and maybe someone can point you to a
> filter that does what you're looking for.
>
> Thanks,
>
> David
> _______________________________________________
>
>
> See basically, i have a file containing lat, lon and depth/bathymetry
> values. I read them in the form x, y and z
> as a sample file, it looks like this:
>
> 71.2632 18.2712 -5
> 71.7762 18.6542 -5
> 72.1262 18.2735 -3.5
> 73.2123 19.6235 10
> 71.2612 18.2756 5.5
> 73.1122 19.7625 10
> ...
> ...
> ...
>
> it go es upto thousands of lines like this... so, based on the z
> (depth/bathymetry) values, i need to display contours..
>
> So any ideas how to go about for this..??
>

So you don't really have multiple height contours, right? You just
have a "height map" or "terrain map". Take a look at this example:
http://www.cmake.org/Wiki/VTK/Examples/Filtering/Delaunay2D

It generates data like you have and then makes a surface on the
points. Let us know if that is what you're looking for.

Thanks,

David



More information about the vtkusers mailing list