Skip to content

Commit

Permalink
Update to 3D Viewer 5.0.0 + Java 3D 1.7.2
Browse files Browse the repository at this point in the history
And adjust for backwards-incompatible API changes.

And bump the major version from 2 to 3 due to API signature breakages
in this component -- e.g. Tree#getOriginPoint(boolean) returns Point3f,
which changed package prefix.
  • Loading branch information
ctrueden committed Sep 28, 2024
1 parent 1941776 commit d88145f
Show file tree
Hide file tree
Showing 22 changed files with 72 additions and 69 deletions.
17 changes: 10 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
<parent>
<groupId>org.scijava</groupId>
<artifactId>pom-scijava</artifactId>
<version>37.0.0</version>
<version>38.0.1</version>
<relativePath />
</parent>

<groupId>sc.fiji</groupId>
<artifactId>TrakEM2_</artifactId>
<version>1.3.11-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>

<name>TrakEM2</name>
<description>TrakEM2 plugin for ImageJ.</description>
Expand Down Expand Up @@ -147,6 +147,9 @@

<!-- NB: Deploy releases to the SciJava Maven repository. -->
<releaseProfiles>sign,deploy-to-scijava</releaseProfiles>

<_3D_Viewer.version>5.0.0</_3D_Viewer.version>
<VectorString.version>3.0.0</VectorString.version>
</properties>

<repositories>
Expand Down Expand Up @@ -214,15 +217,15 @@
<artifactId>postgresql</artifactId>
</dependency>
<dependency>
<groupId>org.scijava</groupId>
<artifactId>j3dcore</artifactId>
<groupId>org.jogamp.java3d</groupId>
<artifactId>java3d-core</artifactId>
</dependency>
<dependency>
<groupId>org.scijava</groupId>
<artifactId>j3dutils</artifactId>
<groupId>org.jogamp.java3d</groupId>
<artifactId>java3d-utils</artifactId>
</dependency>
<dependency>
<groupId>org.scijava</groupId>
<groupId>org.jogamp.java3d</groupId>
<artifactId>vecmath</artifactId>
</dependency>
<dependency>
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/ini/trakem2/analysis/Compare.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Pattern;

import org.scijava.java3d.Transform3D;
import org.scijava.vecmath.Color3f;
import org.scijava.vecmath.Matrix3d;
import org.scijava.vecmath.Matrix4d;
import org.scijava.vecmath.Point3d;
import org.scijava.vecmath.Tuple3d;
import org.scijava.vecmath.Vector3d;
import org.jogamp.java3d.Transform3D;
import org.jogamp.vecmath.Color3f;
import org.jogamp.vecmath.Matrix3d;
import org.jogamp.vecmath.Matrix4d;
import org.jogamp.vecmath.Point3d;
import org.jogamp.vecmath.Tuple3d;
import org.jogamp.vecmath.Vector3d;

import ij.IJ;
import ij.ImagePlus;
Expand Down Expand Up @@ -1883,7 +1883,7 @@ public void run() {
continue;
}

final Content sphere = d3d.getUniverse().addMesh(ij3d.Mesh_Maker.createSphere(x, y, z, r), new Color3f(heat_table.get(name)), name + "-sphere", 1);
final Content sphere = d3d.getUniverse().addMesh(ij3d.Mesh_Maker.createSphere(x, y, z, r), ij3d.Utils.toColor3f(heat_table.get(name)), name + "-sphere", 1);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ini/trakem2/display/AreaList.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;

import org.scijava.vecmath.Point3f;
import org.jogamp.vecmath.Point3f;

import amira.AmiraMeshEncoder;
import fiji.geom.AreaCalculations;
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/ini/trakem2/display/AreaTree.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;

import org.scijava.vecmath.Color3f;
import org.scijava.vecmath.Point3f;
import org.jogamp.vecmath.Color3f;
import org.jogamp.vecmath.Point3f;

