void fft_round_up(image_type& I,pos_type& from,pos_type& to) { image_type newI(fft_round_up_geometry(I.geometry())); for(int dim = 0;dim < image_type::dimension;++dim) { from[dim] = (newI.geometry()[dim]-I.geometry()[dim]) >> 1; to[dim] = from[dim] + I.geometry()[dim]; } image::draw(I,newI,from); I.swap(newI); }
void CIntersection::ApplyConvexIntersection(CSkeleton &skeleton, CVertexList &vl, IntersectionQueue &iq) { #ifdef FELKELDEBUG VTLOG("ApplyConvexIntersection\n"); #endif // create new vertex and link into current contour CVertex vtx (m_poi, *m_leftVertex, *m_rightVertex); #if VTDEBUG if(!(vtx.m_point != C3DPoint(CN_INFINITY, CN_INFINITY, CN_INFINITY))) VTLOG("%s %d Assert failed\n", __FILE__, __LINE__); #endif // Link vertex into overall chain CVertex *newNext = m_rightVertex->m_nextVertex; CVertex *newPrev = m_leftVertex->m_prevVertex; vtx.m_prevVertex = newPrev; vtx.m_nextVertex = newNext; vl.push_back (vtx); CVertex *vtxPointer = &vl.back(); newPrev->m_nextVertex = vtxPointer; newNext->m_prevVertex = vtxPointer; // Set this vertex as the higher skeleton point for the vertices which have been // removed from the active contour m_leftVertex->m_higher = vtxPointer; m_rightVertex->m_higher = vtxPointer; // mark vertices as inactive m_leftVertex->m_done = true; m_rightVertex->m_done = true; CIntersection newI(vl, *vtxPointer); if (newI.m_height != CN_INFINITY) iq.push(newI); skeleton.push_back(CSkeletonLine(*m_leftVertex, *vtxPointer)); CSkeletonLine *lLinePtr = &skeleton.back(); skeleton.push_back(CSkeletonLine (*m_rightVertex, *vtxPointer)); CSkeletonLine *rLinePtr = &skeleton.back(); lLinePtr->m_lower.m_right = m_leftVertex->m_leftSkeletonLine; lLinePtr->m_lower.m_left = m_leftVertex->m_rightSkeletonLine; lLinePtr->m_higher.m_right = rLinePtr; rLinePtr->m_lower.m_right = m_rightVertex->m_leftSkeletonLine; rLinePtr->m_lower.m_left = m_rightVertex->m_rightSkeletonLine; rLinePtr->m_higher.m_left = lLinePtr; if (m_leftVertex->m_leftSkeletonLine) m_leftVertex->m_leftSkeletonLine->m_higher.m_left = lLinePtr; if (m_leftVertex->m_rightSkeletonLine) m_leftVertex->m_rightSkeletonLine->m_higher.m_right = lLinePtr; if (m_rightVertex->m_leftSkeletonLine) m_rightVertex->m_leftSkeletonLine->m_higher.m_left = rLinePtr; if (m_rightVertex->m_rightSkeletonLine) m_rightVertex->m_rightSkeletonLine->m_higher.m_right = rLinePtr; vtxPointer->m_leftSkeletonLine = lLinePtr; vtxPointer->m_rightSkeletonLine = rLinePtr; m_leftVertex->m_advancingSkeletonLine = lLinePtr; m_rightVertex->m_advancingSkeletonLine = rLinePtr; }