I have been asked to do a 3D segmentation of a DAPI stained image, such
as the image stack available at: https://drive.google.com/open?id=0B9hvIdSL8kGyY0NiRzRkaXlINmM I find that I can do very well in 2D by blurring the image and doing peak detection, or gray-scale watershed. Gabriel Landini's domes followed by a peak detection or thresholding step also works nicely. However, I have not succeeded in extending this to 3D, using the 3D morphological segmentation tools. A 3D-domes would be nice, but I have not found that. I tried peak detection or 2D-domes and then 3D object counting, but there is still too much overlap in the Z-direction, so that nuclei which overlap vertically are counted as one object. So I seek to tap into the knowledge available on this list, because I am sure someone has already done this type of segmentation. Thanks in advance --aryeh -- Aryeh Weiss Faculty of Engineering Bar Ilan University Ramat Gan 52900 Israel Ph: 972-3-5317638 FAX: 972-3-7384051 -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
On Sunday 01 Nov 2015 15:06:28 Aryeh Weiss wrote:
> I have been asked to do a 3D segmentation of a DAPI stained image, such > as the image stack available at: > https://drive.google.com/open?id=0B9hvIdSL8kGyY0NiRzRkaXlINmM > > I find that I can do very well in 2D by blurring the image and doing > peak detection, or gray-scale watershed. > Gabriel Landini's domes followed by a peak detection or thresholding > step also works nicely. > However, I have not succeeded in extending this to 3D, using the 3D > morphological segmentation tools. > > A 3D-domes would be nice, but I have not found that. Hi Aryeh, I do not know of a 3D version of the domes, but would applying the domes algorithm to every slice of the stack do the trick? Cheers Gabriel -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Aryeh Weiss
Have you tried 3D watershed or 3D Spot Segmentation?
-- Kenneth Sloan [hidden email] Vision is the art of seeing what is invisible to others. > On Nov 1, 2015, at 08:06 , Aryeh Weiss <[hidden email]> wrote: > > I have been asked to do a 3D segmentation of a DAPI stained image, such as the image stack available at: > https://drive.google.com/open?id=0B9hvIdSL8kGyY0NiRzRkaXlINmM > > I find that I can do very well in 2D by blurring the image and doing peak detection, or gray-scale watershed. > Gabriel Landini's domes followed by a peak detection or thresholding step also works nicely. > However, I have not succeeded in extending this to 3D, using the 3D morphological segmentation tools. > > A 3D-domes would be nice, but I have not found that. > I tried peak detection or 2D-domes and then 3D object counting, but there is still too much overlap in the Z-direction, so that nuclei which > overlap vertically are counted as one object. > > So I seek to tap into the knowledge available on this list, because I am sure someone has already done this type of segmentation. > > Thanks in advance > --aryeh > > -- > Aryeh Weiss > Faculty of Engineering > Bar Ilan University > Ramat Gan 52900 Israel > > Ph: 972-3-5317638 > FAX: 972-3-7384051 > > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Aryeh Weiss
Try this:
https://www.ini.uzh.ch/~acardona/fiji-tutorial/#find-peaks Works with difference of gaussian to find peaks, in nd (the example is in 3D just like in your data). The key in DoG is to determine the two sigmas. A bit of experimentation will take you there. Albert > On Nov 1, 2015, at 8:06 AM, Aryeh Weiss <[hidden email]> wrote: > > I have been asked to do a 3D segmentation of a DAPI stained image, such as the image stack available at: > https://drive.google.com/open?id=0B9hvIdSL8kGyY0NiRzRkaXlINmM > > I find that I can do very well in 2D by blurring the image and doing peak detection, or gray-scale watershed. > Gabriel Landini's domes followed by a peak detection or thresholding step also works nicely. > However, I have not succeeded in extending this to 3D, using the 3D morphological segmentation tools. > > A 3D-domes would be nice, but I have not found that. > I tried peak detection or 2D-domes and then 3D object counting, but there is still too much overlap in the Z-direction, so that nuclei which > overlap vertically are counted as one object. > > So I seek to tap into the knowledge available on this list, because I am sure someone has already done this type of segmentation. > > Thanks in advance > --aryeh > > -- > Aryeh Weiss > Faculty of Engineering > Bar Ilan University > Ramat Gan 52900 Israel > > Ph: 972-3-5317638 > FAX: 972-3-7384051 > > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Gabriel Landini
On 01/11/2015 3:47 PM, Gabriel Landini wrote:
> On Sunday 01 Nov 2015 15:06:28 Aryeh Weiss wrote: >> I have been asked to do a 3D segmentation of a DAPI stained image, such >> as the image stack available at: >> https://drive.google.com/open?id=0B9hvIdSL8kGyY0NiRzRkaXlINmM >> >> I find that I can do very well in 2D by blurring the image and doing >> peak detection, or gray-scale watershed. >> Gabriel Landini's domes followed by a peak detection or thresholding >> step also works nicely. >> However, I have not succeeded in extending this to 3D, using the 3D >> morphological segmentation tools. >> >> A 3D-domes would be nice, but I have not found that. > Hi Aryeh, > I do not know of a 3D version of the domes, but would applying the domes > algorithm to every slice of the stack do the trick? > Cheers > > Gabriel > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > Thank you for your quick reply. I tried this with the stack version of your domes plugin. I still have the problem of how to separate the objects in Z. Never the less, that is an approach I am looking into. It seems to me that the 3D-watershed plugins should work, but I have not found the right parameters. Best regards --aryeh -- Aryeh Weiss Faculty of Engineering Bar Ilan University Ramat Gan 52900 Israel Ph: 972-3-5317638 FAX: 972-3-7384051 -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Kenneth Sloan-2
yes -- so far I have not been a able get a reasonable segmentation.
I may not understand well enough how to use them, but so far, no joy. Best regards --aryeh On 01/11/2015 3:59 PM, Kenneth Sloan wrote: > Have you tried 3D watershed or 3D Spot Segmentation? > > -- > Kenneth Sloan > [hidden email] > Vision is the art of seeing what is invisible to others. > > > > >> On Nov 1, 2015, at 08:06 , Aryeh Weiss <[hidden email]> wrote: >> >> I have been asked to do a 3D segmentation of a DAPI stained image, such as the image stack available at: >> https://drive.google.com/open?id=0B9hvIdSL8kGyY0NiRzRkaXlINmM >> >> I find that I can do very well in 2D by blurring the image and doing peak detection, or gray-scale watershed. >> Gabriel Landini's domes followed by a peak detection or thresholding step also works nicely. >> However, I have not succeeded in extending this to 3D, using the 3D morphological segmentation tools. >> >> A 3D-domes would be nice, but I have not found that. >> I tried peak detection or 2D-domes and then 3D object counting, but there is still too much overlap in the Z-direction, so that nuclei which >> overlap vertically are counted as one object. >> >> So I seek to tap into the knowledge available on this list, because I am sure someone has already done this type of segmentation. >> >> Thanks in advance >> --aryeh >> >> -- >> Aryeh Weiss >> Faculty of Engineering >> Bar Ilan University >> Ramat Gan 52900 Israel >> >> Ph: 972-3-5317638 >> FAX: 972-3-7384051 >> >> >> -- >> ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- Aryeh Weiss Faculty of Engineering Bar Ilan University Ramat Gan 52900 Israel Ph: 972-3-5317638 FAX: 972-3-7384051 -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Aryeh Weiss
Dear Aryeh,
As mentioned by other colleagues, the seed-based watershed approach seems the best for your data. The trick here, since the nuclei are here all the same size, is to use a 3D BandPass filtering so the nuclei look more homogeneous. Attached the result I obtained with 3D BandPass followed by 3D Watershed. Hope this helps, Best, Thomas On 01/11/2015 21:06, Aryeh Weiss wrote: > I have been asked to do a 3D segmentation of a DAPI stained image, > such as the image stack available at: > https://drive.google.com/open?id=0B9hvIdSL8kGyY0NiRzRkaXlINmM > > I find that I can do very well in 2D by blurring the image and doing > peak detection, or gray-scale watershed. > Gabriel Landini's domes followed by a peak detection or thresholding > step also works nicely. > However, I have not succeeded in extending this to 3D, using the 3D > morphological segmentation tools. > > A 3D-domes would be nice, but I have not found that. > I tried peak detection or 2D-domes and then 3D object counting, but > there is still too much overlap in the Z-direction, so that nuclei which > overlap vertically are counted as one object. > > So I seek to tap into the knowledge available on this list, because I > am sure someone has already done this type of segmentation. > > Thanks in advance > --aryeh > /***************************************************************/ Thomas Boudier, Associate Professor, UPMC, Université Pierre et Marie Curie, Paris, France. BioInformatics Institute (BII)/IPAL, Singapore. /**************************************************************/ -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html watershed-1.png (51K) Download Attachment |
In reply to this post by Albert Cardona-2
Hi Aryeh,
Note that the Fiji-devel mailing list is closed now in favor of the ImageJ forum. Somehow, you still had permission to post (along with some others), but I have now (I hope!) fully closed the fiji-devel list from posts from anyone whatsoever. It is always best to discuss issues in public, rather than via private mails. Albert is not the person responsible for maintaining the 3D Viewer. Note that the 3D Viewer does not currently work with Java 7 and 8 on OS X. We are working on addressing that (see https://github.com/imagej/imagej/issues/120), but it is not yet ready for prime time. Right now you have two options: 1) Use Java 6 (http://imagej.net/FAQ#How_do_I_set_up_Java_6_on_OS_X.3F); or 2) Test the new 3D Viewer based on Java 3D 1.6, downloadable from here: http://curtis.imagej.net/2015-10-06-jogl-java3d/ Which should work correctly with Java 8. (Feedback welcome!) Please feel free to continue this conversation on either the ImageJ forum ( http://forum.imagej.net/), or main ImageJ mailing list (CCed). Regards, Curtis On Mon, Nov 2, 2015 at 11:41 AM, Aryeh Weiss <[hidden email]> wrote: > Hi Albert, > > Thank you again for your reply. > > On 02/11/2015 3:59 PM, Albert Cardona wrote: > > Last I remember, when the 3D Viewer fails to run because java3D is not > installed, it should automatically prompt the user to allow an automatic > installation. > > Albert > > That is not happening -- I only get the error in the console. My > hypothesis is that some part of java3D is installed, and this makes the > system think that it is there. Alternatively, it could be yet another java > 1.8 issue. > > I found that in my Java 1.6 , the 3D viewer works, so I must have java3D > there. Unfortunately, using java 1.6, I just started getting > another problem -- the pop-up windows do not display text. This just > started, and I have not had a chance yet to characterize it, so I have not > yet formally reported this. > > How can I install java3D manually, or through the updater? > > Best regards > --aryeh > > > > > 2015-11-01 23:52 GMT-05:00 Aryeh Weiss <[hidden email]>: > >> On 01/11/2015 11:33 PM, Albert Cardona wrote: >> >> Search in the command finder for the plugin that installs java3d >> automatically. >> >> >> >> I found TestJava3D in teh command finder (and that fails, as expected). >> I could not find anything that installs it, although I found the file in >> the updater. >> >> Which command will do this? >> >> >> Best regards >> --aryeh >> >> >> >> On Nov 1, 2015, at 2:30 PM, Aryeh Weiss < <[hidden email]> >> [hidden email]> wrote: >> >> On 01/11/2015 9:15 PM, Albert Cardona wrote: >> >> Works for me. Do you have java3d installed? Please open tbh 3D viewer >> which will offer to install it automatically if not there yet. >> >> Albert >> >> >> >> When I open the 3D viewer, the following shows up in the Console: >> >> Exception in thread "J3D-Renderer-1" java.lang.UnsatisfiedLinkError: no >> jogl in java.library.path >> at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1864) >> at java.lang.Runtime.loadLibrary0(Runtime.java:870) >> at java.lang.System.loadLibrary(System.java:1122) >> at >> com.sun.opengl.impl.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:189) >> at >> com.sun.opengl.impl.NativeLibLoader.access$000(NativeLibLoader.java:49) >> at >> com.sun.opengl.impl.NativeLibLoader$DefaultAction.loadLibrary(NativeLibLoader.java:80) >> at >> com.sun.opengl.impl.NativeLibLoader.loadLibrary(NativeLibLoader.java:103) >> at >> com.sun.opengl.impl.NativeLibLoader.access$200(NativeLibLoader.java:49) >> at com.sun.opengl.impl.NativeLibLoader$1.run(NativeLibLoader.java:111) >> at java.security.AccessController.doPrivileged(Native Method) >> at >> com.sun.opengl.impl.NativeLibLoader.loadCore(NativeLibLoader.java:109) >> at >> com.sun.opengl.impl.macosx.MacOSXGLDrawableFactory.<clinit>(MacOSXGLDrawableFactory.java:53) >> at java.lang.Class.forName0(Native Method) >> at java.lang.Class.forName(Class.java:264) >> at >> javax.media.opengl.GLDrawableFactory.getFactory(GLDrawableFactory.java:108) >> at >> javax.media.j3d.JoglPipeline$QueryCanvas.<init>(JoglPipeline.java:9010) >> at >> javax.media.j3d.JoglPipeline.getBestConfiguration(JoglPipeline.java:8774) >> at javax.media.j3d.Renderer.doWork(Renderer.java:495) >> at javax.media.j3d.J3dThread.run(J3dThread.java:256) >> >> so I guess that something which Java3D needs is broken >> >> best regards >> --aryeh >> >> >> On Nov 1, 2015, at 10:42 AM, Aryeh Weiss <[hidden email]> wrote: >> >> On 01/11/2015 4:22 PM, Albert Cardona wrote: >> >> >> Try this: >> >> https://www.ini.uzh.ch/~acardona/fiji-tutorial/#find-peaks >> >> Works with difference of gaussian to find peaks, in nd (the example is in >> 3D just like in your data). >> >> The key in DoG is to determine the two sigmas. A bit of experimentation >> will take you there. >> >> Albert >> >> >> >> Thank you for your reply. I think you are referring to: >> >> Find cells in an 3D image stack by Difference of Gaussian, count them, >> and show them in 3D as spheres. >> >> I cut and paste this into my interpreter, with the modifications: >> imp = IJ.getImage() >> >> and >> >> iso = Compute.inFloats(Scale2D(ImgLib.wrap(imp), scale2D)) >> >> since I am not working on a color image. >> >> This produces a list of peaks. >> Each peak is of the form: >> array('f', [152.0, 123.0, 1.0]) >> so I assume that I can access the coordinates and do something with them. >> >> However, the script hangs (with no error - I can kill it) >> when it gets to: >> >> # Show the peaks as spheres in 3D, along with orthoslices: >> univ = Image3DUniverse(512, 512) >> print type(univ) >> univ.addIcospheres(ps, Color3f(1, 0, 0), 2, cell_diameter/2, >> "Cells").setLocked(True) >> univ.addOrthoslice(imp).setLocked(True) >> univ.show() >> >> So I have not yet seen the objects. >> >> I will continue working on it, but I dont know how to use imagelib, so I >> have to learn that. >> >> It looks promising. >> >> Best regards >> --aryeh >> >> -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Albert Cardona-2
This is an update on the problem I posted.
First, thanks to the people who replies with suggestions. From these, I am now following up on two of them. 1. Albert Cardona suggested trying the 3D (actually multi-D) difference of Gaussians (DoG) filter. This looks promising, plus it introduced me to imglib. It works great on isolated cells (actually, everything works great on isolated cells) and seems reasonable for my image, but still needs work. because I have such a dense collection of nuclei, it sometimes detects dark blobs, which are actually an approximately cell-sized island within a sea of nuclei. Albert's sample code displays the result in 3D using the 3D viewer. Unfortunately, java3D does not work in java 1.8, and in Java 1.6, while the java3D test works, the code that generates the 3D view fails -- that will go into a separate thread. The net result is that I can mark the centers of the nuclei (which is why it look promising) but I cannot visualize it in 3D to see if it really looks right. 2. Thomas Boudier suggest some 3D bandpass filtering followed by a seeded watershed. I will work more on finding the right parameters for this approach after I finish with the DoG approach. One problem is that the resolution in Z is much lower that in X-Y. As a result, the watershed does not separate the nuclei along Z. It is not clear to me why the DoG does. However, I still need to learn to to use the output of the watershed -- I may not be interpreting the output correctly. I recently got access to Imaris (basic) with a spot detector. It does a decent job, but since I don't have it on my computer, I plan to solve this with ImageJ. When I have something that works and that I can visualize, I will post it for the benefit of other who, like me, have to muddle their way from 2D to 3D. --aryeh -- Aryeh Weiss Faculty of Engineering Bar Ilan University Ramat Gan 52900 Israel Ph: 972-3-5317638 FAX: 972-3-7384051 On 01/11/2015 4:22 PM, Albert Cardona wrote: > > Try this: > > https://www.ini.uzh.ch/~acardona/fiji-tutorial/#find-peaks > > Works with difference of gaussian to find peaks, in nd (the example is > in 3D just like in your data). > > The key in DoG is to determine the two sigmas. A bit of experimentation > will take you there. > > Albert > > > On Nov 1, 2015, at 8:06 AM, Aryeh Weiss <[hidden email] > <mailto:[hidden email]>> wrote: > >> I have been asked to do a 3D segmentation of a DAPI stained image, >> such as the image stack available at: >> https://drive.google.com/open?id=0B9hvIdSL8kGyY0NiRzRkaXlINmM >> >> I find that I can do very well in 2D by blurring the image and doing >> peak detection, or gray-scale watershed. >> Gabriel Landini's domes followed by a peak detection or thresholding >> step also works nicely. >> However, I have not succeeded in extending this to 3D, using the 3D >> morphological segmentation tools. >> >> A 3D-domes would be nice, but I have not found that. >> I tried peak detection or 2D-domes and then 3D object counting, but >> there is still too much overlap in the Z-direction, so that nuclei which >> overlap vertically are counted as one object. >> >> So I seek to tap into the knowledge available on this list, because I >> am sure someone has already done this type of segmentation. >> >> Thanks in advance >> --aryeh >> >> -- >> Aryeh Weiss >> Faculty of Engineering >> Bar Ilan University >> Ramat Gan 52900 Israel >> >> Ph: 972-3-5317638 >> FAX: 972-3-7384051 >> >> >> -- >> ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by ctrueden
Hi Curtis
Thank you for your reply about java3D and java 1.8 I am following up on this as a separate thread. On 02/11/2015 7:54 PM, Curtis Rueden wrote: > Hi Aryeh, > > Note that the Fiji-devel mailing list is closed now in favor of the > ImageJ forum. Somehow, you still had permission to post (along with > some others), but I have now (I hope!) fully closed the fiji-devel > list from posts from anyone whatsoever. > > It is always best to discuss issues in public, rather than via private > mails. Albert is not the person responsible for maintaining the 3D Viewer. > > Note that the 3D Viewer does not currently work with Java 7 and 8 on > OS X. We are working on addressing that (see > https://github.com/imagej/imagej/issues/120), but it is not yet ready > for prime time. > > Right now you have two options: > > 1) Use Java 6 > (http://imagej.net/FAQ#How_do_I_set_up_Java_6_on_OS_X.3F); or > works correctly (spinning pretty box) However, the following code: # Show the peaks as spheres in 3D, along with orthoslices: univ = Image3DUniverse(1024, 1024) print type(univ) univ.addIcospheres(ps, Color3f(1, 0, 0), 2, cell_diameter/2, "Cells").setLocked(True) univ.addOrthoslice(imp).setLocked(True) univ.show() will throw the following error: Traceback (most recent call last): File "/Users/amw1/Desktop/projects/tzachAuman/dog1.py", line 105, in <module> at ij3d.shapes.BoundingBox.<init>(BoundingBox.java:66) at ij3d.shapes.BoundingBox.<init>(BoundingBox.java:34) at ij3d.shapes.BoundingBox.<init>(BoundingBox.java:30) at ij3d.ContentInstant.display(ContentInstant.java:216) at ij3d.ContentCreator.createContent(ContentCreator.java:111) at ij3d.ContentCreator.createContent(ContentCreator.java:98) at ij3d.Image3DUniverse.createContent(Image3DUniverse.java:1195) at ij3d.Image3DUniverse.addCustomMesh(Image3DUniverse.java:1163) at ij3d.Image3DUniverse.addIcospheres(Image3DUniverse.java:1285) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) java.lang.NoSuchMethodError: java.lang.NoSuchMethodError: javax.media.j3d.Shape3D.setName(Ljava/lang/String;)V at org.python.core.PyException.fillInStackTrace(PyException.java:70) at java.lang.Throwable.<init>(Throwable.java:181) at java.lang.Exception.<init>(Exception.java:29) at java.lang.RuntimeException.<init>(RuntimeException.java:32) at org.python.core.PyException.<init>(PyException.java:46) at org.python.core.PyException.<init>(PyException.java:43) at org.python.core.Py.JavaError(Py.java:495) at org.python.core.Py.JavaError(Py.java:488) at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:188) at org.python.core.PyObject.__call__(PyObject.java:345) at org.python.core.PyMethod.instancemethod___call__(PyMethod.java:220) at org.python.core.PyMethod.__call__(PyMethod.java:211) at org.python.core.PyMethod.__call__(PyMethod.java:201) at org.python.pycode._pyx0.f$0(/Users/amw1/Desktop/projects/tzachAuman/dog1.py:107) at org.python.pycode._pyx0.call_function(/Users/amw1/Desktop/projects/tzachAuman/dog1.py) at org.python.core.PyTableCode.call(PyTableCode.java:165) at org.python.core.PyCode.call(PyCode.java:18) at org.python.core.Py.runCode(Py.java:1275) at org.scijava.plugins.scripting.jython.JythonScriptEngine.eval(JythonScriptEngine.java:76) at org.scijava.script.ScriptModule.run(ScriptModule.java:174) at org.scijava.module.ModuleRunner.run(ModuleRunner.java:167) at org.scijava.module.ModuleRunner.call(ModuleRunner.java:126) at org.scijava.module.ModuleRunner.call(ModuleRunner.java:65) at org.scijava.thread.DefaultThreadService$2.call(DefaultThreadService.java:191) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) at java.lang.Thread.run(Thread.java:695) Caused by: java.lang.NoSuchMethodError: javax.media.j3d.Shape3D.setName(Ljava/lang/String;)V at ij3d.shapes.BoundingBox.<init>(BoundingBox.java:66) at ij3d.shapes.BoundingBox.<init>(BoundingBox.java:34) at ij3d.shapes.BoundingBox.<init>(BoundingBox.java:30) at ij3d.ContentInstant.display(ContentInstant.java:216) at ij3d.ContentCreator.createContent(ContentCreator.java:111) at ij3d.ContentCreator.createContent(ContentCreator.java:98) at ij3d.Image3DUniverse.createContent(Image3DUniverse.java:1195) at ij3d.Image3DUniverse.addCustomMesh(Image3DUniverse.java:1163) at ij3d.Image3DUniverse.addIcospheres(Image3DUniverse.java:1285) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:186) ... 20 more The print statement tell me that the Image3DUniverse object was created, but any of the lines after that will cause an error. > 2) Test the new 3D Viewer based on Java 3D 1.6, downloadable from here: > http://curtis.imagej.net/2015-10-06-jogl-java3d/ > Which should work correctly with Java 8. (Feedback welcome!) > I downloaded this, and ran it. Upon startup, it pops up the following message: There are obsolete java 3D libraries installed as Java extensions. The following were detected: * /System/Library/Java/Extensions/3dcore.jar * /System/Library/Java/Extensions/vecmath.jar * /System/Library/Java/Extensions/j3dutils.jar These libraries will very likely cause problems with 3D visualization. Please delete them, then restart the program. If I attempt to delete these files, I get the following message: “j3dcore.jar” can’t be modified or deleted because it’s required by OS X If I proceed naively ahead, and I test java 3D (Plugins>Utilites>Debugging>Test Java3D) the I get the following: java.lang.NoClassDefFoundError: Could not initialize class javax.media.j3d.Canvas3D at Test_Java3D.createPanel(Test_Java3D.java:34) at Test_Java3D.run(Test_Java3D.java:25) at ij.IJ.runUserPlugIn(IJ.java:212) at ij.IJ.runPlugIn(IJ.java:176) at ij.Executer.runCommand(Executer.java:132) at ij.Executer.run(Executer.java:65) at java.lang.Thread.run(Thread.java:745) Best regards --aryeh -- Aryeh Weiss Faculty of Engineering Bar Ilan University Ramat Gan 52900 Israel Ph: 972-3-5317638 FAX: 972-3-7384051 -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Running the 3Dviewer separately forced a re-installation of java3D.
Following this, the imglib code works correctly in Java 1.6. --aryeh On 05/11/2015 1:24 PM, Aryeh Weiss wrote: > Hi Curtis > > Thank you for your reply about java3D and java 1.8 > I am following up on this as a separate thread. > > On 02/11/2015 7:54 PM, Curtis Rueden wrote: >> Hi Aryeh, >> >> Note that the Fiji-devel mailing list is closed now in favor of the >> ImageJ forum. Somehow, you still had permission to post (along with >> some others), but I have now (I hope!) fully closed the fiji-devel >> list from posts from anyone whatsoever. >> >> It is always best to discuss issues in public, rather than via private >> mails. Albert is not the person responsible for maintaining the 3D >> Viewer. >> >> Note that the 3D Viewer does not currently work with Java 7 and 8 on >> OS X. We are working on addressing that (see >> https://github.com/imagej/imagej/issues/120), but it is not yet ready >> for prime time. >> >> Right now you have two options: >> >> 1) Use Java 6 >> (http://imagej.net/FAQ#How_do_I_set_up_Java_6_on_OS_X.3F); or >> > If I do this, then Plugins>Utilites>Debugging>Test Java3D > works correctly (spinning pretty box) > > However, the following code: > # Show the peaks as spheres in 3D, along with orthoslices: > univ = Image3DUniverse(1024, 1024) > print type(univ) > univ.addIcospheres(ps, Color3f(1, 0, 0), 2, cell_diameter/2, > "Cells").setLocked(True) > univ.addOrthoslice(imp).setLocked(True) > univ.show() > > will throw the following error: > Traceback (most recent call last): > File "/Users/amw1/Desktop/projects/tzachAuman/dog1.py", line 105, in > <module> > at ij3d.shapes.BoundingBox.<init>(BoundingBox.java:66) > at ij3d.shapes.BoundingBox.<init>(BoundingBox.java:34) > at ij3d.shapes.BoundingBox.<init>(BoundingBox.java:30) > at ij3d.ContentInstant.display(ContentInstant.java:216) > at ij3d.ContentCreator.createContent(ContentCreator.java:111) > at ij3d.ContentCreator.createContent(ContentCreator.java:98) > at ij3d.Image3DUniverse.createContent(Image3DUniverse.java:1195) > at ij3d.Image3DUniverse.addCustomMesh(Image3DUniverse.java:1163) > at ij3d.Image3DUniverse.addIcospheres(Image3DUniverse.java:1285) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > > at java.lang.reflect.Method.invoke(Method.java:597) > > java.lang.NoSuchMethodError: java.lang.NoSuchMethodError: > javax.media.j3d.Shape3D.setName(Ljava/lang/String;)V > > at org.python.core.PyException.fillInStackTrace(PyException.java:70) > at java.lang.Throwable.<init>(Throwable.java:181) > at java.lang.Exception.<init>(Exception.java:29) > at java.lang.RuntimeException.<init>(RuntimeException.java:32) > at org.python.core.PyException.<init>(PyException.java:46) > at org.python.core.PyException.<init>(PyException.java:43) > at org.python.core.Py.JavaError(Py.java:495) > at org.python.core.Py.JavaError(Py.java:488) > at > org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:188) > at org.python.core.PyObject.__call__(PyObject.java:345) > at org.python.core.PyMethod.instancemethod___call__(PyMethod.java:220) > at org.python.core.PyMethod.__call__(PyMethod.java:211) > at org.python.core.PyMethod.__call__(PyMethod.java:201) > at > org.python.pycode._pyx0.f$0(/Users/amw1/Desktop/projects/tzachAuman/dog1.py:107) > > at > org.python.pycode._pyx0.call_function(/Users/amw1/Desktop/projects/tzachAuman/dog1.py) > > at org.python.core.PyTableCode.call(PyTableCode.java:165) > at org.python.core.PyCode.call(PyCode.java:18) > at org.python.core.Py.runCode(Py.java:1275) > at > org.scijava.plugins.scripting.jython.JythonScriptEngine.eval(JythonScriptEngine.java:76) > > at org.scijava.script.ScriptModule.run(ScriptModule.java:174) > at org.scijava.module.ModuleRunner.run(ModuleRunner.java:167) > at org.scijava.module.ModuleRunner.call(ModuleRunner.java:126) > at org.scijava.module.ModuleRunner.call(ModuleRunner.java:65) > at > org.scijava.thread.DefaultThreadService$2.call(DefaultThreadService.java:191) > > at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) > at java.util.concurrent.FutureTask.run(FutureTask.java:138) > at > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) > > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) > > at java.lang.Thread.run(Thread.java:695) > Caused by: java.lang.NoSuchMethodError: > javax.media.j3d.Shape3D.setName(Ljava/lang/String;)V > at ij3d.shapes.BoundingBox.<init>(BoundingBox.java:66) > at ij3d.shapes.BoundingBox.<init>(BoundingBox.java:34) > at ij3d.shapes.BoundingBox.<init>(BoundingBox.java:30) > at ij3d.ContentInstant.display(ContentInstant.java:216) > at ij3d.ContentCreator.createContent(ContentCreator.java:111) > at ij3d.ContentCreator.createContent(ContentCreator.java:98) > at ij3d.Image3DUniverse.createContent(Image3DUniverse.java:1195) > at ij3d.Image3DUniverse.addCustomMesh(Image3DUniverse.java:1163) > at ij3d.Image3DUniverse.addIcospheres(Image3DUniverse.java:1285) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > > at java.lang.reflect.Method.invoke(Method.java:597) > at > org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:186) > ... 20 more > > Running the 3Dviewer separately forced a re-installation of java3D. Following this, the imglib code works correctly in java 1.6. --aryeh > The print statement tell me that the Image3DUniverse object was created, > but any of the lines after that will cause > an error. > > >> 2) Test the new 3D Viewer based on Java 3D 1.6, downloadable from here: >> http://curtis.imagej.net/2015-10-06-jogl-java3d/ >> Which should work correctly with Java 8. (Feedback welcome!) >> > I downloaded this, and ran it. > > Upon startup, it pops up the following message: > There are obsolete java 3D libraries installed as Java extensions. > The following were detected: > * /System/Library/Java/Extensions/3dcore.jar > * /System/Library/Java/Extensions/vecmath.jar > * /System/Library/Java/Extensions/j3dutils.jar > These libraries will very likely cause problems with 3D visualization. > Please delete them, then restart the program. > > > If I attempt to delete these files, I get the following message: > “j3dcore.jar” can’t be modified or deleted because it’s required by OS X > > If I proceed naively ahead, and I test java 3D > (Plugins>Utilites>Debugging>Test Java3D) > the I get the following: > > java.lang.NoClassDefFoundError: Could not initialize class > javax.media.j3d.Canvas3D > at Test_Java3D.createPanel(Test_Java3D.java:34) > at Test_Java3D.run(Test_Java3D.java:25) > at ij.IJ.runUserPlugIn(IJ.java:212) > at ij.IJ.runPlugIn(IJ.java:176) > at ij.Executer.runCommand(Executer.java:132) > at ij.Executer.run(Executer.java:65) > at java.lang.Thread.run(Thread.java:745) > > > Best regards > --aryeh > -- Aryeh Weiss Faculty of Engineering Bar Ilan University Ramat Gan 52900 Israel Ph: 972-3-5317638 FAX: 972-3-7384051 -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Aryeh Weiss
Hello Aryeh,
I am also greatly interested in getting this to work and am grateful that you are working this out publicly. Regarding the coarser Z resolution, would it help at all to re-slice the image in Z to create the appearance of isotropic pixels? I have not tried that specifically but so far I have not found satisfactory settings for the 3D watershed approach. Best, Tim Timothy Feinstein, Ph.D. Research Scientist University of Pittsburgh Department of Developmental Biology On 11/5/15, 5:58 AM, "ImageJ Interest Group on behalf of Aryeh Weiss" <[hidden email] on behalf of [hidden email]> wrote: >This is an update on the problem I posted. > >First, thanks to the people who replies with suggestions. From these, I >am now following up on two of them. > >1. Albert Cardona suggested trying the 3D (actually multi-D) difference >of Gaussians (DoG) filter. This looks promising, plus it introduced me >to imglib. It works great on isolated cells (actually, everything works >great on isolated cells) and seems reasonable for my image, but still >needs work. because I have such a dense collection of nuclei, it >sometimes detects dark blobs, which are actually an approximately >cell-sized island within a sea of nuclei. >Albert's sample code displays the result in 3D using the 3D viewer. >Unfortunately, java3D does not work in java 1.8, and in Java 1.6, while >the java3D test works, the code that generates the 3D view fails -- that >will go into a separate thread. >The net result is that I can mark the centers of the nuclei (which is >why it look promising) but I cannot visualize it in 3D to see if it >really looks right. > >2. Thomas Boudier suggest some 3D bandpass filtering followed by a >seeded watershed. I will work more on finding the right parameters for >this approach after I finish with the DoG approach. One problem is >that the resolution in Z is much lower that in X-Y. As a result, the >watershed does not separate the nuclei along Z. It is not clear to me >why the DoG does. However, I still need to learn to to use the output >of the watershed -- I may not be interpreting the output correctly. > >I recently got access to Imaris (basic) with a spot detector. It does a >decent job, but since I don't have it on my computer, I plan to solve >this with ImageJ. > >When I have something that works and that I can visualize, I will post >it for the benefit of other who, like me, have to muddle their way from >2D to 3D. > >--aryeh >-- >Aryeh Weiss >Faculty of Engineering >Bar Ilan University >Ramat Gan 52900 Israel > >Ph: 972-3-5317638 >FAX: 972-3-7384051 > >On 01/11/2015 4:22 PM, Albert Cardona wrote: >> >> Try this: >> >> https://www.ini.uzh.ch/~acardona/fiji-tutorial/#find-peaks >> >> Works with difference of gaussian to find peaks, in nd (the example is >> in 3D just like in your data). >> >> The key in DoG is to determine the two sigmas. A bit of experimentation >> will take you there. >> >> Albert >> >> >> On Nov 1, 2015, at 8:06 AM, Aryeh Weiss <[hidden email] >> <mailto:[hidden email]>> wrote: >> >>> I have been asked to do a 3D segmentation of a DAPI stained image, >>> such as the image stack available at: >>> https://drive.google.com/open?id=0B9hvIdSL8kGyY0NiRzRkaXlINmM >>> >>> I find that I can do very well in 2D by blurring the image and doing >>> peak detection, or gray-scale watershed. >>> Gabriel Landini's domes followed by a peak detection or thresholding >>> step also works nicely. >>> However, I have not succeeded in extending this to 3D, using the 3D >>> morphological segmentation tools. >>> >>> A 3D-domes would be nice, but I have not found that. >>> I tried peak detection or 2D-domes and then 3D object counting, but >>> there is still too much overlap in the Z-direction, so that nuclei >>>which >>> overlap vertically are counted as one object. >>> >>> So I seek to tap into the knowledge available on this list, because I >>> am sure someone has already done this type of segmentation. >>> >>> Thanks in advance >>> --aryeh >>> >>> -- >>> Aryeh Weiss >>> Faculty of Engineering >>> Bar Ilan University >>> Ramat Gan 52900 Israel >>> >>> Ph: 972-3-5317638 >>> FAX: 972-3-7384051 >>> >>> >>> -- >>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html > >-- >ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi Tim
Here is my latest incarnation of the DoG approach, which works on the active image. You will need to import the roimanager , or use auto-imports (bad practice -- I promise to make it right when I have a chance...) It downscales XY to be the same as Z (I tried going the other way -- then you run out of memory.) It marks each center with a point ROI. If you then flatten the image and display in the 3D viewer, you can visualize the result. Notice that I scale the point locations to work with the original image. If you are using java 1.8, comment out he last 4 lines of code. When I have a chance, I will clean it up and post some images to give you an idea of what you can expect. Best regards --aryeh # shamelessly hacked for Albert Cardona's example from script.imglib.analysis import DoGPeaks from script.imglib.color import Red from script.imglib.algorithm import Scale2D from script.imglib.math import Compute from script.imglib import ImgLib from ij3d import Image3DUniverse from javax.vecmath import Color3f, Point3f from ij import IJ cell_diameter = 4.0 # in microns minPeak = 20.0 # The minimum intensity for a peak to be considered so. imp = IJ.getImage() # Scale the X,Y axis down to isotropy with the Z axis cal = imp.getCalibration() scale2D = cal.pixelWidth / cal.pixelDepth print scale2D #iso = Compute.inFloats(Scale2D(ImgLib.wrap(imp), scale2D)) # using scale3D shold allow me to scale z in the future, instead of only downscaling XY iso = Compute.inFloats(Scale3D(ImgLib.wrap(imp), scale2D, scale2D,1 )) print type(iso) # Find peaks by difference of Gaussian sigma = (cell_diameter / cal.pixelWidth) * scale2D peaks = DoGPeaks(iso, sigma, sigma * 0.5, minPeak, 1) print "Found", len(peaks), "peaks" # Convert the peaks into points in calibrated image space ps = [] if "ROI Manager" in WindowManager.getImageTitles(): WindowManager.getWindow("ROI Manager").close() rm = RoiManager() rm.show() for peak in peaks: # imp.setSlice(int(peak[2])) p = Point3f(peak) p.scale(cal.pixelWidth * 1/scale2D) ps.append(p) print peak[2], peak.tolist(), type(p), p cellRoi = PointRoi(peak[0]/scale2D,peak[1]/scale2D) cellRoi.setPosition(int(peak[2])) rm.addRoi(cellRoi) print "Found", len(peaks), "peaks" print type(iso) # ImgLib.wrap(iso).show() # Show the peaks as spheres in 3D, along with orthoslices: univ = Image3DUniverse(1024, 1024) univ.addIcospheres(ps, Color3f(1, 0, 0), 2, cell_diameter/2, "Cells").setLocked(True) univ.addOrthoslice(imp).setLocked(True) univ.show() On 05/11/2015 4:11 PM, Feinstein, Timothy N wrote: > Hello Aryeh, > > I am also greatly interested in getting this to work and am grateful that > you are working this out publicly. Regarding the coarser Z resolution, > would it help at all to re-slice the image in Z to create the appearance > of isotropic pixels? I have not tried that specifically but so far I have > not found satisfactory settings for the 3D watershed approach. > > Best, > > > Tim > > Timothy Feinstein, Ph.D. > Research Scientist > University of Pittsburgh Department of Developmental Biology > > > > > > On 11/5/15, 5:58 AM, "ImageJ Interest Group on behalf of Aryeh Weiss" > <[hidden email] on behalf of [hidden email]> wrote: > >> This is an update on the problem I posted. >> >> First, thanks to the people who replies with suggestions. From these, I >> am now following up on two of them. >> >> 1. Albert Cardona suggested trying the 3D (actually multi-D) difference >> of Gaussians (DoG) filter. This looks promising, plus it introduced me >> to imglib. It works great on isolated cells (actually, everything works >> great on isolated cells) and seems reasonable for my image, but still >> needs work. because I have such a dense collection of nuclei, it >> sometimes detects dark blobs, which are actually an approximately >> cell-sized island within a sea of nuclei. >> Albert's sample code displays the result in 3D using the 3D viewer. >> Unfortunately, java3D does not work in java 1.8, and in Java 1.6, while >> the java3D test works, the code that generates the 3D view fails -- that >> will go into a separate thread. >> The net result is that I can mark the centers of the nuclei (which is >> why it look promising) but I cannot visualize it in 3D to see if it >> really looks right. >> >> 2. Thomas Boudier suggest some 3D bandpass filtering followed by a >> seeded watershed. I will work more on finding the right parameters for >> this approach after I finish with the DoG approach. One problem is >> that the resolution in Z is much lower that in X-Y. As a result, the >> watershed does not separate the nuclei along Z. It is not clear to me >> why the DoG does. However, I still need to learn to to use the output >> of the watershed -- I may not be interpreting the output correctly. >> >> I recently got access to Imaris (basic) with a spot detector. It does a >> decent job, but since I don't have it on my computer, I plan to solve >> this with ImageJ. >> >> When I have something that works and that I can visualize, I will post >> it for the benefit of other who, like me, have to muddle their way from >> 2D to 3D. >> >> --aryeh >> -- >> Aryeh Weiss >> Faculty of Engineering >> Bar Ilan University >> Ramat Gan 52900 Israel >> >> Ph: 972-3-5317638 >> FAX: 972-3-7384051 >> >> On 01/11/2015 4:22 PM, Albert Cardona wrote: >>> Try this: >>> >>> https://www.ini.uzh.ch/~acardona/fiji-tutorial/#find-peaks >>> >>> Works with difference of gaussian to find peaks, in nd (the example is >>> in 3D just like in your data). >>> >>> The key in DoG is to determine the two sigmas. A bit of experimentation >>> will take you there. >>> >>> Albert >>> >>> >>> On Nov 1, 2015, at 8:06 AM, Aryeh Weiss <[hidden email] >>> <mailto:[hidden email]>> wrote: >>> >>>> I have been asked to do a 3D segmentation of a DAPI stained image, >>>> such as the image stack available at: >>>> https://drive.google.com/open?id=0B9hvIdSL8kGyY0NiRzRkaXlINmM >>>> >>>> I find that I can do very well in 2D by blurring the image and doing >>>> peak detection, or gray-scale watershed. >>>> Gabriel Landini's domes followed by a peak detection or thresholding >>>> step also works nicely. >>>> However, I have not succeeded in extending this to 3D, using the 3D >>>> morphological segmentation tools. >>>> >>>> A 3D-domes would be nice, but I have not found that. >>>> I tried peak detection or 2D-domes and then 3D object counting, but >>>> there is still too much overlap in the Z-direction, so that nuclei >>>> which >>>> overlap vertically are counted as one object. >>>> >>>> So I seek to tap into the knowledge available on this list, because I >>>> am sure someone has already done this type of segmentation. >>>> >>>> Thanks in advance >>>> --aryeh >>>> >>>> -- >>>> Aryeh Weiss >>>> Faculty of Engineering >>>> Bar Ilan University >>>> Ramat Gan 52900 Israel >>>> >>>> Ph: 972-3-5317638 >>>> FAX: 972-3-7384051 >>>> >>>> >>>> -- >>>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html >> -- >> ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- Aryeh Weiss Faculty of Engineering Bar Ilan University Ramat Gan 52900 Israel Ph: 972-3-5317638 FAX: 972-3-7384051 -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Aryeh Weiss
Further on my adventures using the DoG function:
I mentioned that the DoGPeaks function appears to find minima as well as maxima. I decided to go to the Difference of Gaussian function http://javadoc.imagej.net/Fiji/mpicbg/imglib/algorithm/scalespace/DifferenceOfGaussian.html#DifferenceOfGaussian(mpicbg.imglib.image.Image,%20mpicbg.imglib.image.ImageFactory,%20mpicbg.imglib.function.Converter,%20mpicbg.imglib.outofbounds.OutOfBoundsStrategyFactory,%20double[],%20double[],%20B,%20B) Here I see that it explicitly states that it extracts local minima and maxima of a certain size. I wonder if I can get only the maxima fro this function. Among its parameters are Converter, OutOfBoundsStrategy (among others). I did not understand how to use these classes, so I wonder if someone on this list can tell me how to use them, or even better, point me at the documentation that might help (the class definitions in javadoc were not enough for me). Thank in advance. --aryeh On 05/11/2015 12:58 PM, Aryeh Weiss wrote: > This is an update on the problem I posted. > > First, thanks to the people who replies with suggestions. From these, I > am now following up on two of them. > > 1. Albert Cardona suggested trying the 3D (actually multi-D) difference > of Gaussians (DoG) filter. This looks promising, plus it introduced me > to imglib. It works great on isolated cells (actually, everything works > great on isolated cells) and seems reasonable for my image, but still > needs work. because I have such a dense collection of nuclei, it > sometimes detects dark blobs, which are actually an approximately > cell-sized island within a sea of nuclei. > Albert's sample code displays the result in 3D using the 3D viewer. > Unfortunately, java3D does not work in java 1.8, and in Java 1.6, while > the java3D test works, the code that generates the 3D view fails -- that > will go into a separate thread. > The net result is that I can mark the centers of the nuclei (which is > why it look promising) but I cannot visualize it in 3D to see if it > really looks right. > > 2. Thomas Boudier suggest some 3D bandpass filtering followed by a > seeded watershed. I will work more on finding the right parameters for > this approach after I finish with the DoG approach. One problem is > that the resolution in Z is much lower that in X-Y. As a result, the > watershed does not separate the nuclei along Z. It is not clear to me > why the DoG does. However, I still need to learn to to use the output > of the watershed -- I may not be interpreting the output correctly. > > I recently got access to Imaris (basic) with a spot detector. It does a > decent job, but since I don't have it on my computer, I plan to solve > this with ImageJ. > > When I have something that works and that I can visualize, I will post > it for the benefit of other who, like me, have to muddle their way from > 2D to 3D. > > --aryeh -- Aryeh Weiss Faculty of Engineering Bar Ilan University Ramat Gan 52900 Israel Ph: 972-3-5317638 FAX: 972-3-7384051 -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi Aryeh,
On 08.11.15 08:10, Aryeh Weiss wrote: > Further on my adventures using the DoG function: > > I mentioned that the DoGPeaks function appears to find minima as well as > maxima. I decided to go to the Difference of Gaussian function > http://javadoc.imagej.net/Fiji/mpicbg/imglib/algorithm/scalespace/DifferenceOfGaussian.html#DifferenceOfGaussian(mpicbg.imglib.image.Image,%20mpicbg.imglib.image.ImageFactory,%20mpicbg.imglib.function.Converter,%20mpicbg.imglib.outofbounds.OutOfBoundsStrategyFactory,%20double[],%20double[],%20B,%20B) > > Here I see that it explicitly states that it extracts local minima and > maxima of a certain size. I wonder if I can get only the maxima fro this > function. You have to go one step further: the `DifferenceOfGaussian` class has a `findPeaks` method that gives you a list of `DifferenceOfGaussianPeak`s. In its Javadoc [1] you find the methods: boolean isMin() boolean isMax() that you can use to differentiate between minima and maxima. I modified your script to only get the maxima: https://gist.github.com/imagejan/7cc228b9a5e57cce44a0 Here's what I changed: https://gist.github.com/imagejan/7cc228b9a5e57cce44a0/revisions > On 05/11/2015 12:58 PM, Aryeh Weiss wrote: >> 1. Albert Cardona suggested trying the 3D (actually multi-D) difference >> of Gaussians (DoG) filter. This looks promising, plus it introduced me >> to imglib. Albert's excellent tutorials unfortunately make use of the now-deprecated ImgLib1 code that was superseded by ImgLib2 [2]. Jean-Yves Tinevez's TrackMate plugin is a great example how to use ImgLib2. It's `LogDetector` [3] and `DogDetector` [4] classes show how to detect spots using ImgLib2 implementations of LoG and DoG. I added a script to the ImageJ wiki illustrating how to use `DogDetector` from a Python script: http://imagej.net/Jython_Scripting#Find_peaks_in_a_3D_image Hope that helps, Jan PS: Let's continue the discussion on the ImageJ forum, it's much easier to read conversations and code there: http://forum.imagej.net/ [1]: http://javadoc.imagej.net/Fiji/index.html?mpicbg/imglib/algorithm/scalespace/DifferenceOfGaussianPeak.html [2]: https://github.com/imglib [3]: https://github.com/fiji/TrackMate/blob/master/src/main/java/fiji/plugin/trackmate/detection/LogDetector.java#L95-L152 [4]: https://github.com/fiji/TrackMate/blob/master/src/main/java/fiji/plugin/trackmate/detection/DogDetector.java#L40-L105 -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi Jan
First of all, a belated thank you for this reply -- it exactly answered my question (and more). On 09/11/2015 9:40 PM, Jan Eglinger wrote: > Hi Aryeh, > > On 08.11.15 08:10, Aryeh Weiss wrote: >> Further on my adventures using the DoG function: >> >> I mentioned that the DoGPeaks function appears to find minima as well as >> maxima. I decided to go to the Difference of Gaussian function >> http://javadoc.imagej.net/Fiji/mpicbg/imglib/algorithm/scalespace/DifferenceOfGaussian.html#DifferenceOfGaussian(mpicbg.imglib.image.Image,%20mpicbg.imglib.image.ImageFactory,%20mpicbg.imglib.function.Converter,%20mpicbg.imglib.outofbounds.OutOfBoundsStrategyFactory,%20double[],%20double[],%20B,%20B) >> >> >> Here I see that it explicitly states that it extracts local minima and >> maxima of a certain size. I wonder if I can get only the maxima fro this >> function. > > You have to go one step further: the `DifferenceOfGaussian` class has > a `findPeaks` method that gives you a list of > `DifferenceOfGaussianPeak`s. > > In its Javadoc [1] you find the methods: > boolean isMin() > boolean isMax() > that you can use to differentiate between minima and maxima. > > I modified your script to only get the maxima: > https://gist.github.com/imagejan/7cc228b9a5e57cce44a0 > Works well. I had to make a minor correction at lines 40 and 41 The if statement is not properly indented. for p in peaks: if p.isMin(): maxima.append(p) should be for p in peaks: if p.isMin(): maxima.append(p) (sorry -- I do not yet know how to fix this in github.) > > > PS: Let's continue the discussion on the ImageJ forum, it's much > easier to read conversations and code there: http://forum.imagej.net/ > > I signed into the forum, but I still dont know how to use it. (Sorry -- I just have no social media experience...) I checked the option to have it send me email, but so far I have not seen anything from it, so maybe I did not do that correctly. Best regards, --aryeh -- Aryeh Weiss Faculty of Engineering Bar Ilan University Ramat Gan 52900 Israel Ph: 972-3-5317638 FAX: 972-3-7384051 -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Aryeh Weiss
This last week I focused mostly on the 3D-watershed approach.
Updates are interleaved below. On 08/11/2015 9:10 AM, Aryeh Weiss wrote: > Further on my adventures using the DoG function: > > I mentioned that the DoGPeaks function appears to find minima as well as > maxima. I decided to go to the Difference of Gaussian function > http://javadoc.imagej.net/Fiji/mpicbg/imglib/algorithm/scalespace/DifferenceOfGaussian.html#DifferenceOfGaussian(mpicbg.imglib.image.Image,%20mpicbg.imglib.image.ImageFactory,%20mpicbg.imglib.function.Converter,%20mpicbg.imglib.outofbounds.OutOfBoundsStrategyFactory,%20double[],%20double[],%20B,%20B) > > Here I see that it explicitly states that it extracts local minima and > maxima of a certain size. I wonder if I can get only the maxima fro this > function. > Jan Eglinger posted the answer to this. Here is what he wrote: ----- You have to go one step further: the `DifferenceOfGaussian` class has a `findPeaks` method that gives you a list of `DifferenceOfGaussianPeak`s. In its Javadoc [1] you find the methods: boolean isMin() boolean isMax() that you can use to differentiate between minima and maxima. I modified your script to only get the maxima: https://gist.github.com/imagejan/7cc228b9a5e57cce44a0 Here's what I changed: https://gist.github.com/imagejan/7cc228b9a5e57cce44a0/revisions ----- This enables the threshold to be set lower, without picking up the minima. > Among its parameters are Converter, OutOfBoundsStrategy (among others). > I did not understand how to use these classes, so I wonder if someone on > this list can tell me how to use them, or even better, point me at the > documentation that might help (the class definitions in javadoc were not > enough for me). > Jan also added the following: ----- Albert's excellent tutorials unfortunately make use of the now-deprecated ImgLib1 code that was superseded by ImgLib2 [2]. Jean-Yves Tinevez's TrackMate plugin is a great example how to use ImgLib2. It's `LogDetector` [3] and `DogDetector` [4] classes show how to detect spots using ImgLib2 implementations of LoG and DoG. I added a script to the ImageJ wiki illustrating how to use `DogDetector` from a Python script: http://imagej.net/Jython_Scripting#Find_peaks_in_a_3D_image ----- I did not have a chance to try this, because I focused on the watershed approach (see comments below). > Thank in advance. > --aryeh > > > On 05/11/2015 12:58 PM, Aryeh Weiss wrote: >> This is an update on the problem I posted. >> >> First, thanks to the people who replies with suggestions. From these, I >> am now following up on two of them. >> >> 1. Albert Cardona suggested trying the 3D (actually multi-D) difference >> of Gaussians (DoG) filter. This looks promising, plus it introduced me >> to imglib. It works great on isolated cells (actually, everything works >> great on isolated cells) and seems reasonable for my image, but still >> needs work. because I have such a dense collection of nuclei, it >> sometimes detects dark blobs, which are actually an approximately >> cell-sized island within a sea of nuclei. >> Albert's sample code displays the result in 3D using the 3D viewer. >> Unfortunately, java3D does not work in java 1.8, and in Java 1.6, while >> the java3D test works, the code that generates the 3D view fails -- that >> will go into a separate thread. >> The net result is that I can mark the centers of the nuclei (which is >> why it look promising) but I cannot visualize it in 3D to see if it >> really looks right. >> >> 2. Thomas Boudier suggest some 3D bandpass filtering followed by a >> seeded watershed. I will work more on finding the right parameters for >> this approach after I finish with the DoG approach. One problem is >> that the resolution in Z is much lower that in X-Y. As a result, the >> watershed does not separate the nuclei along Z. It is not clear to me >> why the DoG does. However, I still need to learn to to use the output >> of the watershed -- I may not be interpreting the output correctly. >> I found that I got a very good segmentation (ie, marking of the nuclei) by using the watershed in the droplet finder plugins. Or more accurately, using the droplet finder workflow which is run by Plugins>Droplet Finder>DF_Filterstacker The macro recorder enabled me to script it. // The code to get the file and parse // the filename and image title has been left out. run("32-bit"); // DF-Bandpass wants 32 bit input // The median, rolling ball filter, and Gaussian blur // greatly improved the accuracy run("Median...", "radius=2 stack"); run("Subtract Background...", "rolling=50 sliding stack"); run("Gaussian Blur...", "sigma=1.5 scaled stack"); // macro recorder created this. This is a long command, so if you // cut and paste, you may have to reassemble it run("DF_Filterstacker", "maximal_feature_size=15 minimal_feature_size=7 z/x_aspect_ratio=5.000 radius_x=2 radius_y=2 radius_z=2 invert image=[BP_"+dupTitle+"] mask=[WS_BP_"+dupTitle+"] area_threshold=0.300 maximum_threshold=0.3 connect_threshold=0.80 slice=5"); IJ.renameResults("Results"); IJ.renameResults("Particle Results"); This script produces a table called "Particle Results", with (among other things) the X, Y, and Z coordinates of the objects. >> I recently got access to Imaris (basic) with a spot detector. It does a >> decent job, but since I don't have it on my computer, I plan to solve >> this with ImageJ. >> >> When I have something that works and that I can visualize, I will post >> it for the benefit of other who, like me, have to muddle their way from >> 2D to 3D. >> In order to visualize the results, I have a python script to read the Particle Results table and produce a set of point ROIs that can mark the original image. The i can flatten the image and display this with the 3D Viewer (Java 1.6 only). """ This script converts the output of the droplet finder plugin (Paticle Results) to a set of point ROIs whcih can be used to mark the drops (in my case, nuclei) on the original image. Input: Particle Results table from Droplet Finder Output: An ROI Manager populated with point ROIs whose coordinates correspond to the list in the table. Bugs to fix: If the ROI Manager is open when the program is run, rm.addRoi fails with a null pointer error. """ # Does not require auto-import from ij import IJ, WindowManager from ij.plugin.frame import RoiManager from ij.measure import ResultsTable from ij.gui import PointRoi dfTitle = "Particle Results" IJ.renameResults(dfTitle , "Results") rt = ResultsTable.getResultsTable() pos = [] for i in range(rt.size()): pos.append([rt.getValue("position_x",i), rt.getValue("position_y", i), rt.getValue("position_z", i)]) for i in range(rt.size()): print pos[i]; print len(pos) dfTitle = "Particle Results" IJ.renameResults( "Results" , dfTitle ) # I do not know why this does not prevent the null pointer error # which I get if the ROI Manager is open when this script is run if "ROI Manager" in WindowManager.getImageTitles(): WindowManager.getWindow("ROI Manager").close() rm = RoiManager() rm.show() for p in pos: cellRoi = PointRoi(int(p[0]),int(p[1])) cellRoi.setPosition(int(p[2])) rm.addRoi(cellRoi) rm.runCommand("Show All without labels") # end of script I actually created two images -- one is the original, and the second is a blank image with the point ROIs flattened into it. Then I overlay them with the 3D viewer and increase transparency of the data to see the marks. What I really want to do is make the nuclei into surfaces and then "peel" them away to reveal the marks. I have not yet figured that out, and the surface rendering takes a really long time. One problem I have is that sooner or later, the 3D Viewer menus get grayed out (though mouse clicks in the 3D Viewer window still work). The I have to close it and start again. I have not been able to associate this with a reproducible set of actions. I hope this is useful --aryeh -- Aryeh Weiss Faculty of Engineering Bar Ilan University Ramat Gan 52900 Israel Ph: 972-3-5317638 FAX: 972-3-7384051 -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Aryeh Weiss
Hi Aryeh,
Apologies for the long delay in reply. I have been working to get Java 3D working with Java 8. I finally got it to the point where I could create an update site and upload something for you to try. The new update site is called "3D" and it requires at least Java 7. It updates Fiji's Java-3D-based components—the 3D Viewer in particular—to use the new Java 3D 1.6 [1], so that the 3D Viewer can be used with Java 8. Please try enabling the new "3D" update site with Java 8 and let me know how things work for you! Regards, Curtis [1] Actually, I had to fork Java 3D temporarily to get everything to work as needed. It's a long story and I will probably make a news post about it soon. On Thu, Nov 5, 2015 at 5:24 AM, Aryeh Weiss <[hidden email]> wrote: > Hi Curtis > > Thank you for your reply about java3D and java 1.8 > I am following up on this as a separate thread. > > On 02/11/2015 7:54 PM, Curtis Rueden wrote: > >> Hi Aryeh, >> >> Note that the Fiji-devel mailing list is closed now in favor of the >> ImageJ forum. Somehow, you still had permission to post (along with some >> others), but I have now (I hope!) fully closed the fiji-devel list from >> posts from anyone whatsoever. >> >> It is always best to discuss issues in public, rather than via private >> mails. Albert is not the person responsible for maintaining the 3D Viewer. >> >> Note that the 3D Viewer does not currently work with Java 7 and 8 on OS >> X. We are working on addressing that (see >> https://github.com/imagej/imagej/issues/120), but it is not yet ready >> for prime time. >> >> Right now you have two options: >> >> 1) Use Java 6 (http://imagej.net/FAQ#How_do_I_set_up_Java_6_on_OS_X.3F); >> or >> >> If I do this, then Plugins>Utilites>Debugging>Test Java3D > works correctly (spinning pretty box) > > However, the following code: > # Show the peaks as spheres in 3D, along with orthoslices: > univ = Image3DUniverse(1024, 1024) > print type(univ) > univ.addIcospheres(ps, Color3f(1, 0, 0), 2, cell_diameter/2, > "Cells").setLocked(True) > univ.addOrthoslice(imp).setLocked(True) > univ.show() > > will throw the following error: > Traceback (most recent call last): > File "/Users/amw1/Desktop/projects/tzachAuman/dog1.py", line 105, in > <module> > at ij3d.shapes.BoundingBox.<init>(BoundingBox.java:66) > at ij3d.shapes.BoundingBox.<init>(BoundingBox.java:34) > at ij3d.shapes.BoundingBox.<init>(BoundingBox.java:30) > at ij3d.ContentInstant.display(ContentInstant.java:216) > at ij3d.ContentCreator.createContent(ContentCreator.java:111) > at ij3d.ContentCreator.createContent(ContentCreator.java:98) > at ij3d.Image3DUniverse.createContent(Image3DUniverse.java:1195) > at ij3d.Image3DUniverse.addCustomMesh(Image3DUniverse.java:1163) > at ij3d.Image3DUniverse.addIcospheres(Image3DUniverse.java:1285) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:597) > > java.lang.NoSuchMethodError: java.lang.NoSuchMethodError: > javax.media.j3d.Shape3D.setName(Ljava/lang/String;)V > > at org.python.core.PyException.fillInStackTrace(PyException.java:70) > at java.lang.Throwable.<init>(Throwable.java:181) > at java.lang.Exception.<init>(Exception.java:29) > at java.lang.RuntimeException.<init>(RuntimeException.java:32) > at org.python.core.PyException.<init>(PyException.java:46) > at org.python.core.PyException.<init>(PyException.java:43) > at org.python.core.Py.JavaError(Py.java:495) > at org.python.core.Py.JavaError(Py.java:488) > at > org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:188) > at org.python.core.PyObject.__call__(PyObject.java:345) > at org.python.core.PyMethod.instancemethod___call__(PyMethod.java:220) > at org.python.core.PyMethod.__call__(PyMethod.java:211) > at org.python.core.PyMethod.__call__(PyMethod.java:201) > at > org.python.pycode._pyx0.f$0(/Users/amw1/Desktop/projects/tzachAuman/dog1.py:107) > at > org.python.pycode._pyx0.call_function(/Users/amw1/Desktop/projects/tzachAuman/dog1.py) > at org.python.core.PyTableCode.call(PyTableCode.java:165) > at org.python.core.PyCode.call(PyCode.java:18) > at org.python.core.Py.runCode(Py.java:1275) > at > org.scijava.plugins.scripting.jython.JythonScriptEngine.eval(JythonScriptEngine.java:76) > at org.scijava.script.ScriptModule.run(ScriptModule.java:174) > at org.scijava.module.ModuleRunner.run(ModuleRunner.java:167) > at org.scijava.module.ModuleRunner.call(ModuleRunner.java:126) > at org.scijava.module.ModuleRunner.call(ModuleRunner.java:65) > at > org.scijava.thread.DefaultThreadService$2.call(DefaultThreadService.java:191) > at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) > at java.util.concurrent.FutureTask.run(FutureTask.java:138) > at > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) > at java.lang.Thread.run(Thread.java:695) > Caused by: java.lang.NoSuchMethodError: > javax.media.j3d.Shape3D.setName(Ljava/lang/String;)V > at ij3d.shapes.BoundingBox.<init>(BoundingBox.java:66) > at ij3d.shapes.BoundingBox.<init>(BoundingBox.java:34) > at ij3d.shapes.BoundingBox.<init>(BoundingBox.java:30) > at ij3d.ContentInstant.display(ContentInstant.java:216) > at ij3d.ContentCreator.createContent(ContentCreator.java:111) > at ij3d.ContentCreator.createContent(ContentCreator.java:98) > at ij3d.Image3DUniverse.createContent(Image3DUniverse.java:1195) > at ij3d.Image3DUniverse.addCustomMesh(Image3DUniverse.java:1163) > at ij3d.Image3DUniverse.addIcospheres(Image3DUniverse.java:1285) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:597) > at > org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:186) > ... 20 more > > > The print statement tell me that the Image3DUniverse object was created, > but any of the lines after that will cause > an error. > > > 2) Test the new 3D Viewer based on Java 3D 1.6, downloadable from here: >> http://curtis.imagej.net/2015-10-06-jogl-java3d/ >> Which should work correctly with Java 8. (Feedback welcome!) >> >> I downloaded this, and ran it. > > Upon startup, it pops up the following message: > There are obsolete java 3D libraries installed as Java extensions. > The following were detected: > * /System/Library/Java/Extensions/3dcore.jar > * /System/Library/Java/Extensions/vecmath.jar > * /System/Library/Java/Extensions/j3dutils.jar > These libraries will very likely cause problems with 3D visualization. > Please delete them, then restart the program. > > > If I attempt to delete these files, I get the following message: > “j3dcore.jar” can’t be modified or deleted because it’s required by OS X > > If I proceed naively ahead, and I test java 3D > (Plugins>Utilites>Debugging>Test Java3D) > the I get the following: > > java.lang.NoClassDefFoundError: Could not initialize class > javax.media.j3d.Canvas3D > at Test_Java3D.createPanel(Test_Java3D.java:34) > at Test_Java3D.run(Test_Java3D.java:25) > at ij.IJ.runUserPlugIn(IJ.java:212) > at ij.IJ.runPlugIn(IJ.java:176) > at ij.Executer.runCommand(Executer.java:132) > at ij.Executer.run(Executer.java:65) > at java.lang.Thread.run(Thread.java:745) > > > Best regards > --aryeh > > -- > Aryeh Weiss > Faculty of Engineering > Bar Ilan University > Ramat Gan 52900 Israel > > Ph: 972-3-5317638 > FAX: 972-3-7384051 > > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Aryeh Weiss
Hi Aryeh,
> One problem I have is that sooner or later, the 3D Viewer menus get > grayed out (though mouse clicks in the 3D Viewer window still work). > The I have to close it and start again. I have not been able to > associate this with a reproducible set of actions. I have seen this happen to the main ImageJ menus, or more commonly just the Help menu, in the past in some situations. But I also do not know what triggers it. If the problem ever happens to you when using Java 8, please let us know—we should probably file an issue in that case and investigate further. Regards, Curtis On Fri, Nov 13, 2015 at 5:04 AM, Aryeh Weiss <[hidden email]> wrote: > This last week I focused mostly on the 3D-watershed approach. > Updates are interleaved below. > > On 08/11/2015 9:10 AM, Aryeh Weiss wrote: > >> Further on my adventures using the DoG function: >> >> I mentioned that the DoGPeaks function appears to find minima as well as >> maxima. I decided to go to the Difference of Gaussian function >> >> http://javadoc.imagej.net/Fiji/mpicbg/imglib/algorithm/scalespace/DifferenceOfGaussian.html#DifferenceOfGaussian(mpicbg.imglib.image.Image,%20mpicbg.imglib.image.ImageFactory,%20mpicbg.imglib.function.Converter,%20mpicbg.imglib.outofbounds.OutOfBoundsStrategyFactory,%20double[],%20double[],%20B,%20B) >> >> Here I see that it explicitly states that it extracts local minima and >> maxima of a certain size. I wonder if I can get only the maxima fro this >> function. >> >> > Jan Eglinger posted the answer to this. Here is what he wrote: > ----- > You have to go one step further: the `DifferenceOfGaussian` class has a > `findPeaks` method that gives you a list of `DifferenceOfGaussianPeak`s. > > In its Javadoc [1] you find the methods: > boolean isMin() > boolean isMax() > that you can use to differentiate between minima and maxima. > > I modified your script to only get the maxima: > https://gist.github.com/imagejan/7cc228b9a5e57cce44a0 > > Here's what I changed: > https://gist.github.com/imagejan/7cc228b9a5e57cce44a0/revisions > ----- > > This enables the threshold to be set lower, without picking up the minima. > > Among its parameters are Converter, OutOfBoundsStrategy (among others). >> I did not understand how to use these classes, so I wonder if someone on >> this list can tell me how to use them, or even better, point me at the >> documentation that might help (the class definitions in javadoc were not >> enough for me). >> >> > Jan also added the following: > ----- > Albert's excellent tutorials unfortunately make use of the now-deprecated > ImgLib1 code that was superseded by ImgLib2 [2]. > > Jean-Yves Tinevez's TrackMate plugin is a great example how to use > ImgLib2. It's `LogDetector` [3] and `DogDetector` [4] classes show how to > detect spots using ImgLib2 implementations of LoG and DoG. > > I added a script to the ImageJ wiki illustrating how to use `DogDetector` > from a Python script: > http://imagej.net/Jython_Scripting#Find_peaks_in_a_3D_image > ----- > > I did not have a chance to try this, because I focused on the watershed > approach (see comments below). > > > Thank in advance. >> --aryeh >> >> >> On 05/11/2015 12:58 PM, Aryeh Weiss wrote: >> >>> This is an update on the problem I posted. >>> >>> First, thanks to the people who replies with suggestions. From these, I >>> am now following up on two of them. >>> >>> 1. Albert Cardona suggested trying the 3D (actually multi-D) difference >>> of Gaussians (DoG) filter. This looks promising, plus it introduced me >>> to imglib. It works great on isolated cells (actually, everything works >>> great on isolated cells) and seems reasonable for my image, but still >>> needs work. because I have such a dense collection of nuclei, it >>> sometimes detects dark blobs, which are actually an approximately >>> cell-sized island within a sea of nuclei. >>> Albert's sample code displays the result in 3D using the 3D viewer. >>> Unfortunately, java3D does not work in java 1.8, and in Java 1.6, while >>> the java3D test works, the code that generates the 3D view fails -- that >>> will go into a separate thread. >>> The net result is that I can mark the centers of the nuclei (which is >>> why it look promising) but I cannot visualize it in 3D to see if it >>> really looks right. >>> >>> 2. Thomas Boudier suggest some 3D bandpass filtering followed by a >>> seeded watershed. I will work more on finding the right parameters for >>> this approach after I finish with the DoG approach. One problem is >>> that the resolution in Z is much lower that in X-Y. As a result, the >>> watershed does not separate the nuclei along Z. It is not clear to me >>> why the DoG does. However, I still need to learn to to use the output >>> of the watershed -- I may not be interpreting the output correctly. >>> >>> > I found that I got a very good segmentation (ie, marking of the nuclei) > by using the watershed in the droplet finder plugins. Or more accurately, > using the droplet finder workflow which is run by Plugins>Droplet > Finder>DF_Filterstacker > > The macro recorder enabled me to script it. > > // The code to get the file and parse > // the filename and image title has been left out. > > run("32-bit"); // DF-Bandpass wants 32 bit input > > // The median, rolling ball filter, and Gaussian blur > // greatly improved the accuracy > run("Median...", "radius=2 stack"); > run("Subtract Background...", "rolling=50 sliding stack"); > run("Gaussian Blur...", "sigma=1.5 scaled stack"); > > // macro recorder created this. This is a long command, so if you > // cut and paste, you may have to reassemble it > run("DF_Filterstacker", "maximal_feature_size=15 minimal_feature_size=7 > z/x_aspect_ratio=5.000 radius_x=2 radius_y=2 radius_z=2 invert > image=[BP_"+dupTitle+"] mask=[WS_BP_"+dupTitle+"] area_threshold=0.300 > maximum_threshold=0.3 connect_threshold=0.80 slice=5"); > IJ.renameResults("Results"); > IJ.renameResults("Particle Results"); > > > This script produces a table called "Particle Results", with (among other > things) the X, Y, and Z coordinates of the objects. > > I recently got access to Imaris (basic) with a spot detector. It does a >>> decent job, but since I don't have it on my computer, I plan to solve >>> this with ImageJ. >>> >>> When I have something that works and that I can visualize, I will post >>> it for the benefit of other who, like me, have to muddle their way from >>> 2D to 3D. >>> >>> > In order to visualize the results, I have a python script to read the > Particle Results table and produce a set of point ROIs that can mark the > original image. > The i can flatten the image and display this with the 3D Viewer (Java 1.6 > only). > > """ > This script converts the output of the droplet finder plugin (Paticle > Results) > to a set of point ROIs whcih can be used to mark the drops (in my case, > nuclei) > on the original image. > > Input: Particle Results table from Droplet Finder > Output: An ROI Manager populated with point ROIs whose coordinates > correspond to the list in the table. > > Bugs to fix: If the ROI Manager is open when the program is run, rm.addRoi > fails with a null pointer error. > """ > > # Does not require auto-import > > from ij import IJ, WindowManager > from ij.plugin.frame import RoiManager > from ij.measure import ResultsTable > from ij.gui import PointRoi > > dfTitle = "Particle Results" > IJ.renameResults(dfTitle , "Results") > > rt = ResultsTable.getResultsTable() > > pos = [] > > for i in range(rt.size()): > pos.append([rt.getValue("position_x",i), rt.getValue("position_y", > i), rt.getValue("position_z", i)]) > > for i in range(rt.size()): > print pos[i]; > > print len(pos) > > dfTitle = "Particle Results" > IJ.renameResults( "Results" , dfTitle ) > > # I do not know why this does not prevent the null pointer error > # which I get if the ROI Manager is open when this script is run > if "ROI Manager" in WindowManager.getImageTitles(): > WindowManager.getWindow("ROI Manager").close() > > rm = RoiManager() > rm.show() > > for p in pos: > cellRoi = PointRoi(int(p[0]),int(p[1])) > cellRoi.setPosition(int(p[2])) > rm.addRoi(cellRoi) > > rm.runCommand("Show All without labels") > > # end of script > > I actually created two images -- one is the original, and the second is a > blank image with the point ROIs flattened into it. Then I overlay them with > the 3D viewer and increase transparency of the data to see the marks. What > I really want to do is make the nuclei into surfaces and then "peel" them > away to reveal the marks. I have not yet figured that out, and the surface > rendering takes a really long time. > > One problem I have is that sooner or later, the 3D Viewer menus get grayed > out (though mouse clicks in the 3D Viewer window still work). > The I have to close it and start again. I have not been able to associate > this with a reproducible set of actions. > > > I hope this is useful > > --aryeh > > -- > Aryeh Weiss > Faculty of Engineering > Bar Ilan University > Ramat Gan 52900 Israel > > Ph: 972-3-5317638 > FAX: 972-3-7384051 > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by ctrueden
Hi Curtis,
Thank you for your response. On 24/11/2015 5:33 AM, Curtis Rueden wrote: > Hi Aryeh, > > Apologies for the long delay in reply. I have been working to get Java > 3D working with Java 8. I finally got it to the point where I could > create an update site and upload something for you to try. > > The new update site is called "3D" and it requires at least Java 7. It > updates Fiji's Java-3D-based components—the 3D Viewer in particular—to > use the new Java 3D 1.6 [1], so that the 3D Viewer can be used with > Java 8. > > Please try enabling the new "3D" update site with Java 8 and let me > know how things work for you! > I did this, and it started out ok. However, when I resized the window of the 3D viewer, the following appeared in the Console: com.jogamp.opengl.GLException: detachAllImpl failed: FBO implementation fault, FBO[name r/w 2/2, init true, bound true, size 604x594, samples 0/8, modified true/true, depth RenderAttachment[type DEPTH, format 0x81a5, samples 0, 604x594, name 0xffffffff, obj 0x17430ea1], stencil null, colorbuffer attachments: 1/8, with 1 textures: [TextureAttachment[type COLOR_TEXTURE, target GL_TEXTURE_2D, level 0, format 0x8051, 604x594, border 0, dataFormat 0x1907, dataType 0x1401; min/mag 0x2600/0x2600, wrap S/T 0x812f/0x812f; name 0xffffffff, obj 0x1e012244], null, null, null, null, null, null, null], msaa[null, hasSink false, dirty true], state FBO implementation fault, obj 0xc71d0f] at com.jogamp.opengl.FBObject.detachAllImpl(FBObject.java:2198) at com.jogamp.opengl.FBObject.reset(FBObject.java:1139) at org.scijava.java3d.JoglPipeline.resizeOffscreenLayer(JoglPipeline.java:6290) at org.scijava.java3d.Canvas3D.setViewport(Canvas3D.java:4864) at org.scijava.java3d.Renderer.doWork(Renderer.java:993) at org.scijava.java3d.J3dThread.run(J3dThread.java:271) Exception occurred in RenderingErrorListener: java.lang.RuntimeException at ij3d.ImageWindow3D$ErrorListener.errorOccurred(ImageWindow3D.java:295) at org.scijava.java3d.VirtualUniverse.notifyRenderingErrorListeners(VirtualUniverse.java:1198) at org.scijava.java3d.NotificationThread.processNotifications(NotificationThread.java:86) at org.scijava.java3d.NotificationThread.run(NotificationThread.java:104) Following this, none of the ImageJ functions work. The menus appear and I can click on the menu entries, but nothing happens. In order to quit I have to kill the ImageJ process. If I click on the imagej interface window, the menus do not appear, but if I click on an imagej window, then the menus associated with those windows appear, and can be selected (but no actions will be taken). I hope this helps you locate the problem. Best regards --aryeh > Regards, > Curtis > > [1] Actually, I had to fork Java 3D temporarily to get everything to > work as needed. It's a long story and I will probably make a news post > about it soon. > > On Thu, Nov 5, 2015 at 5:24 AM, Aryeh Weiss <[hidden email] > <mailto:[hidden email]>> wrote: > > Hi Curtis > > Thank you for your reply about java3D and java 1.8 > I am following up on this as a separate thread. > > On 02/11/2015 7:54 PM, Curtis Rueden wrote: > > Hi Aryeh, > > Note that the Fiji-devel mailing list is closed now in favor > of the ImageJ forum. Somehow, you still had permission to post > (along with some others), but I have now (I hope!) fully > closed the fiji-devel list from posts from anyone whatsoever. > > It is always best to discuss issues in public, rather than via > private mails. Albert is not the person responsible for > maintaining the 3D Viewer. > > Note that the 3D Viewer does not currently work with Java 7 > and 8 on OS X. We are working on addressing that (see > https://github.com/imagej/imagej/issues/120), but it is not > yet ready for prime time. > > Right now you have two options: > > 1) Use Java 6 > (http://imagej.net/FAQ#How_do_I_set_up_Java_6_on_OS_X.3F); or > > If I do this, then Plugins>Utilites>Debugging>Test Java3D > works correctly (spinning pretty box) > > However, the following code: > # Show the peaks as spheres in 3D, along with orthoslices: > univ = Image3DUniverse(1024, 1024) > print type(univ) > univ.addIcospheres(ps, Color3f(1, 0, 0), 2, cell_diameter/2, > "Cells").setLocked(True) > univ.addOrthoslice(imp).setLocked(True) > univ.show() > > will throw the following error: > Traceback (most recent call last): > File "/Users/amw1/Desktop/projects/tzachAuman/dog1.py", line > 105, in <module> > at ij3d.shapes.BoundingBox.<init>(BoundingBox.java:66) > at ij3d.shapes.BoundingBox.<init>(BoundingBox.java:34) > at ij3d.shapes.BoundingBox.<init>(BoundingBox.java:30) > at ij3d.ContentInstant.display(ContentInstant.java:216) > at ij3d.ContentCreator.createContent(ContentCreator.java:111) > at ij3d.ContentCreator.createContent(ContentCreator.java:98) > at ij3d.Image3DUniverse.createContent(Image3DUniverse.java:1195) > at ij3d.Image3DUniverse.addCustomMesh(Image3DUniverse.java:1163) > at ij3d.Image3DUniverse.addIcospheres(Image3DUniverse.java:1285) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:597) > > java.lang.NoSuchMethodError: java.lang.NoSuchMethodError: > javax.media.j3d.Shape3D.setName(Ljava/lang/String;)V > > at > org.python.core.PyException.fillInStackTrace(PyException.java:70) > at java.lang.Throwable.<init>(Throwable.java:181) > at java.lang.Exception.<init>(Exception.java:29) > at java.lang.RuntimeException.<init>(RuntimeException.java:32) > at org.python.core.PyException.<init>(PyException.java:46) > at org.python.core.PyException.<init>(PyException.java:43) > at org.python.core.Py.JavaError(Py.java:495) > at org.python.core.Py.JavaError(Py.java:488) > at > org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:188) > at org.python.core.PyObject.__call__(PyObject.java:345) > at > org.python.core.PyMethod.instancemethod___call__(PyMethod.java:220) > at org.python.core.PyMethod.__call__(PyMethod.java:211) > at org.python.core.PyMethod.__call__(PyMethod.java:201) > at > org.python.pycode._pyx0.f$0(/Users/amw1/Desktop/projects/tzachAuman/dog1.py:107) > at > org.python.pycode._pyx0.call_function(/Users/amw1/Desktop/projects/tzachAuman/dog1.py) > at org.python.core.PyTableCode.call(PyTableCode.java:165) > at org.python.core.PyCode.call(PyCode.java:18) > at org.python.core.Py.runCode(Py.java:1275) > at > org.scijava.plugins.scripting.jython.JythonScriptEngine.eval(JythonScriptEngine.java:76) > at org.scijava.script.ScriptModule.run(ScriptModule.java:174) > at org.scijava.module.ModuleRunner.run(ModuleRunner.java:167) > at org.scijava.module.ModuleRunner.call(ModuleRunner.java:126) > at org.scijava.module.ModuleRunner.call(ModuleRunner.java:65) > at > org.scijava.thread.DefaultThreadService$2.call(DefaultThreadService.java:191) > at > java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) > at java.util.concurrent.FutureTask.run(FutureTask.java:138) > at > java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) > at java.lang.Thread.run(Thread.java:695) > Caused by: java.lang.NoSuchMethodError: > javax.media.j3d.Shape3D.setName(Ljava/lang/String;)V > at ij3d.shapes.BoundingBox.<init>(BoundingBox.java:66) > at ij3d.shapes.BoundingBox.<init>(BoundingBox.java:34) > at ij3d.shapes.BoundingBox.<init>(BoundingBox.java:30) > at ij3d.ContentInstant.display(ContentInstant.java:216) > at ij3d.ContentCreator.createContent(ContentCreator.java:111) > at ij3d.ContentCreator.createContent(ContentCreator.java:98) > at ij3d.Image3DUniverse.createContent(Image3DUniverse.java:1195) > at ij3d.Image3DUniverse.addCustomMesh(Image3DUniverse.java:1163) > at ij3d.Image3DUniverse.addIcospheres(Image3DUniverse.java:1285) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:597) > at > org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:186) > ... 20 more > > > The print statement tell me that the Image3DUniverse object was > created, but any of the lines after that will cause > an error. > > > 2) Test the new 3D Viewer based on Java 3D 1.6, downloadable > from here: > http://curtis.imagej.net/2015-10-06-jogl-java3d/ > Which should work correctly with Java 8. (Feedback welcome!) > > I downloaded this, and ran it. > > Upon startup, it pops up the following message: > There are obsolete java 3D libraries installed as Java extensions. > The following were detected: > * /System/Library/Java/Extensions/3dcore.jar > * /System/Library/Java/Extensions/vecmath.jar > * /System/Library/Java/Extensions/j3dutils.jar > These libraries will very likely cause problems with 3D visualization. > Please delete them, then restart the program. > > > If I attempt to delete these files, I get the following message: > “j3dcore.jar” can’t be modified or deleted because it’s required > by OS X > > If I proceed naively ahead, and I test java 3D > (Plugins>Utilites>Debugging>Test Java3D) > the I get the following: > > java.lang.NoClassDefFoundError: Could not initialize class > javax.media.j3d.Canvas3D > at Test_Java3D.createPanel(Test_Java3D.java:34) > at Test_Java3D.run(Test_Java3D.java:25) > at ij.IJ.runUserPlugIn(IJ.java:212) > at ij.IJ.runPlugIn(IJ.java:176) > at ij.Executer.runCommand(Executer.java:132) > at ij.Executer.run(Executer.java:65) > at java.lang.Thread.run(Thread.java:745) > > > Best regards > --aryeh > > -- > Aryeh Weiss > Faculty of Engineering > Bar Ilan University > Ramat Gan 52900 Israel > > Ph: 972-3-5317638 > FAX: 972-3-7384051 > > -- Aryeh Weiss Faculty of Engineering Bar Ilan University Ramat Gan 52900 Israel Ph: 972-3-5317638 FAX: 972-3-7384051 -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |