NOTICE! This is a static HTML version of a legacy Fiji BugZilla bug.

The Fiji project now uses GitHub Issues for issue tracking.

Please file all new issues there.

Bug 55 - 3D Viewer: adding Content in behaviors breaks Simple Neurite Tracer
3D Viewer: adding Content in behaviors breaks Simple Neurite Tracer
Status: RESOLVED FIXED
Product: Fiji
Classification: Unclassified
Component: Plugins
unspecified
PC Linux
: P2 normal
Assigned To: ImageJ Bugs Mailing List
Depends on:
Blocks:
 
Reported: 2009-05-03 15:20 CDT by Mark Longair
Modified: 2009-05-22 16:10 CDT
1 user (show)

See Also:

Description Mark Longair 2009-05-03 15:20:35 CDT
The Dresden-2009 release has a problem which means that the 3D view
for Simple Neurite Tracer gives a NPE each time any mesh is added to
the viewer.  I should have caught this in testing, of course, but
missed it in the rush to get -final out.  I hope that we can get
out a fix as soon as possible.

The bit in tracing.Path.addTo3DViewer that adds a path to the
3D viewer did something like:

     nameWhenAddedToViewer = univ.getSafeContentName( getName() );
     univ.resetView();
     univ.addMesh(triangles,
                  c,
                  nameWhenAddedToViewer,
                  1);
     content3D = univ.getContent(nameWhenAddedToViewer);
     content3D.setLocked(true);
     univ.resetView();
     return content3D;

The content3D returned by univ.getContent() is now null, due to the
content being added in another thread.  This can be partly fixed by just
doing content3D = addMesh().  (I think at an early stage the version
of addMesh I was using returned void, so this odd approach was at one
point necessary.)

However, a similar problem crops up sooner or later, since the
tracer sometimes calls Image3DUniverse.removeContent() very soon
after Image3DUniverse.addMesh().  removeContent(String) retrieves
the Content by its name, and sometimes the name of the Content
isn't in the Hashtable yet when that happens.  Essentially, changes
to the contents hash and the scene need to be synchronized.

I've confirmed with "git bisect" that the following commit introduces
this problem, as I thought:

  d0382a8dbdbd18905cac1214697eb537c88d31df is first bad commit
  commit d0382a8dbdbd18905cac1214697eb537c88d31df
  Author: Benjamin Schmid <bene.schmid@gmail.com>
  Date:   Wed Apr 29 17:29:57 2009 +0200
  
      3D Viewer: do the adding of Contents from within a behavior.
      
      this is to avoid the bug which currently occurrs, using the
      Mesh_Maker plugin:
      Not all contents are displayed, probably due to threading problems.
  
  :040000 040000 8bba51640c5cdb456a2533e43f6372eb1d064b08 56087c93f4154917b3945fa37e04580c7dc971d7 M      ij3d
Comment 1 Johannes Schindelin 2009-05-22 13:55:52 CDT
Is this not fixed by now?
Comment 2 Mark Longair 2009-05-22 16:10:33 CDT
Yes, it's fixed now.