The ImageJ folder structure
After installing ImageJ, a folder structure is placed at a location designated during the installation process. This folder's structure consists of a few key folders that are essential to the regular functioning of ImageJ. If you installed ImageJ in a folder to which you have no write privileges, there are two important folders that need read and write permissions in order for ImageJ to function: the plugins
and macros
folders. Also, the configuration file on Windows platforms (pref.cfg
) needs write permissions for the user. Without the write permission, settings cannot be changed. The next section briefly explains the properties for the plugins
and macros
folders, and how ImageJ uses them.
Plugins folder
The two most important folders are the macros
and plugins
folders. These folders will be searched for available macros and plugins when ImageJ loads. When you download a plugin and place it in the plugins
folder, the plugin will be found the next time ImageJ starts. When downloading plugins, there are three different options of files that can be downloaded: a Java source file (.java
), a compiled file (.class
), or a Java archive (.jar
). In order for plugins to be displayed in the plugins menu, the .java
and .class
files need to contain at least one underscore character in the filename. For .jar
files, the archive needs to contain a plugins.config
file that defines the location within the menu system. This has an additional advantage that plugins within a .jar
archive can also be installed outside the plugins menu.Underscores
are replaced by spaces in the plugins menu or removed completely if the last character is an underscore. If you place your plugins in a folder within the plugins
folder, this folder name will also show up in the Plugins menu, but only if it contains at least one valid plugin. If you download the source file of a plugin, you can create an executable plugin by choosing Compile and Run from the Plugins menu and selecting the Java file. The next time ImageJ is run, the new plugin will be automatically detected.
JAR files are slightly special. They can be placed within the plugins
folder, but they do not have to show up in the Plugins menu. The JAR file contains a manifest that specifies the location where the plugins within it are placed. This specification allows the developer to place the plugin in a specific submenu of the Plugins menu, regardless of the folder where the JAR file is placed. This would be especially handy if you create a group of linked or associated plugins that you wish to group within the Plugins menu.
Macros folder
The macros folder contains a collection of macros that come with ImageJ and is also the default location to store user-defined macros. ImageJ macros are flat text files with the .ijm
extension, although this extension is not essential. Any flat text file with valid macro code can be run in ImageJ. Macros in ImageJ have their own language, which is similar to Java, but with a few minor differences. Chapter 5, Basic Measurements with ImageJ will investigate how to create macros and will explain the language constructs in ImageJ macros.