Commit f9660d29 authored by rhaase's avatar rhaase
Browse files

changed pruning so that a list of removed edges is returned.

changed corresponding test
changed minor version number as the API breaks
parent c67afab0
......@@ -10,7 +10,7 @@
</parent>
<artifactId>SkeletonAnalysis_</artifactId>
<version>1.1.0</version>
<version>1.2.0</version>
<name>plugins/SkeletonAnalysis_.jar</name>
<description />
......
......@@ -683,12 +683,12 @@ public class SkeletonAnalyser {
return -1;
}
public SkeletonAnalyser cutLeafEdgesShorterThan(double lengthConstraint)
public ArrayList<Edge> cutLeafEdgesShorterThan(double lengthConstraint)
{
SkeletonAnalyser skeletonAnalyserCopy = new SkeletonAnalyser(this);
skeletonAnalyserCopy.removeUnneededJunctions();
ArrayList<Edge> removedEdges = new ArrayList<Edge>();
removeUnneededJunctions();
ArrayList<Vertex> leafs = skeletonAnalyserCopy.getLeafs();
ArrayList<Vertex> leafs = getLeafs();
boolean somethingDeleted = true;
while (somethingDeleted) {
......@@ -701,16 +701,17 @@ public class SkeletonAnalyser {
//new WaitForUserDialog("blub").show();
for (Vertex leaf : leafs) {
ArrayList<Edge> leafEdges = skeletonAnalyserCopy.getEdgesStartingAtJunction(leaf);
ArrayList<Edge> leafEdges = getEdgesStartingAtJunction(leaf);
if (leafEdges != null && leafEdges.size() > 0) {
Edge edge = leafEdges.get(0);
if (skeletonAnalyserCopy.getLengthOfEdge(edge) < lengthConstraint) {
if (getLengthOfEdge(edge) < lengthConstraint) {
try {
skeletonAnalyserCopy.removeLeaf(leaf);
removeLeaf(leaf);
} catch (Exception e) {
System.out.println("Error: " + e.toString());
return null;
}
removedEdges.add(edge);
somethingDeleted = true;
break;
}
......@@ -719,8 +720,8 @@ public class SkeletonAnalyser {
}
// cleanup after all short leaf edges were removed.
skeletonAnalyserCopy.removeUnneededJunctions();
return skeletonAnalyserCopy;
removeUnneededJunctions();
return removedEdges;
}
/**
......
......@@ -46,7 +46,9 @@ public class PruningTest {
System.out.println("Minimum Edge length: " + getMinimumEdgeLength(skeletonAnalyser));
double minimumLengthConstraint = 5;
SkeletonAnalyser skeletonAnalyser2 = skeletonAnalyser.cutLeafEdgesShorterThan(minimumLengthConstraint);
SkeletonAnalyser skeletonAnalyser2 = new SkeletonAnalyser(skeletonAnalyser);
skeletonAnalyser2.cutLeafEdgesShorterThan(minimumLengthConstraint);
PathDrawer.drawAllPathsToLargestJunction(skeletonAnalyser2, target, Color.red);
double newMinmumLength = getMinimumEdgeLength(skeletonAnalyser2);
......
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