Extracting coordinates

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Extracting coordinates

Syed Amjad
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
Reply | Threaded
Open this post in threaded view
|

Re: Extracting coordinates

Randall Hand
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 <[hidden email]> 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: <a onclick="return top.js.OpenExtLink(window,event,this)" href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank"> http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
<a onclick="return top.js.OpenExtLink(window,event,this)" href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers





--
Randall Hand
Visualization Scientist,
ERDC-MSRC Vicksburg, MS
Homepage: http://www.yeraze.com
_______________________________________________
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