Debug Fiji Plugin va Netbeans

debugging
netbeans
fiji
Tags: #<Tag:0x00007fb88418ece8> #<Tag:0x00007fb88418ea40> #<Tag:0x00007fb88418e658>

#1

Hi, I hope the data treats you well.

I’ve been banging my head on moving to ImageJ2 plugins in Maven from ImageJ1.X plugins using Ant, both with Netbeans. I can’t seem to find a way to debug using Netbeans and Fiji. I was previously debugging my ant based plugins in ImageJ1.X and then copying to my Fiji folder for testing.

I’ve had a few attempts at getting Maven to work, learning a lot about the pom file, and getting almost there. Following https://imagej.net/2016-04-19_-_Writing_ImageJ2_Plugins:_A_Beginner’s_Perspective I found that I was kinda close, but simply cloning the imagej-tutorials repo made things really easy.

I still have no clue how to debug my plugin inside of Fiji. I need to use a number of different plugins packed with Fiji so debugging in ImageJ1.X doesn’t make sense.

Any pointers would be much appreciated. I’m really surprised that this isn’t easier (or at least easier to find documentation online) given that Fiji is the default, and NetBeans is one of the obvious IDE choices. Am I missing something, and debugging in Fiji is not really the right way to do things?

Thanks in advance for your time.

Neil


#2

Hi @nranthony,

I’m not quite sure about your problem. In case that’s useful, there’s also a screencast here: https://www.youtube.com/watch?v=YIWpoBnnLio, but I think that you have gone beyond this point.

What do you mean by that ? Have you cloned this repository ?

In this example, there’s a main class which is launching a Fiji instance (from Netbeans or any other IDE) and from which you can debug your plugin. Isn’t it what you want ?

Let us know!

Best

Nicolas


#3

Hi Nicolas, thanks for the speedy reply,

I have cloned the repository, and can debug into what appears to be an ImageJ2 UI. It uses net.imagej.ImageJ for ImageJ2, right? I’m using the same example project, just using the Hello World example instead.

I need to debug within the Fiji UI directly. If this is not possible, is there a way to use maven to install plugins into the ImageJ2 plugins folder? Do these files live in the .m2 folder of my documents? Also, is it simple to use the old style UI? The new UI is a little strange to me.

Thanks for your time.
Neil


#4

Hmm… So, not sure I can help you at this point, but maybe you can give a bit more information about your use case.

Yes, it’s imported at the beginning of the file (https://github.com/imagej/example-imagej-command/blob/400c932ec97303e573d62c6fe5c08e6940ed34fb/src/main/java/com/mycompany/imagej/GaussFiltering.java#L12).

What do you mean by that ? Do you want to debug out of the IDE ? Why would you want to do that ?

Is it because your plugin needs other plugins or update sites to work ?

Ok, so what I guess is that you want to test the interplay between a set of plugins and your plugin. Is this what you want ?

This repo may help: https://github.com/imagej/example-legacy-plugin/blob/master/pom.xml


#5

Hi Nicolas, thanks for your time.

I might be describing things in a misleading way. I would like to use run my plugin in Fiji and have it connect to NetBeans for debugging, for step by step code evaluation and variable inspection. I do indeed have steps that require the plugins that come with Fiji. Specifically, I have a step that runs a macro, and that macro can have any combination of Fiji plugins and function calls. I wanted to keep this macro step, as it allows me to quickly change the application without having to go back to NetBeans and figure out how to program it. The app performs a few file logistics steps, followed by the macro processing (which will likely vary for different samples), and then another few logistics steps. The start and end will be the same but middle processing macro will be different and changing at the microscope setup.

I’ve tried to setup debugging use JDB http://imagej.net/Debugging#Debugging_Java_code_with_jdb put failed (not sure how close I got or even if it’s possible). I’ve also tried to use fiji.Debug and Debug.run(plugin, parameters) but that didn’t work for me either.

Any tips would be much appreciated. Sorry if I’m missing something obvious.

Thanks
Neil


#6

Hi,

If that’s of any use, you can launch any script in a “main” test class before executing the plugin you want to debug. For instance this codes executes an IJ1 script before the main command:

Regarding attaching a debugger to a running ImageJ, I’m discovering thanks to you that it is possible… I will not be able to help! Maybe someone with more experience will join the conversation.

Best,

Nicolas


#7

Hi Neil,

To get a (modern) Fiji / ImageJ plug-in to launch with the legacy UI from your IDE, add the dependency

        <dependency>
            <groupId>net.imagej</groupId>
            <artifactId>imagej-legacy</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>

to your POM file.

Best regards,
Richard


#8

Wonderful, thank you both for your feedback.

I’ll continue to look into the remote debugging; if it can work with ImageJ then surely Fiji will should work too. I’ll report back here if I figure it out.

If anybody has debugged in Fiji I’d love to hear about.

Thanks for your time.

Neil


#9

I usually debug Fiji (Jython and Java) using Eclipse.


Here is how I do for Jython.

For Java I use the maven way.
I have to admit that I don’t write extremely big project, but for what I do I can import dependencies and debug.

hoping to being helpful,
Emanuele Martini