I used vtkSelectPolyData to find the center area in the circle on the surface of the tooth. But it often failed to give me a satisfying result but showed the error, Can't follow edge. The worse situation is that it crashed when I tried to access the scalar in point data. After reading the source code of vtkSelectPolyData, I realized that the algorithm in vtkSelectPolyData::RequestData can’t found a valid neighbor point for edge point, it stoped working and jump out if the event happened.

The original process looks like these steps.

1, Find the closest point on the input poly data for every point of the circle, then collect the closest point to forms loopIds.

2, Find all mesh edges which are along the loop edge lines. Stop collecting mesh edge points’ ids if the mesh edge is always orthogonal with a loop edge.

3, Mark the points around the mesh edges found in step 2 value -1 and generate a connected circle.

4, Expand the front region (red area).

So I change the logic for step 2, don’t stop collect mesh edge points’ ids, continue to explore the next loop edge point.

      if ( closest < 0 )
      {
        Log( IDebug, "numNei: ", numNei, ", id: ", id, ", i: ", i );
        m_BrokenPtId = id;
        vtkErrorMacro(<<"Can't follow edge");

//        triMesh->UnRegister(this);
//        this->Mesh->Delete();
//        neighbors->Delete();
//        edgeIds->Delete();
//        loopIds->Delete();
//        return 1;

        edgeIds->InsertNextId( nextId );
        prevId = id;
        id = nextId;
        inPts->GetPoint( id, x );
      }

I rewrote the class vtkSelectPolyData to generate a new class CUVtkSelectPolyData and used it in my project. The whole source code can be found in GitHub, vtkSelectExplore .

The new logic need to be tested, maybe it also has defects.

Categories: VTK

0 0 votes
Article Rating
Subscribe
Notify of
guest

2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Csaba
2 years ago

Hi! We just fixed this in VTK!

Tex To PDF
: convert the Latex file which suffix is tex to a PDF file

X
2
0
Would love your thoughts, please comment.x
()
x