Tuesday, June 24, 2008

ImageJ and Elcipse for plugin development

A lot of patterns in biology are the sort of obvious visual ones that everybody can appreciate. To start to quantify it takes a bit of processing. Since however the patterns are often spatial, a lot of tools have been developed to analyse these. Additionally optical microscopy has a long and glorious history in biology. So ImageJ has become for modern biologists, what the Sambrook et al Molecular Cloning manual was for the molecular biologists.

With the aim of segmenting some slightly complicated radial data, I decided the existing algorithms and tools were not sufficient. So instead of doing it the easy way- using MATLAB's ImageProcessing toolbox, I decided to go the open-source way. And its in Java and nobody who wants to try using my tool needs anything more than an internet connection and a machine capable of running imageJ.

Since I have found programming, particularly in Java using Eclipse to be such a pleasure I decided to go that way. A nice little introduction to how to configure and ImageJ plugin project in Eclipse (introduction to Eclipse elsewhere) was available, I have summarised the settings as briefly as possible:

1. When creating File->New->Java Project, click 'Make separate source and output folders'.
2. Rename the output folder 'plugins'
3. Put source files or make new ones in the src folder.
4. Create a new folder 'Externals' for external Jars that you would need (like JAMA- numerical package for matrices).
5. Copy ij.jar (the imageJ jar file) into the topmost layer of the project heirarchy.
6. Click on the project in the Eclipse window, then go to Project->Properties->Java Build Path->Libraries->Add External Jars and add those jars needed (ij.jar is a MUST, all others optional- depending on the plugin).
7. If a simple plugin is written in the src folder, run using the Run->Open Run Dialog

Project: myplugin
Main class: ij.ImageJ


Program arguments:
-Dplugins.dir=C:\Code\myplugin -Dmacros.dir=C:\Code\myplugin

VM arguments:

-Xms256m -Xmx512m

And then RUN!
Should work!

No comments: