Skip to content

Commit

Permalink
Update to 3D_Viewer 5.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tferr committed Sep 30, 2024
1 parent 9c6d4a0 commit 1d4badb
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 33 deletions.
12 changes: 6 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.scijava</groupId>
<artifactId>pom-scijava</artifactId>
<version>38.0.1</version>
<version>39.0.0-SNAPSHOT</version>
<relativePath />
</parent>

Expand Down Expand Up @@ -242,6 +242,10 @@
</dependency>

<!-- ImageJ dependencies -->
<dependency>
<groupId>net.imagej</groupId>
<artifactId>imagej-legacy</artifactId>
</dependency>
<dependency>
<groupId>net.imagej</groupId>
<artifactId>ij</artifactId>
Expand Down Expand Up @@ -274,10 +278,6 @@
<groupId>org.scijava</groupId>
<artifactId>batch-processor</artifactId>
</dependency>
<dependency>
<groupId>org.scijava</groupId>
<artifactId>j3dcore</artifactId>
</dependency>
<dependency>
<groupId>org.scijava</groupId>
<artifactId>scijava-common</artifactId>
Expand All @@ -295,7 +295,7 @@
<artifactId>script-editor</artifactId>
</dependency>
<dependency>
<groupId>org.scijava</groupId>
<groupId>org.jogamp.java3d</groupId>
<artifactId>vecmath</artifactId>
</dependency>
<dependency>
Expand Down
13 changes: 7 additions & 6 deletions src/main/java/sc/fiji/snt/Path.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/sc/fiji/snt/PathAndFillManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/sc/fiji/snt/QueueJumpingKeyListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
28 changes: 11 additions & 17 deletions src/main/java/sc/fiji/snt/SNT.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -2387,7 +2382,7 @@ protected void addSphere(final String name, final double x, final double y,
if (use3DViewer) {
final List<Point3f> sphere = customnode.MeshMaker.createSphere(x, y, z,
radius);
univ.addTriangleMesh(sphere, new Color3f(color), name);
univ.addTriangleMesh(sphere, Utils.toColor3f(color), name);
}
}

Expand Down Expand Up @@ -2916,12 +2911,11 @@ public void showCorrespondencesTo(final File tracesFile, final Color c,
final String ballName = univ.getSafeContentName("ball " + done);
final List<Point3f> 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);
Expand Down Expand Up @@ -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()));
Expand Down

1 comment on commit 1d4badb

@imagesc-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit has been mentioned on Image.sc Forum. There might be relevant details there:

https://forum.image.sc/t/jaunch-a-new-java-launcher-test-fiji-with-java-21/92058/89

Please sign in to comment.