[vtkusers] vtkExtractPolyDataGeometry - help needed!

Gita Das Gita.Das at med.monash.edu.au
Wed Sep 3 22:23:55 EDT 2008


Dear Luca,

I have got a 3-D binary mask that is fed into two filters-
itkBinaryMask3DMeshSource and itkDeformableMesh3DFilter to generate 3-D
meshes. I would like to compare the output of the two filters at the
same slice number. I have extracted a slice from the 3-D mesh generated
by the filters and saved as DeformSlice.vtk and MarchingSlice.vtk. I
would like to find the overlapping area (please note that I do not want
to convert them into images and then find the area) of these two slices.
The two .vtk files contain 298 float points representing the contour of
slices.

Now the problem is 
i) when I use "inputData->SetInput(polyData2)", I get an error message
and the output(out.vtk)is same as input (polyData2).
"ERROR: In /tmp/Build/VTK/Filtering/vtkImplicitDataSet.cxx, line 77
vtkImplicitDataSet (0x8e949d8): Can't evaluate dataset!" 

ii) However, if I used "inputData->SetInput(B->GetOutput())" then there
is no error message but the output (out.vtk) contains 0 points.

Please see the code below. I suspect the data type is not proper for the
input or something else.
Any help/suggestion would be greatly appreciated.

Thank you.
Gita
PS. please note that I have similar problem in using vtkClipPolyData as
well.

  vtkPolyDataReader * reader1 = vtkPolyDataReader::New();
  reader1->SetFileName(CmdLineObj.groundFile.c_str());
  reader1->Update();
  vtkPolyData * polyData1 = reader1->GetOutput();//DeformSlice.vtk

  vtkPolyDataReader * reader2 = vtkPolyDataReader::New();
  reader2->SetFileName(CmdLineObj.meshFile.c_str());//MarchingSlice.vtk
  reader2->Update();
  vtkPolyData * polyData2 = reader2->GetOutput();

  vtkPolyDataWriter* writer1 = vtkPolyDataWriter::New();

  //vtkOBJReader *A = vtkOBJReader::New();
  //A->SetFileName(CmdLineObj.groundFile.c_str());

  //vtkOBJReader *B = vtkOBJReader::New();
  //B->SetFileName(CmdLineObj.meshFile.c_str());
 
  vtkImplicitDataSet *cutter = vtkImplicitDataSet::New();
  cutter->SetDataSet(polyData1); 

  vtkExtractPolyDataGeometry *inputData = vtkExtractPolyDataGeometry::New();
  inputData->SetInput(polyData2); 
  inputData->SetImplicitFunction(cutter);
  inputData->ExtractInsideOn();
  inputData->ExtractBoundaryCellsOn();
  inputData->Update();

  writer1->SetInput(inputData->GetOutput());
  writer1->SetFileName("out.vtk");
  writer1->Write();



More information about the vtkusers mailing list