[vtkusers] Urgent!how to get data about cells, points and data attributes of vtkPolyData

shu gao gshu418 at hotmail.com
Mon Nov 20 07:56:46 EST 2006


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




More information about the vtkusers mailing list