Please update "Writing ImageJ Plugins" Page on Wiki

Dear all,

Curtis suggested in one of his answers that I should ask for help if I find a wiki page which does not seam to be uptodate.

After years of abstinence from ImageJ plugin development I have to update some of my own plugins to IJ2. This is not an easy task as information are disseminated widely (at least for someone starting from scratch like me).

I have the impression that this wiki page “http://developer.imagej.net/writing-imagej-plugins” needs an update. It is a landing page when searching for information using the search engines.

Curtis supplied a lot of good information in this thread:

I asume that I am not the only who has problems to get started after reading recent threads like:

or

Again, all the threads contain helpful information. But one has to read a lot of irrelevant information before finding the really excellent hints. This could be streamlined in my opinion.

Over the years I have learned that a beginner can help to point out problems which experts no longer perceive. Therefore I offer to volunteer to optimize the wiki page by pointing out problems I have on my way to learn the IJ2-Style.

I am no programmer nor a computer scientist, I am a dentist by training and had to learn to program my plugins for pure need because it is hard to get funding for software in dentistry. So while being able to write code, I do not have the knowlegde of current software philosophies (and I have seen quites some of them already in my life since the Pascal “procedures” or the hype around “object orientation”). For me it is hard to dig into xml code of Maven (I never understood why xml is necessary, where a text file would do the job). But I would assume that I am a typical life science representative doing a project with the need of an individual solution for an individual problem like for example any kind of thesis.

As I said: I am willing to help, but I need support from you.

Sincerely

Karl-Heinz

I did not select the text added after the hyperlinks which I added to my post above nor do I know how to remove them. This forum is doing too much on its own. I just added hyperlinks.

Karl-Heinz

Hi all,

to demonstrate that I am not just complaining but willing to help I upload here a text file where I started to write the new tutorial for the wiki page. The files is a plain text file, I used markdown to format the file currently. It can be easily changed. I document for myself with such text files usually. As I will continue to document I will share the result. The file was written on linux therefore on windows newlines might be missing.

Howto-Write-ImageJ-Plugins.txt.zip (5.9 KB)

I could also post the text into this window, if this would be a better approach.

It would be great if you could correct my mistakes in the file.

Sincerely

Karl-Heinz

I see a need to update the wiki page on Netbeans, too: http://imagej.net/Developing_ImageJ_in_NetBeans

I followed the instructions:

Choose Team > Git > Clone… from the NetBeans menu
For the Repository URL, enter: git://github.com/imagej/imagej
Click Next, check the “master*” branch, then Next again, then Finish
When prompted, click Open Project…

And was confronted with a number of error messages:

Some problems were encountered while processing the POMs:
[ERROR] ‘dependencies.dependency.version’ for net.imagej:imagej-common:jar is missing. @ line 99, column 15
[ERROR] ‘dependencies.dependency.version’ for net.imagej:imagej-ops:jar is missing. @ line 103, column 15
[ERROR] ‘dependencies.dependency.version’ for net.imagej:imagej-updater:jar is missing. @ line 107, column 15
etc etc.

The nice thing was: clicking on resolve automatically fixed this problem. But the build process failed.

The reason was, that I have several Java versions on my system (1.7 and 1.8). I did not use 1.8 prior to ImageJ and Netbeans did not know where to find it even after I had already set openjdk 1.8 to be the system default java compiler.

I could fix this problem by adding in Project Properties > Build > Compile … /usr/lib/jvm/java-1.8.0-openjdk-amd64.

It is now possible to run ImageJ. Nice!!!

However: were are all the java or jar files hidden nowadays?

I thought a git pull request would collect all source files from github in a local directory?

If I am right then the JAR files which are listed in the pom.xml dependencies section are those which accumulated in the Maven .m2/repository directory.
In addition, I have the impression that the sources of ImageJ as I can download them from https://imagej.nih.gov/ij/download.html are not part of https://github.com/imagej/imagej but they are part of https://github.com/imagej/imageja. Is this correct? Why jimagea? What does the letter “a” mean?

Any help is very welcome!!!

Sincerely

Karl-Heinz

This is indeed an outdated page. The current information should be found on the wiki (where you can also update it yourself if you feel something is missing :slight_smile: ). Maybe @ctrueden or @hinerm can remove the outdated content to avoid search engines picking it up?

That’s great, people improving the documentation on the wiki are very welcome!

The forum software replaces links from known sources by previews of the content to help readers of your posts to follow without the need of digging through a lot of related posts. If you feel the forum is doing too much here, please rest assured that it saved me some time and mouse clicks when reading your post. :slight_smile:

Your suggestions are very much appreciated. To facilitate discussion, I suggest to edit (or create) a page on the wiki directly, or to discuss the text here in the forum (where you have markdown rendering included).

1 Like

Dear Jan,

