AW: [vtkusers] Urgent!how to get data about cells,points and data attributes of vtkPolyData
Hendrik Belitz
hbelitz at darkon.info
Mon Nov 20 08:02:52 EST 2006
Hi Gao,
After
> skinExtractor->SetInputConnection(v16->GetOutputPort());
> skinExtractor->SetValue(0, 500);
you need to call skinExtractor->Update() to actually run the filter. Otherwise
> vtkPolyData *td= skinExtractor->GetOutput();
just returns an empty vtkPolyData object, since no processing has occured.
hope this helps,
Hendrik
>Dear all,
> I am using the sample Medical.cxx ,which is in the
>Examples\Medical\Cxx in vtk-5.0.0.zip. I need to write the data about cells
>, points and data attributes of vtkPolyData to a file in server side, and
>then read these data from the file to rebuild the objects of same
>vtkPolyData in client side.I do not know which member functions of the
>classe vtkPolyData I could use to read these data about cells,point ,data
>attribute of dataset. the snippet of Medical.cxx is as follows.
>
>vtkVolume16Reader *v16 = vtkVolume16Reader::New();
> v16->SetDataDimensions (64,64);
> v16->SetImageRange (1,93);
> v16->SetDataByteOrderToLittleEndian();
> v16->SetFilePrefix (argv[1]);
> v16->SetDataSpacing (3.2, 3.2, 1.5);
>
> vtkContourFilter *skinExtractor = vtkContourFilter::New();
> skinExtractor->SetInputConnection(v16->GetOutputPort());
> skinExtractor->SetValue(0, 500);
> vtkPolyData *td= skinExtractor->GetOutput();
>
>I need to get data about cells,points and data attributes of object td.So I
>wrote:
> vtkPoints* pt=td->GetPoints();
>But I found pt is NULL.
>
>When I wrote:
> vtkCellArray *vert=td->GetVerts();
> vtkCellArray *poly=td->GetPolys();
> vtkCellArray *line=td->GetLines();
> vtkCellArray *strip=td->GetStrips();
> cout <<"numofvert="<<vert->GetSize()<<endl;
> cout <<"numofpoly="<<poly->GetNumberOfCells()<<endl;
> cout <<"numofline="<<line->GetNumberOfCells()<<endl;
> cout <<"numofstrip="<<strip->GetNumberOfCells()<<endl;
>
>All the printed results are 0.
>
>I am confused.Is there anyone who could help me?Many thanks in advance.
>
>Gao Shu
>
>_________________________________________________________________
>Windows Live™ Messenger has arrived. Click here to download it for free!
>http://imagine-msn.com/messenger/launch80/?locale=en-gb
>
>_______________________________________________
>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
More information about the vtkusers
mailing list