Difference between revisions of "Developing Fiji"

(Add a central starting point for developers)
 
(Describe the Fiji launcher, and link to the description of Fake)
Line 4: Line 4:
  
 
First, you have to [[Downloading_and_Building_Fiji_From_Source|download and build Fiji]].
 
First, you have to [[Downloading_and_Building_Fiji_From_Source|download and build Fiji]].
 +
 +
== The Fiji launcher ==
 +
 +
After building, you have a program called "fiji" in Fiji's root directory.  Its main purpose is to load a Java virtual machine with known-good options, and then launch ImageJA.
 +
 +
However, it is much more powerful than that.  Amongst other things, you can
 +
 +
* Open images: '''./fiji example.jpg'''
 +
* Call Jython scripts: '''./fiji example.py''' (also works for JRuby scripts when they have an '''.rb''' extension)
 +
* Call the Jython interpreter: '''./fiji --jython''' (the classpath will be the same as when calling ImageJA)
 +
* Run Fiji with the system Java instead of its own one: '''./fiji --system'''.  But beware: this might fail since some plugins need at least Java 1.5, and the 3D viewer needs Java3D.
 +
* Show the java command line instead of running Fiji: '''./fiji --dry-run'''
 +
* Run [[Fake]]: '''./fiji --fake plugins/lens_correction.jar'''
 +
* Compile a Java class: '''./fiji --javac example.java'''
 +
* Run a Java class' main() method: '''./fiji --main-class=example'''
 +
* Pass some Java options: '''./ fiji -server --''' (everything that comes before a '''--''' is interpreted as Java option)
 +
* Link Fiji into the PATH: '''ln -s $(pwd)/fiji $HOME/bin/ && fiji'''
 +
 +
The Fiji launcher can do more, just call '''./fiji --help''' for a short description.
 +
 +
== The Fakefile system ==
 +
 +
Fiji comes with its own builder, named [[Fake]] (''Fiji's mAKE'').  There are already other build systems, such as Ant or Maven, but at least it is simple and small.  For details, go to [[Fake|this page]].
  
 
== Adding plugins ==
 
== Adding plugins ==

Revision as of 09:52, 1 October 2008

Fiji is a community effort. So we are happy whenever we see new people developing Fiji!

Getting started

First, you have to download and build Fiji.

The Fiji launcher

After building, you have a program called "fiji" in Fiji's root directory. Its main purpose is to load a Java virtual machine with known-good options, and then launch ImageJA.

However, it is much more powerful than that. Amongst other things, you can

  • Open images: ./fiji example.jpg
  • Call Jython scripts: ./fiji example.py (also works for JRuby scripts when they have an .rb extension)
  • Call the Jython interpreter: ./fiji --jython (the classpath will be the same as when calling ImageJA)
  • Run Fiji with the system Java instead of its own one: ./fiji --system. But beware: this might fail since some plugins need at least Java 1.5, and the 3D viewer needs Java3D.
  • Show the java command line instead of running Fiji: ./fiji --dry-run
  • Run Fake: ./fiji --fake plugins/lens_correction.jar
  • Compile a Java class: ./fiji --javac example.java
  • Run a Java class' main() method: ./fiji --main-class=example
  • Pass some Java options: ./ fiji -server -- (everything that comes before a -- is interpreted as Java option)
  • Link Fiji into the PATH: ln -s $(pwd)/fiji $HOME/bin/ && fiji

The Fiji launcher can do more, just call ./fiji --help for a short description.

The Fakefile system

Fiji comes with its own builder, named Fake (Fiji's mAKE). There are already other build systems, such as Ant or Maven, but at least it is simple and small. For details, go to this page.

Adding plugins

After you built Fiji successfully, you can add your own plugins.

  • If you haven't done so, pick a name for your .jar file, say My_Plugin. Make sure that it has at least one underscore in it, otherwise ImageJ will not pick it up. If you cannot think of a name with an underscore, just append one. Then create a subdirectory src-plugins/My_Plugin.
  • Now put your sources into that subdirectory. Please no .class files. Readme or license files are okay, however.
  • Create a staged-plugins/My_Plugin.config file. This will be included in the .jar file as plugins.config.
  • In Fiji's root folder, call ./fiji scripts/commit-plugin.py src-plugins/My_Plugin/. Please make sure that it ends with a slash. This command will make the necessary edits to the Fakefile and .gitignore, and commit everything needed for your plugin.
  • Now build the plugin with ./fiji --fake.
  • After testing, you might realize that you need changes. In this case, decide if you want to amend the commit (if there was a silly typo, you might want to hide that fact from the world), or if you want to make a new commit.
  • When everything is done and fine, publish!