Contour loop boundary extraction
When contour loops touch the boundary, the loops are incomplete. Add machinery to close some loops touching the boundary.
When contour loops touch the boundary, the loops are incomplete. Add machinery to close some loops touching the boundary.