to be honest, the quality of your work is so outstanding that I am afraid to contribute to the wiki pages directly.

I neither have the experience to work with the wiki nor do I have the overview of the topic or the knowledge of the details.

My documentation is a very personal approach of a beginner to the ImageJ2 context. I was reading a lot during the last two days and learning a lot, too. I summarized the details in the latest version of the file which I enclose here still as a zip-archive as it is already nearly 300 lines long.

Howto-Write-ImageJ-Plugins.txt.zip (7.4 KB)

I struggled with technical terms, the frustrating complexity of the topic and my limited knowledge at the same time. My summary surely contains mistakes. But I think it should be a good starting point for others new to ImageJ2, too.

Feel free to do what you consider most appropriate with the content. I totally rely on your suggestions.

Sincerely

Karl-Heinz

@ctrueden I vote for developer.imagej.net to blanket redirect to imagej.net and removing any remaining content exclusive to the developer subdomain.

For high value pages, like this Writing ImageJ Plugins, it would probably be worthwhile to set up specific redirects to the corresponding page on the wiki… but I don’t think it’s necessary for all old content.

It is being migrated to the wiki, page by page. Obsolete pages can still be redirected to the relevant page on the wiki, rather than using a blanket.

In other words, I do think it is necessary… partly because we are so close already. There are not that many pages left.

Do you have any advice on finding obsolete pages, since all the outgoing links from http://developer.imagej.net/ point to the wiki?

The front-page content of http://developer.imagej.net/ just looks like an ugly version of http://imagej.net/Welcome at this point. Since it isn’t actually providing access to any content in the developer subdomain, is there any reason not to redirect this front page?

If you log in, you can then browse all remaining content.

Absolutely no reason—we should have done that months ago. I did so now. But just for the front page, at the moment.

Edit: I recall now that the reason I didn’t do so before is because there was a single menu link, Blog, that does not go to http://imagej.net/. There are some old blog posts which are the last remaining thing to migrate. Anyway, I am working on finally getting rid of developer.imagej.net 100% right now. The timing is apropos since we are looking at migrating all the old Drupal sites to the new web server anyway.

2 Likes

So, I’m reading over your guide so far. It is quite thorough, and it looks like you deciphered/documented all the major aspects! :+1:

I do want to make some comments; I will quote the relevant segments here, even though you didn’t paste them directly.

You will need:

All good, except that the ImageJ2 source code is not actually needed.

Rather, to develop an ImageJ plugin, you should start from a template, such as:

Tools like Maven and Jenkins make it hard for casual developers to understand the complicated workflow of ImageJ.

Jenkins should not be relevant to this discussion. It is mentioned on the Project management page because we use it to manage core ImageJ components. But it is not necessary for third party plugin development.

As for the “complicated workflow of ImageJ”—could you elaborate on what you mean by that? And how Maven makes it harder to understand? I personally believe Maven has the power to make things much, much easier, even for casual developers—as long as we have a good introductory guide in an easy-to-find place.

For a beginner it is hard to understand the underlying philosophy

Did you see the Philosophy page? If that page, and Architecture, still do not explain the rationale for multiple core components to your satisfaction, then I would like to remedy that by explaining in simpler terms, right away at the beginning of one or both of those pages.

Download the current JAR files from http://developer.imagej.net/downloads

Definitely avoid using http://developer.imagej.net/ for anything these days. It is a legacy site, in the process of being totally phased out. If you are looking for downloads, see http://imagej.net/Downloads.

imagej-2.0.0-SNAPSHOT-all.jar

Using this JAR works for local development, but it will cause you various problems later. For example, if you share your source code, you will need to commit this JAR along with your NetBeans project files to your repository, to ensure everyone else uses the same version of ImageJ that you do.

Using Netbeans with Maven

This is a much better approach. You will not have to commit any JAR files to source control. You can pin your code to fixed, known versions of its dependencies that will provide reproducible builds for many years to come.

If you want to learn from the ImageJ sources how to program image analysis algorithms then you will need to clone another github project: https://github.com/imagej/ImageJA.

Those are the ImageJ 1.x sources. I do not recommend studying them to learn about image analysis algorithms. At least: I do not recommend studying only those sources. The ImageJ Ops project is the growing and actively developed repository where we are working on many core image processing and analysis routines.

More generally: if there is a command in ImageJ that provides a function you like, you can find the source via a couple of different techniques. Note that we certainly want to make this process easier; there will certainly be future improvements to http://search.imagej.net/ which do so.

Does somebody know why the ImageJ sources are contained in the ImageJA project? What for stands the letter “A” at the end of ImageJA ?

See the ImageJA page. The A was originally for “Applet” and to differentiate the project from ImageJ itself. Note that the ImageJ 1.x repository is actually at http://github.com/imagej/imagej1 but it does not use Maven. The ImageJA project, these days, is nothing more than a Mavenized version of ImageJ 1.x with a clean Git history.

