[vtkusers] Extracting coordinates

Randall Hand randall.hand at gmail.com
Sun Jan 29 23:45:45 EST 2006


Here's something to try.. Right after you setup the vtkContourFilter (This
is in C++)

vtkContourFilter *contour = vtkContourFilter::New();
contour->SetInput(blah);
... configure the contour ...
contour->Update();

for(int cid = 0; cid < contour->GetOutput()->GetNumberOfCells(); cid++) {
    vtkCell *acell = contour->GetOutput()->GetCell(cid);
    printf("Polygon %i: (%i points)\n", cid, acell->GetNumberOfPoints());
    for(int pid=0; pid < acell->GetNumberOfPoints(); pid++) {
        double *point =
contour->GetOutput()->GetPoint(aCell->GetPointId(pid));
        printf("\tPoint %i: %lf, %lf, %lf\n", pid, point[0], point[1],
point[2]);
    }
}

On 1/29/06, Syed Amjad <majeed.amjad at gmail.com> wrote:
>
> Hi,
>
> I wanted to know how I can get cell or array information form vtk. I'm
> using vtkContourFilter on some data that I have read,
>
> NOW I ONLY WANT TO GET THE COORDINATES of the POLYGONS on the CONTOUR..
>
> how can I do this??
>
> I've tried GetNextCell() but it returns zero?
> I've read the class referrence and tried all the funcions but for some
> reason the data is read properly and rendered but when I try to extract the
> PolyData, I get nothing,
> ie
>
> for lets say after reading the data, I try getCells() functions I get a
> nice round 0.
>
> I know it's reading properly because it renders fine....
>
> Q:
>
> How can I get the coordinates out of the polydata once i've applied the
> contourfilter??
>
>
> Thankyou,
>
>
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
>


--
Randall Hand
Visualization Scientist,
ERDC-MSRC Vicksburg, MS
Homepage: http://www.yeraze.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060129/4ae3e012/attachment.htm>


More information about the vtkusers mailing list