import customnode.CustomTriangleMesh;
import fiji.geom.AreaCalculations;
Expand Down Expand Up @@ -592,7 +592,7 @@ public MeshData generateMesh(final double scale, final int resample) {
// Determine colors by proximity to a node, since there isn't any other way.
// TODO
Utils.log("WARNING: AreaTree multicolor 3D mesh is not yet implemented.");
final Color3f cf = new Color3f(color);
final Color3f cf = ij3d.Utils.toColor3f(color);
for (int i=0; i<ps.size(); i++) colors.add(cf);

return new MeshData(ps, colors);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/ini/trakem2/display/Ball.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
import java.util.List;
import java.util.Map;

import org.scijava.vecmath.Point3f;
import org.jogamp.vecmath.Point3f;

import ij.gui.GenericDialog;
import ij.measure.Calibration;
Expand Down Expand Up @@ -931,7 +931,7 @@ static public double[][][] generateGlobe(int meridians, int parallels) {
/** Put all balls as a single 'mesh'; the returned list contains all faces as three consecutive Point3f. The mesh is also translated by x,y,z of this Displayable.*/
public List<Point3f> generateTriangles(final double scale, final double[][][] globe) {
try {
Class.forName("org.scijava.vecmath.Point3f");
Class.forName("org.jogamp.vecmath.Point3f");
} catch (final ClassNotFoundException cnfe) {
Utils.log("Java3D is not installed.");
return null;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ini/trakem2/display/Connector.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import java.util.Map;
import java.util.Set;

import org.scijava.vecmath.Point3f;
import org.jogamp.vecmath.Point3f;

import ij.measure.Calibration;
import ij.measure.ResultsTable;
Expand Down
20 changes: 10 additions & 10 deletions src/main/java/ini/trakem2/display/Display3D.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;

import org.scijava.java3d.PolygonAttributes;
import org.scijava.java3d.Transform3D;
import org.scijava.java3d.View;
import org.scijava.vecmath.Color3f;
import org.scijava.vecmath.Point3f;
import org.jogamp.java3d.PolygonAttributes;
import org.jogamp.java3d.Transform3D;
import org.jogamp.java3d.View;
import org.jogamp.vecmath.Color3f;
import org.jogamp.vecmath.Point3f;

import customnode.CustomLineMesh;
import customnode.CustomMesh;
Expand Down Expand Up @@ -310,7 +310,7 @@ static private boolean hasLibs() {
if (check_j3d) {
check_j3d = false;
try {
Class.forName("org.scijava.vecmath.Point3f");
Class.forName("org.jogamp.vecmath.Point3f");
has_j3d_3dviewer = true;
} catch (final ClassNotFoundException cnfe) {
Utils.log("Java 3D not installed.");
Expand Down Expand Up @@ -895,7 +895,7 @@ public Content call() {
Content ct = null;

try {
final Color3f c3 = new Color3f(color);
final Color3f c3 = ij3d.Utils.toColor3f(color);

// If it exists, remove and add as new:
universe.removeContent(title);
Expand Down Expand Up @@ -996,7 +996,7 @@ public Content asContent(final Display3D d3d) {
Utils.log("WARNING: adding a 3D object fully transparent.");
}
final List<Point3f> triangles = Pipe.generateTriangles(Pipe.makeTube(vs.getPoints(0), vs.getPoints(1), vs.getPoints(2), wi, 1, 12, null), d3d.scale);
final Content ct = d3d.universe.createContent(new CustomTriangleMesh(triangles, new Color3f(color), 0), title);
final Content ct = d3d.universe.createContent(new CustomTriangleMesh(triangles, ij3d.Utils.toColor3f(color), 0), title);
ct.setTransparency(transp);
ct.setLocked(true);
return ct;
Expand Down Expand Up @@ -1125,7 +1125,7 @@ public Boolean call() {
Content content = d3d.universe.getContent(makeTitle(d));
if (null == content) content = getProfileContent(d);
if (null != content) {
content.setColor(new Color3f(color));
content.setColor(ij3d.Utils.toColor3f(color));
return true;
}
return false;
Expand Down Expand Up @@ -1237,7 +1237,7 @@ public List<Point3f> createFatPoint(final double wx, final double wy, final doub
static public final Future<Content> addFatPoint(final String title, final LayerSet ls, final double wx, final double wy, final double wz, final double wr, final Color color) {
final Display3D d3d = Display3D.get(ls);
d3d.universe.removeContent(title);
final Content ct = d3d.universe.createContent(new CustomTriangleMesh(d3d.createFatPoint(wx, wy, wz, wr, ls.getCalibrationCopy()), new Color3f(color), 0), title);
final Content ct = d3d.universe.createContent(new CustomTriangleMesh(d3d.createFatPoint(wx, wy, wz, wr, ls.getCalibrationCopy()), ij3d.Utils.toColor3f(color), 0), title);
ct.setLocked(true);
return d3d.addContent(ct);
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/ini/trakem2/display/DisplayCanvas.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;

import org.scijava.vecmath.Point2f;
import org.scijava.vecmath.Vector2f;
import org.scijava.vecmath.Vector3d;
import org.jogamp.vecmath.Point2f;
import org.jogamp.vecmath.Vector2f;
import org.jogamp.vecmath.Vector3d;

import ij.IJ;
import ij.ImagePlus;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ini/trakem2/display/Line3D.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import java.awt.Color;
import java.util.List;

import org.scijava.vecmath.Point3f;
import org.jogamp.vecmath.Point3f;

import ini.trakem2.Project;
import ini.trakem2.vector.VectorString3D;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ini/trakem2/display/Node.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
import java.util.Set;
import java.util.TreeSet;

import org.scijava.vecmath.Point3f;
import org.jogamp.vecmath.Point3f;

import ini.trakem2.Project;
import ini.trakem2.utils.IJError;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ini/trakem2/display/Pipe.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
import java.util.Iterator;
import java.util.List;

import org.scijava.vecmath.Point3f;
import org.jogamp.vecmath.Point3f;

import ij.measure.Calibration;
import ij.measure.ResultsTable;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/ini/trakem2/display/Polyline.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
import java.util.Map;
import java.util.Random;

import org.scijava.vecmath.Point3f;
import org.scijava.vecmath.Vector3d;
import org.jogamp.vecmath.Point3f;
import org.jogamp.vecmath.Vector3d;

import features.ComputeCurvatures;
import ij.IJ;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ini/trakem2/display/Profile.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
import java.util.List;
import java.util.Map;

import org.scijava.vecmath.Point3f;
import org.jogamp.vecmath.Point3f;

import ij.measure.Calibration;
import ij.measure.ResultsTable;
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/ini/trakem2/display/Tree.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@
import javax.swing.table.AbstractTableModel;
import javax.swing.table.DefaultTableCellRenderer;

import org.scijava.vecmath.Color3f;
import org.scijava.vecmath.Point3f;
import org.jogamp.vecmath.Color3f;
import org.jogamp.vecmath.Point3f;

import fiji.geom.AreaCalculations;
import ij.ImagePlus;
Expand Down Expand Up @@ -630,7 +630,7 @@ public MeshData generateSkeleton(final double scale_, final int parallels, final
// The method, by the way, is very parallelizable: each is independent.

final HashMap<Color,Color3f> cached_colors = new HashMap<Color, Color3f>();
final Color3f cf = new Color3f(this.color);
final Color3f cf = ij3d.Utils.toColor3f(this.color);
cached_colors.put(this.color, cf);

boolean go = true;
Expand Down Expand Up @@ -662,7 +662,7 @@ public MeshData generateSkeleton(final double scale_, final int parallels, final
} else {
Color3f c = cached_colors.get(node.color);
if (null == c) {
c = new Color3f(node.color);
c = ij3d.Utils.toColor3f(node.color);
cached_colors.put(node.color, c);
}
colors.add(c);
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/ini/trakem2/display/Treeline.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@
import java.util.List;
import java.util.Set;

import org.scijava.java3d.Transform3D;
import org.scijava.vecmath.AxisAngle4f;
import org.scijava.vecmath.Color3f;
import org.scijava.vecmath.Point3f;
import org.scijava.vecmath.Vector3f;
import org.jogamp.java3d.Transform3D;
import org.jogamp.vecmath.AxisAngle4f;
import org.jogamp.vecmath.Color3f;
import org.jogamp.vecmath.Point3f;
import org.jogamp.vecmath.Vector3f;

import ij.gui.GenericDialog;
import ij.measure.Calibration;
Expand Down Expand Up @@ -665,7 +665,7 @@ public MeshData generateMesh(final double scale_, int parallels) {
final AxisAngle4f aa = new AxisAngle4f();

final List<Color3f> colors = new ArrayList<Color3f>();
final Color3f cf = new Color3f(this.color);
final Color3f cf = ij3d.Utils.toColor3f(this.color);
final HashMap<Color,Color3f> cached_colors = new HashMap<Color,Color3f>();
cached_colors.put(this.color, cf);

Expand Down Expand Up @@ -733,7 +733,7 @@ public MeshData generateMesh(final double scale_, int parallels) {
} else {
c = cached_colors.get(nd.color);
if (null == c) {
c = new Color3f(nd.color);
c = ij3d.Utils.toColor3f(nd.color);
cached_colors.put(nd.color, c);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

import java.awt.event.MouseEvent;

import org.scijava.vecmath.Point3d;
import org.jogamp.vecmath.Point3d;

import ij.measure.Calibration;
import ij3d.Content;
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/ini/trakem2/display/d3d/Display3DGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
Expand All @@ -58,10 +58,10 @@
import javax.swing.table.AbstractTableModel;
import javax.swing.table.TableColumn;

import org.scijava.java3d.BranchGroup;
import org.scijava.java3d.Canvas3D;
import org.scijava.java3d.View;
import org.scijava.vecmath.Color3f;
import org.jogamp.java3d.BranchGroup;
import org.jogamp.java3d.Canvas3D;
import org.jogamp.java3d.View;
import org.jogamp.vecmath.Color3f;

import ij3d.Content;
import ij3d.Image3DUniverse;
Expand Down Expand Up @@ -149,9 +149,9 @@ public ImageWindow3D init() {
*/
static private final List<Content> getOrderedContents(final Image3DUniverse univ) {
final ArrayList<Content> cs = new ArrayList<Content>();
final Enumeration<?> seq = univ.getScene().getAllChildren();
while (seq.hasMoreElements()) {
final Object o = seq.nextElement();
final Iterator<?> seq = univ.getScene().getAllChildren();
while (seq.hasNext()) {
final Object o = seq.next();
if (o instanceof Content) cs.add((Content)o);
}
return cs;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ini/trakem2/utils/AreaUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

import org.scijava.vecmath.Point3f;
import org.jogamp.vecmath.Point3f;

import ij.ImagePlus;
import ij.gui.Roi;
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/ini/trakem2/utils/M.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
import java.util.Collection;
import java.util.List;

import org.scijava.vecmath.Point3f;
import org.scijava.vecmath.Tuple3d;
import org.scijava.vecmath.Vector3d;
import org.scijava.vecmath.Vector3f;
import org.jogamp.vecmath.Point3f;
import org.jogamp.vecmath.Tuple3d;
import org.jogamp.vecmath.Vector3d;
import org.jogamp.vecmath.Vector3f;

import ij.gui.PolygonRoi;
import ij.gui.Roi;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ini/trakem2/utils/MCCube.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import java.util.HashMap;
import java.util.List;

import org.scijava.vecmath.Point3f;
import org.jogamp.vecmath.Point3f;

import ij.IJ;
import ij3d.Volume;
Expand Down
Loading

0 comments on commit d88145f

Please sign in to comment.