the artifactId (NOTE: should contain a ‘_’ character)

Note that the _ is only needed for ImageJ 1.x plugins. If you write an ImageJ2 command (like the ones linked above in simple-commands tutorial) then the underscore is unnecessary.

the groupId (optional)

You should put a groupId. It is misleading to leave it off, because then net.imagej (or sc.fiji if you used pom-fiji as parent) will be inherited. And your project is not a core ImageJ project.

Edit src/main/resources/plugins.config

Again, only needed for ImageJ 1.x plugins. For ImageJ2 commands, the information is provided by the @Plugin annotation at the top of the Java class.

Example, which sets the plugins.dir property so that the plugin appears in the menus when launched from an IDE

Setting plugins.dir is only necessary for ImageJ 1.x style plugins. If you write an ImageJ2 command, it should appear in the menus regardless.

The directory structure of a very simple demo project looks like

I see you documented the subdirectories of target. That is probably not necessary, and might confuse readers, since Maven generates that entire folder. It is always the case that you can fully delete the target folder and rebuild, and everything should still be OK. In other words: never commit any files from target to Git!

what is the difference between Ant and Maven? Or: build.xml vs. pom.xml

In addition to the comments in your writeup, I would add: Maven is declarative, whereas Ant is procedural. In Ant, you say “do X, then do Y, then do Z.” Whereas in Maven, you say “my code is here, my resources are there, and please use these plugins.” The advantage of the latter is that Maven provides a standardized build sequence (called the “build lifecycle”) making it compatible with all the major IDEs.

That same central location for declarations—the POM, of course—also provides a place to declare important metadata about the project, such as where the source code lives on the Internet. This lets you write all sorts of tooling to work with the project in interesting ways. For example, all the info boxes on the wiki for core ImageJ and Fiji plugins will soon be auto-generated from those plugin POM files, rather than needing to be maintained by hand. (So: no more manually editing your plugin’s wiki page every time you make a new release!)

What is it all about with this Java 6 and Java 8 stuff?

I want to apologize again for the mess that is Java 6 vs. Java 8. We should be fully transitioned to Java 8 pretty soon (by end of summer, hopefully?) and then some of this complexity will disappear.

Make a redistributable package from a locally customized Fiji

Awesome that this is in your FAQ. :smile: The whole FAQ is awesome in general, actually! :trophy:

Dear Curtis,

thank you very much for your extensive feedback. I integrated all your comments into the tutorial. Most sentences were just copied to an appropriate position. I feel that now you could put this summary on your wiki if you like.

Thanks to all, how helped me understand ImageJ2 better!

I have to admit that the most important information was that the most current source of information was

"Definitely avoid using http://developer.imagej.net/ for anything these days. It is a legacy site, in the process of being totally phased out. If you are looking for downloads, see http://imagej.net/Downloads."

On imagej.net a lot of information is available already once you find your way through the all the links :slight_smile:

Howto-Write-ImageJ-Plugins.txt.zip (8.7 KB)

Thank you all for your patients and help!

Sincerely

Karl-Heinz

Great!

Since some of the information covers the current state during transition, this writeup will be more vulnerable to outdatedness as the software continues to evolve. As such, I think the best fit is as a News post. So that is what I have done.

@Scrivello Please create an account on the wiki. I would like to create a user page for you, and link to that at the top, instead of linking to your forum user page which is less ideal. Once you have a wiki account, you can also edit that news post to your liking, if you want to make any more changes.

Lastly, I would like to comment on your usage of the term “your wiki”: it is critical for the community to consider it as “our wiki” and not “the wiki of core ImageJ development teams.”

It took me about two hours to edit your text into wiki format, proofread, etc. It would have taken less time if you had made a wiki page in the first place. I was tripped up by the multiple versions of .txt files which were on my desktop: I initially wasted ~20 minutes editing the old version, before I realized it was not the latest. Using online shared documents such as wiki, Google docs, etc., avoids these sorts of “20th century” problems.

Anyway, to end on a positive note, I want to thank you again for your awesome writeup and thorough research. I hope this news post is helpful to more aspiring ImageJ developers!

1 Like

Dear Curtis,

thank you very much for this additional effort. Please apologize that I caused additonal loss of time.

I promiss: next time I will upload an article to the wiki myself! I started already with the next topic on my agenda: working through the tutorials and learn how the components of the different SciJava projects interplay. It might take some time however, as daily business is interfering a lot at the moment.

Sincerely

Karl-Heinz

PS: I created the account for the wiki.

1 Like

Great, thanks! I added a simple “user box” to your user profile, and updated the news post to link to your profile.

Also: I announced this article in a tweet. :grin:

1 Like