[Insight-users] Deleting a point from a Quad Edge mesh
Mahnaz Maddah
mmaddah at synapse.sri.com
Mon Aug 30 16:21:18 EDT 2010
Hi Alex,
yes! it does work perfectly fine now.
thanks,
-Mahnaz
On 08/30/2010 02:09 AM, Alexandre GOUAILLARD wrote:
> hi manhaz,
>
> can you try this patch (git-am) ? That should do the trick.
>
> alex.
>
>
> On Wed, Aug 25, 2010 at 1:56 AM, Mahnaz Maddah<mmaddah at synapse.sri.com> wrote:
>> Thanks Alex. It partly worked. Seems when you delete a point from the mesh,
>> its associated data does not get deleted automatically. So when in my vtk
>> writer I call the GetPointData(idx,&pointvalue), it returns data from the
>> old point id sequence not the modified one. Should a similar Squeeze
>> function be applied to the point data container?
>>
>> QuadEdgeMeshType::PointsContainer::Pointer points = mesh->GetPoints();
>> for(QuadEdgeMeshType::PointsContainer::Iterator i = points->Begin(); i !=
>> points->End(); ++i)
>> {
>> int idx = i->Index();
>> ...
>> mesh->GetPointData(idx,&pointvalue);
>> ...
>>
>>
>> Thanks,
>> -Mahnaz
>>
>> On 08/24/2010 12:30 AM, Alexandre GOUAILLARD wrote:
>>> hi mahnaz,
>>>
>>> the vtk file writer supposes a point list whose IDs are incremental
>>> (point Ids are implicit in vtk, whereas points Ids are explicit in
>>> ITK). As soon as you delete a point, you create a gap in the IDs. To
>>> make it easier to use the writer, I implemented a mechanism in ITK
>>> that keep track of deleted points and can "squeeze" the point list so
>>> that the Ids are sequential:
>>>
>>> Its doxygen documentation is here:
>>>
>>> http://www.itk.org/Doxygen318/html/classitk_1_1QuadEdgeMesh.html#ae3b55e8ed3beb3dffb91933245a79906
>>> "
>>> void itk::QuadEdgeMesh< TPixel, VDimension, TTraits>::SqueezePointsIds ()
>>>
>>> squeeze the point container to be able to write the file properly
>>> "
>>>
>>> just call SqueezePointsIds() before you write the mesh, and you should be
>>> fine.
>>>
>>> alex.
>>>
>>>
>>>
>>> On Tue, Aug 24, 2010 at 4:45 AM, Mahnaz Maddah<mmaddah at synapse.sri.com>
>>> wrote:
>>>> 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++;
>>>> }
>>>> _____________________________________
>>>> Powered by www.kitware.com
>>>>
>>>> Visit other Kitware open-source projects at
>>>> http://www.kitware.com/opensource/opensource.html
>>>>
>>>> Kitware offers ITK Training Courses, for more information visit:
>>>> http://www.kitware.com/products/protraining.html
>>>>
>>>> Please keep messages on-topic and check the ITK FAQ at:
>>>> http://www.itk.org/Wiki/ITK_FAQ
>>>>
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://www.itk.org/mailman/listinfo/insight-users
>>>>
>>
More information about the Insight-users
mailing list