void PropagatedDeformableModel::adaptationGlobale() { if (isMeshInitialized) { if (hasInitialPointAndNormals_) // bidirectional propagation { // add up and down limit to not propagate more far than centerline border if (initial_centerline.size() != 0) { CVector3 down, up; bool downBool = image3D_->TransformPhysicalPointToIndex(initial_centerline[0],down); bool upBool = image3D_->TransformPhysicalPointToIndex(initial_centerline[centerline.size()-1],up); downLimit = down[1]-2; upLimit = up[1]+2; } SpinalCord *mesh1 = propagationMesh(1); SpinalCord *mesh2 = propagationMesh(2); // meshes merging meshOutput = mergeBidirectionalSpinalCord(mesh1,mesh2); } else propagationMesh(); // unidirectional propagation } else { cout << "Error: The initial mesh is not initialized" << endl; } }
void Mesh::propagationMesh( int iVert, std::set<int> &indicesTenon, std::set<int> &indicesBord) { std::vector<int> vertices= getVerticesLiesAVertex(iVert); int indiceTest; int nbVertices=vertices.size(); for (int i=0;i<nbVertices;i++) { indiceTest=vertices[i]; if (std::find(indicesBord.begin(), indicesBord.end(), indiceTest)==indicesBord.end()) if (indicesTenon.insert(indiceTest).second) propagationMesh(indiceTest, indicesTenon, indicesBord); } }