Commit 60cff782 authored by rhaase's avatar rhaase
Browse files

bugfix: Sometimes, a short leaf edge remained

parent 5ea89fa8
......@@ -670,6 +670,8 @@ public class SkeletonAnalyser {
SkeletonAnalyser skeletonAnalyserCopy = new SkeletonAnalyser(skeletonAnalyser);
skeletonAnalyserCopy.removeUnneededJunctions();
ArrayList<Vertex> leafs = skeletonAnalyserCopy.getLeafs();
boolean somethingDeleted = true;
while (somethingDeleted) {
somethingDeleted = false;
......@@ -680,26 +682,26 @@ public class SkeletonAnalyser {
//target.show();
//new WaitForUserDialog("blub").show();
for (Vertex leaf : skeletonAnalyserCopy.getLeafs()) {
Edge edge = skeletonAnalyserCopy.getEdgesStartingAtJunction(leaf).get(0);
if (SkeletonAnalyser.getLengthOfEdge(edge) < lengthContraint)
{
try {
skeletonAnalyserCopy.removeLeaf(leaf);
}
catch(Exception e)
{
System.out.println("Error: " + e.toString());
return null;
for (Vertex leaf : leafs) {
ArrayList<Edge> leafEdges = skeletonAnalyserCopy.getEdgesStartingAtJunction(leaf);
if (leafEdges != null && leafEdges.size() > 0) {
Edge edge = leafEdges.get(0);
if (SkeletonAnalyser.getLengthOfEdge(edge) < lengthContraint) {
try {
skeletonAnalyserCopy.removeLeaf(leaf);
} catch (Exception e) {
System.out.println("Error: " + e.toString());
return null;
}
somethingDeleted = true;
break;
}
somethingDeleted = true;
break;
}
}
skeletonAnalyserCopy.removeUnneededJunctions();
}
// cleanup after all short leaf edges were removed.
skeletonAnalyserCopy.removeUnneededJunctions();
return skeletonAnalyserCopy;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment