bone J with Netbeans

20 views
Skip to first unread message

Mahmoudi Sidi Ahmed

unread,
Mar 26, 2015, 4:43:41 AM3/26/15
to bonej-users-a...@googlegroups.com
Hi everyone,

I would like to call Bone Macro from Netbeans. In my netbeans project, I have included the ij.jar and BoneJ.jar.

Howver, when executing my program. He doesn't recognize the command related to BoneJ plugin. The ImageJ command are well excuted.

An idea ?

Best regards,

Sidi,

Michael Doube

unread,
Mar 26, 2015, 7:11:24 AM3/26/15
to bonej-users-a...@googlegroups.com
Dear Sidi,

It would help a lot to see your code. Otherwise we are just guessing about what might be broken.

I use Eclipse rather than Netbeans, so am unfamiliar with its operation. But, if you are writing a Java plugin you will need to import the packages whose classes you need, and make sure you are constructing instances properly, or using classes' methods directly (if static methods).

BoneJ uses its own methods' APIs all the time, so it does work - you probably have an issue with your project setup or the way you are calling the BoneJ methods.

Best regards,

Michael

Mahmoudi Sidi Ahmed

unread,
Mar 26, 2015, 10:08:29 AM3/26/15
to bonej-users-a...@googlegroups.com
Thank you Michael for your answer,

In fact, I would like to launch a macro (already recorded from Bone J) in my own Netbeans Project. I don't need to develop my own plugin.

For example, when I include this code line : IJ.runPlugin("ig.plugin.ContrastEnhancer", ""); the code is well working.

Howver, once I include this line code :   IJ.runPlugin("ig.plugin.Conectivity", "") It doesn't work giving the error : Plugin or class not found " ig.plugin.Conectivity "

Best regards,

Sidi,

Michael Doube

unread,
Mar 26, 2015, 10:23:31 AM3/26/15
to bonej-users-a...@googlegroups.com
> Howver, once I include this line code : IJ.runPlugin("ig.plugin.Conectivity", "") It doesn't work giving the error : Plugin or class not found " ig.plugin.Conectivity "

That is because you have to include the package that contains the Connectivity class. It's like an address which helps Java find the right code to run.

http://en.wikipedia.org/wiki/Java_package

All of BoneJ's packages are listed in its plugins.config file, which you can red by extracting the BoneJ_.jar (it's just a zip file), or by looking here:

https://github.com/mdoube/BoneJ/blob/master/src/plugins.config

So you see that Connectivity is at org.doube.bonej.Connectivity and your macro command should be

IJ.runPlugin("org.doube.bonej.Connectivity", "");

The org.doube top level is there because I hadn't yet registered bonej.org when the project started. One of the jobs for BoneJ is to move packages into org.bonej.

Michael
Reply all
Reply to author
Forward
0 new messages