@@ -676,7 +676,7 @@ public synchronized Path[] getPathsStructured() {
676676 public Collection <Tree > getTrees () {
677677 final HashMap <String , Tree > map = new HashMap <>();
678678 allPaths .forEach (p ->{
679- final Path pathToUse = ( p . getUseFitted ()) ? p . getFitted () : p ;
679+ final Path pathToUse = getVersionInUse ( p ) ;
680680 String treeID = pathToUse .getTreeLabel ();
681681 if (map .get (treeID ) == null ) {
682682 final Tree tree = new Tree ();
@@ -704,7 +704,7 @@ public Collection<Tree> getTrees() {
704704 public Tree getTree (final String treeLabel ) {
705705 final Tree tree = new Tree ();
706706 allPaths .forEach (p ->{
707- final Path pathToUse = ( p . getUseFitted ()) ? p . getFitted () : p ;
707+ final Path pathToUse = getVersionInUse ( p ) ;
708708 if (treeLabel .equals (pathToUse .getTreeLabel ()))
709709 tree .add (pathToUse );
710710 });
@@ -724,7 +724,7 @@ public Tree getTree(final String treeLabel) {
724724 public Tree getTree (final int treeId ) {
725725 final Tree tree = new Tree ();
726726 allPaths .forEach (p ->{
727- final Path pathToUse = ( p . getUseFitted ()) ? p . getFitted () : p ;
727+ final Path pathToUse = getVersionInUse ( p ) ;
728728 if (treeId == pathToUse .getTreeID ())
729729 tree .add (pathToUse );
730730 });
@@ -1971,9 +1971,7 @@ private void addImportedPathsTo3DViewer() {
19711971 // never registered) is itself the de facto path and must still be added
19721972 if (!isDeFactoPath (p ) || p .size () < 2 )
19731973 continue ;
1974- Path pathToAdd ;
1975- if (p .getUseFitted ()) pathToAdd = p .getFitted ();
1976- else pathToAdd = p ;
1974+ final Path pathToAdd = p .getVersionInUse ();
19771975 pathToAdd .addTo3DViewer (plugin .univ , SNTPrefs .deselectedPathColor (), plugin .colorImage );
19781976 }
19791977 }
@@ -3156,10 +3154,7 @@ synchronized void setPathPointsInVolume(final Collection<Path> paths,
31563154 for (final Path topologyPath : paths ) {
31573155 if (pixelIntensity == -1 )
31583156 actualPixelIntensity = (short ) ++label ;
3159- Path p = topologyPath ;
3160- if (topologyPath .getUseFitted ()) {
3161- p = topologyPath .getFitted ();
3162- }
3157+ final Path p = topologyPath .getVersionInUse ();
31633158 final int n = p .size ();
31643159
31653160 final ArrayList <Bresenham3D .IntegerPoint > pointsToJoin =
@@ -3266,7 +3261,8 @@ public synchronized NodeRef nearestNodeOnPaths(final Collection<Path> paths, fin
32663261
32673262 /**
32683263 * Returns the version of a path that is in use, i.e., the one that is displayed and analyzed: its fitted
3269- * flavor if {@link Path#getUseFitted()}, otherwise the path itself. Same rule as {@link Tree#Tree(Collection)}.
3264+ * flavor if {@link Path#getUseFitted()}, otherwise the path itself. Same rule as
3265+ * {@link Tree#Tree(Collection)}, which uses the collection itself as registry.
32703266 * A fitted copy whose original is registered with this manager is first resolved to that original (see
32713267 * {@link #isDeFactoPath(Path)}), so that both flavors of a path always resolve to the same version.
32723268 *
@@ -3276,7 +3272,7 @@ public synchronized NodeRef nearestNodeOnPaths(final Collection<Path> paths, fin
32763272 public synchronized Path getVersionInUse (final Path p ) {
32773273 if (p == null ) return null ;
32783274 final Path base = (p .isFittedVersionOfAnotherPath () && !isDeFactoPath (p )) ? p .getUnfitted () : p ;
3279- return base .getUseFitted () ? base . getFitted () : base ;
3275+ return base .getVersionInUse () ;
32803276 }
32813277
32823278 /**
@@ -3680,10 +3676,7 @@ public void exportToCSV(final File outputFile) throws IOException {
36803676 }
36813677 pw .print ("\r \n " );
36823678 for (final Path p : allPaths ) {
3683- Path pForLengthAndName = p ;
3684- if (p .getUseFitted ()) {
3685- pForLengthAndName = p .getFitted ();
3686- }
3679+ final Path pForLengthAndName = p .getVersionInUse ();
36873680 if (p .fittedVersionOf != null ) continue ;
36883681 SNTUtils .csvQuoteAndPrint (pw , p .getID ()); //col1: PathID
36893682 pw .print ("," );
@@ -3766,7 +3759,7 @@ protected void update3DViewerContents() {
37663759
37673760 // If path is being rendered with its own custom color, highlight it
37683761 // somehow if is being selected
3769- if ( p . getUseFitted ()) p = p .getFitted ();
3762+ p = p .getVersionInUse ();
37703763 if (p .content3D != null ) p .content3D .setShaded (!(customColor &&
37713764 selected ));
37723765
0 commit comments