From 1d4badbdc8ac4b389d730cb8def24d151a4a4af0 Mon Sep 17 00:00:00 2001 From: Tiago Ferreira Date: Mon, 30 Sep 2024 00:57:05 -0400 Subject: [PATCH] Update to 3D_Viewer 5.0.0 --- pom.xml | 12 ++++---- src/main/java/sc/fiji/snt/Path.java | 13 +++++---- .../java/sc/fiji/snt/PathAndFillManager.java | 7 +++-- .../sc/fiji/snt/QueueJumpingKeyListener.java | 2 +- src/main/java/sc/fiji/snt/SNT.java | 28 ++++++++----------- 5 files changed, 29 insertions(+), 33 deletions(-) diff --git a/pom.xml b/pom.xml index 9b8dc121..6bfc3659 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.scijava pom-scijava - 38.0.1 + 39.0.0-SNAPSHOT @@ -242,6 +242,10 @@ + + net.imagej + imagej-legacy + net.imagej ij @@ -274,10 +278,6 @@ org.scijava batch-processor - - org.scijava - j3dcore - org.scijava scijava-common @@ -295,7 +295,7 @@ script-editor - org.scijava + org.jogamp.java3d vecmath diff --git a/src/main/java/sc/fiji/snt/Path.java b/src/main/java/sc/fiji/snt/Path.java index db4752b7..18659f1c 100644 --- a/src/main/java/sc/fiji/snt/Path.java +++ b/src/main/java/sc/fiji/snt/Path.java @@ -27,6 +27,7 @@ import ij3d.Content; import ij3d.Image3DUniverse; import ij3d.Pipe; +import ij3d.Utils; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.math3.analysis.interpolation.LinearInterpolator; import org.apache.commons.math3.analysis.polynomials.PolynomialFunction; @@ -36,9 +37,9 @@ import org.apache.commons.math3.util.MathUtils; import org.scijava.util.ColorRGB; import org.scijava.util.ColorRGBA; -import org.scijava.vecmath.Color3f; -import org.scijava.vecmath.Point3f; -import org.scijava.vecmath.Vector3d; +import org.jogamp.vecmath.Color3f; +import org.jogamp.vecmath.Point3f; +import org.jogamp.vecmath.Vector3d; import sc.fiji.snt.analysis.PathProfiler; import sc.fiji.snt.annotation.BrainAnnotation; import sc.fiji.snt.gui.GuiUtils; @@ -2476,7 +2477,7 @@ private boolean is3DViewInvalid() { public Content addAsLinesTo3DViewer(final Image3DUniverse univ, final Color c, final ImagePlus colorImage) { - return addAsLinesTo3DViewer(univ, new Color3f(c), colorImage); + return addAsLinesTo3DViewer(univ, Utils.toColor3f(c), colorImage); } @Deprecated @@ -2491,7 +2492,7 @@ protected Content addAsLinesTo3DViewer(final Image3DUniverse univ, public Content addDiscsTo3DViewer(final Image3DUniverse univ, final Color c, final ImagePlus colorImage) { - return addDiscsTo3DViewer(univ, new Color3f(c), colorImage); + return addDiscsTo3DViewer(univ, Utils.toColor3f(c), colorImage); } @Deprecated @@ -2526,7 +2527,7 @@ synchronized public void addTo3DViewer(final Image3DUniverse univ, { if (c == null) throw new IllegalArgumentException( "In addTo3DViewer, Color can no longer be null"); - addTo3DViewer(univ, new Color3f(c), colorImage); + addTo3DViewer(univ, Utils.toColor3f(c), colorImage); } @Deprecated diff --git a/src/main/java/sc/fiji/snt/PathAndFillManager.java b/src/main/java/sc/fiji/snt/PathAndFillManager.java index 0e22ffd3..f191c3d7 100644 --- a/src/main/java/sc/fiji/snt/PathAndFillManager.java +++ b/src/main/java/sc/fiji/snt/PathAndFillManager.java @@ -27,6 +27,7 @@ import ij.measure.Calibration; import ij3d.Content; import ij3d.UniverseListener; +import ij3d.Utils; import net.imagej.Dataset; import net.imagej.axis.Axes; import net.imglib2.RandomAccessibleInterval; @@ -35,9 +36,9 @@ import org.jgrapht.Graphs; import org.jgrapht.traverse.DepthFirstIterator; import org.json.JSONException; -import org.scijava.java3d.View; +import org.jogamp.java3d.View; import org.scijava.util.ColorRGB; -import org.scijava.vecmath.Color3f; +import org.jogamp.vecmath.Color3f; import org.xml.sax.Attributes; import org.xml.sax.InputSource; import org.xml.sax.SAXException; @@ -3637,7 +3638,7 @@ protected void update3DViewerContents() { final boolean selected = p.isSelected(); final boolean customColor = plugin.displayCustomPathColors && p.hasCustomColor(); Color3f color3f; - if (customColor) color3f = new Color3f(p.getColor()); + if (customColor) color3f = Utils.toColor3f(p.getColor()); else if (selected) color3f = plugin.selectedColor3f; else color3f = plugin.deselectedColor3f; diff --git a/src/main/java/sc/fiji/snt/QueueJumpingKeyListener.java b/src/main/java/sc/fiji/snt/QueueJumpingKeyListener.java index 07bd8d26..c86a8a58 100644 --- a/src/main/java/sc/fiji/snt/QueueJumpingKeyListener.java +++ b/src/main/java/sc/fiji/snt/QueueJumpingKeyListener.java @@ -32,7 +32,7 @@ import javax.swing.SwingUtilities; -import org.scijava.vecmath.Point3d; +import org.jogamp.vecmath.Point3d; import ij.gui.Toolbar; import ij3d.Content; diff --git a/src/main/java/sc/fiji/snt/SNT.java b/src/main/java/sc/fiji/snt/SNT.java index 77a75cfe..44429651 100644 --- a/src/main/java/sc/fiji/snt/SNT.java +++ b/src/main/java/sc/fiji/snt/SNT.java @@ -31,10 +31,7 @@ import ij.process.ColorProcessor; import ij.process.ImageStatistics; import ij.process.ShortProcessor; -import ij3d.Content; -import ij3d.ContentConstants; -import ij3d.ContentCreator; -import ij3d.Image3DUniverse; +import ij3d.*; import io.scif.services.DatasetIOService; import net.imagej.Dataset; import net.imagej.display.ColorTables; @@ -67,9 +64,9 @@ import org.scijava.convert.ConvertService; import org.scijava.plugin.Parameter; import org.scijava.util.ColorRGB; -import org.scijava.vecmath.Color3f; -import org.scijava.vecmath.Point3d; -import org.scijava.vecmath.Point3f; +import org.jogamp.vecmath.Color3f; +import org.jogamp.vecmath.Point3d; +import org.jogamp.vecmath.Point3f; import sc.fiji.snt.event.SNTEvent; import sc.fiji.snt.event.SNTListener; import sc.fiji.snt.filter.Frangi; @@ -321,10 +318,8 @@ public String toString() { /* Colors */ private static final Color DEFAULT_SELECTED_COLOR = Color.GREEN; protected static final Color DEFAULT_DESELECTED_COLOR = Color.MAGENTA; - protected static final Color3f DEFAULT_SELECTED_COLOR3F = new Color3f( - Color.GREEN); - protected static final Color3f DEFAULT_DESELECTED_COLOR3F = new Color3f( - Color.MAGENTA); + protected static final Color3f DEFAULT_SELECTED_COLOR3F = Utils.toColor3f(Color.GREEN); + protected static final Color3f DEFAULT_DESELECTED_COLOR3F = Utils.toColor3f(Color.MAGENTA); protected Color3f selectedColor3f = DEFAULT_SELECTED_COLOR3F; protected Color3f deselectedColor3f = DEFAULT_DESELECTED_COLOR3F; protected Color selectedColor = DEFAULT_SELECTED_COLOR; @@ -2387,7 +2382,7 @@ protected void addSphere(final String name, final double x, final double y, if (use3DViewer) { final List sphere = customnode.MeshMaker.createSphere(x, y, z, radius); - univ.addTriangleMesh(sphere, new Color3f(color), name); + univ.addTriangleMesh(sphere, Utils.toColor3f(color), name); } } @@ -2916,12 +2911,11 @@ public void showCorrespondencesTo(final File tracesFile, final Color c, final String ballName = univ.getSafeContentName("ball " + done); final List sphere = customnode.MeshMaker.createSphere( np.near.x, np.near.y, np.near.z, Math.abs(x_spacing / 2)); - univ.addTriangleMesh(sphere, new Color3f(c), ballName); + univ.addTriangleMesh(sphere, Utils.toColor3f(c), ballName); } ++done; } - univ.addLineMesh(linePoints, new Color3f(Color.RED), "correspondences", - false); + univ.addLineMesh(linePoints, Utils.toColor3f(Color.RED), "correspondences", false); for (int pi = 0; pi < pafmTraces.size(); ++pi) { final Path p = pafmTraces.getPath(pi); @@ -3116,13 +3110,13 @@ protected void updateImageContent(final int resamplingFactor) { protected void setSelectedColor(final Color newColor) { selectedColor = newColor; - selectedColor3f = new Color3f(newColor); + selectedColor3f = Utils.toColor3f(newColor); updateTracingViewers(true); } protected void setDeselectedColor(final Color newColor) { deselectedColor = newColor; - deselectedColor3f = new Color3f(newColor); + deselectedColor3f = Utils.toColor3f(newColor); if (getUI() != null && getUI().recViewer != null) { getUI().recViewer.setDefaultColor(new ColorRGB(newColor.getRed(), newColor .getGreen(), newColor.getBlue()));