Hello everyone,
I'm looking for help with java3D. I'm using the ImageJ 3D Viewer as a library for my own plugin and I need to synchronize two universes, so when one is rotated, the other one rotates as well. I tried to intercept mouse events to calculate the angles related to mouse increments, so I can forward the rotations. It almost works, but sometimes (when events are too fast) the universes get unsynchronized. I managed to lock both canvas at startup and, once everything is loaded, they are unlocked again. Nothing of it worked properly, so I went into another different idea: at mouse released event I get the transform from the source universe to set it at the other one: Transform3D volume_t3d = new Transform3D(); universeVolume.getCanvas().getView().getUserHeadToVworld(volume_t3d); The problem is that I can't find a method to SET the UserHeadToVWorld and I don't know if there is any other way to do it. Does anybody know how to do it? Any tip will be welcome, as I can't find anything useful on the internet :) Sincerelly, Juanjo Vega. |
Hi Juanjo,
> > Transform3D volume_t3d = new Transform3D(); > universeVolume.getCanvas().getView().getUserHeadToVworld(volume_t3d); > Have you tried using universeVolume.getGlobalTransform() and universeVolume.setGlobalTransform() instead? What you get (and set) is a public inner class of ij3d.DefaultUniverse, GlobalTransform, which contains as only field an array of transformations (Transform3D[] transforms), which together form the global transformations. If you're interested in the code, this is the corresponding section: http://pacific.mpi-cbg.de/cgi-bin/gitweb.cgi?p=fiji.git;a=blob;f=src-plugins/3D_Viewer/ij3d/DefaultUniverse.java;h=5f1ef40728756009c4db6fe2be74890ab32c63d3;hb=17378adde84f6a89659486117352e2ae08606d82#l379 Best, Bene |
In reply to this post by Juanjo Vega
Hi,
On Fri, 4 Jun 2010, Juanjo Vega wrote: > I'm looking for help with java3D. > > I'm using the ImageJ 3D Viewer as a library for my own plugin and I need > to synchronize two universes, so when one is rotated, the other one > rotates as well. > > I tried to intercept mouse events to calculate the angles related to > mouse increments, so I can forward the rotations. Why not use the addUniverseListener() method and add a UniverseListener: http://pacific.mpi-cbg.de/javadoc/ij3d/UniverseListener.html Most likely you want to leave all methods but transformationUpdated() empty. Ciao, Johannes |
In reply to this post by Benjamin Schmid-2
Hi,
On Fri, 2010-06-04 at 19:02 +0200, Benjamin Schmid wrote: > Hi Juanjo, > > > > > Transform3D volume_t3d = new Transform3D(); > > universeVolume.getCanvas().getView().getUserHeadToVworld(volume_t3d); > > > Have you tried using universeVolume.getGlobalTransform() and > universeVolume.setGlobalTransform() instead? universeVolume is a ji3d.Image3DUniverse. I can't find the getGlobalTransform() method in it. Is that a new method? Because I might be using an older version of your plugin... As I can see in the code the hierarchy is something like: DefaultUniverse <- DefaultAnimatableUniverse <- Image3DUniverse and both methods are public, so I should be able to access them. Thanks, Juanjo Vega. > > What you get (and set) is a public inner class of ij3d.DefaultUniverse, > GlobalTransform, which contains as only field an array of transformations > (Transform3D[] transforms), which together form the global transformations. > > If you're interested in the code, this is the corresponding section: > http://pacific.mpi-cbg.de/cgi-bin/gitweb.cgi?p=fiji.git;a=blob;f=src-plugins/3D_Viewer/ij3d/DefaultUniverse.java;h=5f1ef40728756009c4db6fe2be74890ab32c63d3;hb=17378adde84f6a89659486117352e2ae08606d82#l379 > > Best, > Bene |
Hi Juanjo,
> > > Transform3D volume_t3d = new Transform3D(); > > > universeVolume.getCanvas().getView().getUserHeadToVworld(volume_t3d); > > > > > Have you tried using universeVolume.getGlobalTransform() and > > universeVolume.setGlobalTransform() instead? > > universeVolume is a ji3d.Image3DUniverse. I can't find the > getGlobalTransform() method in it. > > Is that a new method? Because I might be using an older version of your > plugin... It's in DefaultUniverse. > > As I can see in the code the hierarchy is something like: > DefaultUniverse <- DefaultAnimatableUniverse <- Image3DUniverse > > and both methods are public, so I should be able to access them. > Best, Bene |
Hi,
On Mon, 2010-06-07 at 12:35 +0200, Benjamin Schmid wrote: > It's in DefaultUniverse. > > I see, but in the code I have there is no that method. I tried to download your plugin again to keep updated, but it's the same. Where can I download the full new .jar? > Best, > Bene Sincerelly, Juanjo. |
Juanjo,
On Mon, 7 Jun 2010, Juanjo Vega wrote: > On Mon, 2010-06-07 at 12:35 +0200, Benjamin Schmid wrote: > > > It's in DefaultUniverse. > > I see, but in the code I have there is no that method. It is in the code, but you have to instantiate a DefaultUniverse, not an Image3DUniverse, if you want to do what you want to do with it. Hth, Johannes |
In reply to this post by Juanjo Vega
Hi,
On Mon, 7 Jun 2010, Juanjo Vega wrote: > Where can I download the full new .jar? Just in case you have a very obsolete .jar, check out Fiji: http://pacific.mpi-cbg.de/ Once installed (maybe an update is needed, which should be triggered automatically), you will have the most up-to-date 3D Viewer. Ciao, Johannes |
Hi,
On Mon, 2010-06-07 at 13:01 +0200, Johannes Schindelin wrote: > Hi, > > On Mon, 7 Jun 2010, Juanjo Vega wrote: > > > Where can I download the full new .jar? > > Just in case you have a very obsolete .jar, check out Fiji: > > http://pacific.mpi-cbg.de/ > > Once installed (maybe an update is needed, which should be triggered > automatically), you will have the most up-to-date 3D Viewer. Thanks, Johannes. I did it and now I have access to those methods (Plugin has been renamed from "ImageJ_3D_Viewer" to "3D_Viewer"). Now I have a problem creating the universe. The applications hangs when I try to create the universe: Image3DUniverse universe = new Image3DUniverse(); I don't know what is going on inside the constructor, and I can't debug it because there are no sources in the jar (the previous version, ImageJ_3D_Viewer, contains the .java files). Any tip? Sorry for inconvenience. Juanjo. > > Ciao, > Johannes |
In reply to this post by dscho
Hi,
On Fri, 2010-06-04 at 18:59 +0200, Johannes Schindelin wrote: > Hi, > Why not use the addUniverseListener() method and add a UniverseListener: > > http://pacific.mpi-cbg.de/javadoc/ij3d/UniverseListener.html > > Most likely you want to leave all methods but transformationUpdated() > empty. It works better than my approach. I'll try that way. Thank you so much =) Juanjo. > > Ciao, > Johannes |
In reply to this post by Juanjo Vega
Hi,
On Mon, 7 Jun 2010, Juanjo Vega wrote: > On Mon, 2010-06-07 at 13:01 +0200, Johannes Schindelin wrote: > > > > On Mon, 7 Jun 2010, Juanjo Vega wrote: > > > > > Where can I download the full new .jar? > > > > Just in case you have a very obsolete .jar, check out Fiji: > > > > http://pacific.mpi-cbg.de/ > > > > Once installed (maybe an update is needed, which should be triggered > > automatically), you will have the most up-to-date 3D Viewer. > > Thanks, Johannes. I did it and now I have access to those methods > (Plugin has been renamed from "ImageJ_3D_Viewer" to "3D_Viewer"). ImageJ_3D_Viewer used to be standalone, but it is no longer, as there are some base functions that are useful to other plugins, too. Therefore, those base functions have been moved into a library. Thus the change in the name, to point out that something more fundamental changed, too. You will need the VIB-lib.jar now, in addition to the 3D_Viewer.jar. > Now I have a problem creating the universe. The applications hangs when > I try to create the universe: > > Image3DUniverse universe = new Image3DUniverse(); I thought that I had suggested using DefaultUniverse() instead? > I don't know what is going on inside the constructor, and I can't debug > it because there are no sources in the jar (the previous version, > ImageJ_3D_Viewer, contains the .java files). The 3D Viewer is developed in the context of Fiji. As such, the sources live in the source repository. Including them in the .jar files would just bloat the .jar files, and many users would download megabytes they do not really want nor need. I just edited the page on the Fiji Wiki to point to the repository: http://pacific.mpi-cbg.de/wiki/index.php/3D_Viewer If you want to work with the source, I strongly suggest following the documentation how to develop Fiji: http://pacific.mpi-cbg.de/wiki/index.php/Developing_Fiji Hth, Johannes |
Hi,
On Mon, 2010-06-07 at 16:28 +0200, Johannes Schindelin wrote: > ImageJ_3D_Viewer used to be standalone, but it is no longer, as there are > some base functions that are useful to other plugins, too. Therefore, > those base functions have been moved into a library. > > Thus the change in the name, to point out that something more fundamental > changed, too. You will need the VIB-lib.jar now, in addition to the > 3D_Viewer.jar. OK. It's done now. > I thought that I had suggested using DefaultUniverse() instead? Sure, but DefaultUniverse is an abstract class, so it cannot be instantiated (neither DefaultAnimatableUniverse). I used Image3DUniverse as it is below DefaultUniverse in the class hierarchy. > The 3D Viewer is developed in the context of Fiji. As such, the sources > live in the source repository. Including them in the .jar files would > just bloat the .jar files, and many users would download megabytes they do > not really want nor need. > > I just edited the page on the Fiji Wiki to point to the repository: > > http://pacific.mpi-cbg.de/wiki/index.php/3D_Viewer > > If you want to work with the source, I strongly suggest following the > documentation how to develop Fiji: > > http://pacific.mpi-cbg.de/wiki/index.php/Developing_Fiji > Thanks! > Hth, > Johannes > Sincerelly, Juanjo. |
Free forum by Nabble | Edit this page |