Skip to content

Commit

Permalink
Merge branch 'kill-endjoins'
Browse files Browse the repository at this point in the history
  • Loading branch information
tferr committed Jul 27, 2021
2 parents f54df23 + 0e69546 commit ce64c90
Show file tree
Hide file tree
Showing 11 changed files with 351 additions and 386 deletions.
16 changes: 5 additions & 11 deletions src/main/java/sc/fiji/snt/InteractiveTracerCanvas.java
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ private void connectToEditingPath(final Path source, final Path destination) {
final PointInImage destinationRoot = destinationTree.getRoot();
// Set the correct edge directions in the merged graph
destinationGraph.setRoot(getMatchingPointInGraph(destinationRoot, destinationGraph));
final Tree newTree = destinationGraph.getTree(true);
final Tree newTree = destinationGraph.getTreeWithSamePathStructure();
enableEditMode(false);
final Calibration cal = tracerPlugin.getImagePlus().getCalibration(); // snt the instance of the plugin
newTree.list().forEach(p -> p.setSpacing(cal));
Expand Down Expand Up @@ -714,12 +714,6 @@ protected void drawOverlay(final Graphics2D g) {
if (unconfirmedSegment != null) {
unconfirmedSegment.drawPathAsPoints(this, g, getUnconfirmedPathColor(),
plane, drawDiametersXY, sliceZeroIndexed, eitherSideParameter);
if (unconfirmedSegment.endJoins != null) {
final PathNode pn = new PathNode(unconfirmedSegment, unconfirmedSegment
.size() - 1, this);
pn.setSize(spotDiameter);
pn.draw(g, getUnconfirmedPathColor());
}
}

final Path currentPathFromTracer = tracerPlugin.getCurrentPath();
Expand Down Expand Up @@ -1090,7 +1084,7 @@ protected void assignTreeRootToEditingNode(
final Tree editingTree = getTreeFromID(treeID);
final DirectedWeightedGraph editingGraph = new DirectedWeightedGraph(editingTree, false);
editingGraph.setRoot(getMatchingPointInGraph(editingNode, editingGraph));
final Tree newTree = editingGraph.getTree(true);
final Tree newTree = editingGraph.getTreeWithSamePathStructure();
enableEditMode(false);
final Calibration cal = tracerPlugin.getImagePlus().getCalibration(); // snt the instance of the plugin
newTree.list().forEach(p -> p.setSpacing(cal));
Expand Down Expand Up @@ -1122,8 +1116,8 @@ protected void splitTreeAtEditingNode(final boolean warnOnFailure) {
Graphs.addGraph(descendantGraph, descendantSubgraph);
// This also removes all related edges
editingGraph.removeAllVertices(descendantVertexSet);
final Tree ancestorTree = editingGraph.getTree(true);
final Tree descendentTree = descendantGraph.getTree(true);
final Tree ancestorTree = editingGraph.getTreeWithSamePathStructure();
final Tree descendentTree = descendantGraph.getTreeWithSamePathStructure();
enableEditMode(false);
final Calibration cal = tracerPlugin.getImagePlus().getCalibration(); // snt the instance of the plugin
ancestorTree.list().forEach(p -> p.setSpacing(cal));
Expand All @@ -1145,7 +1139,7 @@ private Tree getTreeFromID(final int treeID) {

private SWCPoint getMatchingPointInGraph(final PointInImage point, final DirectedWeightedGraph graph) {
for (final SWCPoint p : graph.vertexSet()) {
if (p.isSameLocation(point)) {
if (p.isSameLocation(point) && p.getPath().equals(point.getPath())) {
return p;
}
}
Expand Down
Loading

0 comments on commit ce64c90

Please sign in to comment.