@mdoube I saw your replies to other BoneJ questions, would you happen to have a solution to this?
You can call the plugin with the macro command
run("Particle Analyser"). Unfortunately this still requires user interaction, i.e. clicking the dialog buttons. The plugin doesn’t parse arguments from the
public methods of a Java class, so this opens up more options. For example, you could call the method
getParticles(), which returns the particle labelling and sizes. However many of the methods for further particle analysis such as Euler characteristic or thickness are not exposed in the Java API, and thus not accessible from a script.
Thanks for the quick reply @rimadoma ! My main need for Particle Analyzer is to use it as a 3D size filter that can check for connectivity of objects between slices, compute size, exclude small objects and retain large ones. This is just one step in a much longer script that batch processes and runs through multiple z-stacks, so it would be inconvenient for the user to interact with dialog boxes for stack after stack.
run("Analyze Particles...", "size=0-100 show=Nothing exclude"); labels particles whose area is 0 - 100 pixels, and excludes ones that intersect stack edges.
It is important that the particles in our images be size filtered in a 3D manner, which Analyze Particles is unable to do. The Extended Particle Analyzer from the Biovoxxel Toolbox also works solely on 2D images. We have tried using the Find Connected Regions plugin, which worked exactly as we wanted, but it caused the count output lines in the Results table to be overwritten for stack after stack processed through the macro. Currently, our code uses the 3D Object Counter, however it can only perform a 6-connected size check, and we would like a 26-connected check instead.
It sounds like incorporating Particle Analyzer from BoneJ into our program might not work. Are there any similar recordable plugins that can filter in z?
That sounds to me like you’d profit from running your analysis with KNIME. It fully supports 3D objects and feature measurements, and you can run ImageJ1 macro code for pre- and post-processing within a KNIME workflow if you like. Example workflows are available on their example server from within the application.
Well, there are some ways, but they have limitations:
It is here - I just recorded this with the default settings checked in the dialog box
run("Particle Analyser", "surface_area enclosed_volume moments euler thickness ellipsoids min=0.000 max=Infinity surface_resampling=2 show_particle show_surfaces show_centroids show_axes show_ellipsoids show_stack surface=Gradient split=0.000 volume_resampling=2 labelling=Mapped slices=2");
What are your versions of:
Java: 1.8.0_121 (64-bit)
BoneJ: 1.4.2-testing (though 1.4.2 and many versions earlier should behave just the same)
OS: Ubuntu 16.04 all up to date
I tried using the code you recorded to run Particle Analyser, and got the following exception. No output windows I selected for opened up, and the progress bar in the Fiji status menu just wouldn’t fill all the way.
( Fiji Is Just) ImageJ 2.0.0-rc-59/1.51g; Java 1.8.0_66 [64-bit]; Windows 7 6.1; 78MB of 3006MB (2%) java.lang.ClassCastException: org.scijava.vecmath.Point3f cannot be cast to javax.vecmath.Point3f at org.doube.bonej.ParticleCounter.getSurfacePoints(ParticleCounter.java:984) at org.doube.bonej.ParticleCounter.run(ParticleCounter.java:253) at ij.IJ.runUserPlugIn(IJ.java:217) at ij.IJ.runPlugIn(IJ.java:181) at ij.Executer.runCommand(Executer.java:137) at ij.Executer.run(Executer.java:63) at java.lang.Thread.run(Thread.java:745)
This is a setup issue. The short answer is that BoneJ doesn’t play well with fully updated Fiji and Java 8 on Win/Mac, which is something @rimadoma is working hard to remedy.
In the meantime please use the setup suggestion mentioned in the other thread linked above.