[vtkusers] vtkContourFilter produces no data as its output
David Doria
daviddoria+vtk at gmail.com
Fri Jan 8 08:57:34 EST 2010
On Fri, Jan 8, 2010 at 12:18 AM, Rakesh Patil <rakeshthp at in.com> wrote:
>
>
>
> ---------- Original message ----------
> From:David Doria< daviddoria+vtk at gmail.com >
> Date: 05 Jan 10 20:05:18
> Subject: Re: [vtkusers] vtkContourFilter produces no data as its output
> To: rakeshthp at in.com
>
> On Tue, Jan 5, 2010 at 12:19 AM, Rakesh Patil 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 Pat il 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(), po ly->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
>>>>
> & gt;
>> 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
>> ...
>> ...
>> ...< br>>
>> 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
>
> Hi..
>
> Not exactly.. The output what i want is like the one which is produced by
>
> vtk_source/examples/ImageProcessing/Tcl/Contours2D.tcl
>
> in the vtksource directory..
>
> However, the input formats remains same..
>
> As pointer out by Bill,
>>> ContourFilter produces isosurfaces from the scalar data in a dataset.
>>> Your unstructured grid has no scalar data as far as I can see.
>
> in my case the z values can be treated as scalar values.
>
> One more thing, what do i do to reply the thread..?? I mean now i replied,
> it
> comes as a new thread.. I want my reply to come under your reply.. How do i
> do that..??
>
>
> Thanks
>
>
>
> Get Yourself a cool, short @in.com Email ID now!
Rakesh,
Your reply is in the thread as far as I can tell...
I still don't follow exactly. It still sounds like you only have one z
value per coordinate - so this is not a scalar field (which is
required to use the contour filter).
Thanks,
David
More information about the vtkusers
mailing list