[Insight-users] Deleting a point from a Quad Edge mesh
Mahnaz Maddah
mmaddah at synapse.sri.com
Mon Aug 23 16:45:07 EDT 2010
I've been trying to delete a point that has invalid point data
associated with it from its belonging QuadEdge mesh.
Comparing the values printed out for point and pointToBeDeleted in my
code below, it seems the right point (vertex) is being deleted, however
as soon as only one point is deleted from the mesh, my vtk polydata
writer does not work for the modified mesh (it works well if no point
gets deleted).
Could someone please verify if the following code is the right way to
delete a point and also what happens to the data associated with the
deleted point?
Thanks,
-Mahnaz
typedef
itk::QuadEdgeMeshEulerOperatorJoinVertexFunction<QuadEdgeMeshType,
QuadEdgeMeshType::QEType> jointFunctionType;
jointFunctionType::Pointer joinVertex=jointFunctionType::New();
unsigned int j=0;
while (j < mesh->GetNumberOfPoints())
{
mesh->GetPoint(j, &point);
mesh->GetPointData(j, &pointvalue);
if (pointvalue.FA ==nanVal)
{
//std::cout << j << " " << point[0] <<" " << point[1]
<< " "<< point[2] << std::endl;
joinVertex->SetInput(mesh);
if (joinVertex->Evaluate(mesh->FindEdge(j)))
{
int pid = joinVertex->GetOldPointID();
QuadEdgeMeshType::PointType pointToBeDeleted =
mesh->GetPoint(pid);
// std::cout << "Deleting "<< j << " " <<
pointToBeDeleted[0] <<" " <<pointToBeDeleted[1] << " "<<
pointToBeDeleted[2] << std::endl;
mesh->DeletePoint(pid);
}
}
j++;
}
More information about the Insight-users
mailing list