In this brief introduction, you will read what ImageJ is, and how to install it, along with some minor configuration tricks. By the end of this chapter, you will have a working ImageJ installation in your system. Contents of this chapter include:
A brief description of ImageJ and its main purpose
An installation and upgrade guide
How to tweak the amount of memory used by ImageJ, in case you are working with big images
Readers who wish to read a more in-depth text about ImageJ's history should obtain the paper "NIH Image to ImageJ: 25 years of image analysis", published in Nature Methods, 2012, 9:7, pages 671-675.
ImageJ's development started as long ago as 1987, when it was not even named ImageJ and Java was yet to be born. That year, Wayne Rasband started coding a piece of software named "NIH Image" (after the National Institute of Health (USA), which funded his efforts) in order to provide a way to perform image analysis on the old Apple Macintosh II, which lacked an image analysis platform, and was starting to be the desktop system of choice for many scientists. He started distributing his software for free to anyone who requested it.
This imaging software became increasingly popular, but at the time the market for Apple computers was being surpassed by the PC. NIH Image was developed specifically for Apple systems and didn't work on the Windows platform. In 1995, the Java programming language was created by Sun Microsystems. This allowed Wayne to start porting his software so it would work on PCs, and at the same time maintain a single, multi-platform version of the source code. ImageJ was born.
During the development process, a great deal of care was taken to allow users to extend ImageJ's native capabilities with the help of macros that can be developed even by users with no prior programming experience; and an open API allowed experienced programmers to code their own plugins. This is one of the reasons for ImageJ's success among scientists that work with images regularly, along with the huge amount of macros and plugins available from the web page. At the time of this writing, the ImageJ's user mailing list had more than 2000 subscribers and is a very active discussion meeting point for everything related to this software and related projects.
If you perform a search for "imagej" on some popular academic databases (such as PubMed (http://www.ncbi.nlm.nih.gov/pubmed), IEEE Xplore (http://ieeexplore.ieee.org/), or Google Scholar (http://scholar.google.com), you will find that this software has been successfully used in a huge number of scientific papers in fields that span several disciplines, from confocal microscopy to X-ray analysis, vehicle license plate detection, ultrasound diagnosis of breast cancer, development of automatic 4D segmentation algorithms or tomographic image reconstruction, to cite just a small sample.
ImageJ is not intended to serve as a replacement for Adobe Photoshop, GIMP, or any other graphics editing program. It is less centered on layers, transparencies, cloning, or blurring, and more on quantification, filtering, measuring, and mathematical processing. This does not mean that an image cannot be modified using ImageJ, but the type of modification that ImageJ is intended to do is of a different nature than that of the programs mentioned previously.
ImageJ is software written in the Java programming language. In order to run it, Java Runtime Environment (from now on, just Java) should be installed in your system (go to http://java.com for more information). If you do not have it installed and cannot do it for any reason, you can download several ImageJ packages that include it, but the download size will be considerably larger. The current stable version of ImageJ (1.46r at the time of this writing, though the development is fast and new versions are released almost on a weekly basis) can be downloaded from: http://imagej.nih.gov/ij/download.html. The exact package to be downloaded depends on your particular situation (what operating system are you using, whether you have administrator privileges to perform a system-wide installation, and so on).
Depending on your particular needs, you may want to download the platform-specific installer package, or simply the platform-independent version that consists of a ZIP file, that can be uncompressed and run from your user directory, or even from a USB stick. The platform-specific packages are straightforward to use and behave just like a regular application for the operating systems they are built for; there is extensive documentation regarding the particular details of the installation process for each system in the main ImageJ webpage (Windows: http://imagej.nih.gov/ij/docs/install/windows.html; Linux: http://imagej.nih.gov/ij/docs/install/linux.html; Mac OS: http://imagej.nih.gov/ij/docs/install/osx.html). In the next subsections, we will talk a bit about performing a local installation with the platform-independent file. Depending on your particular configuration, you might want to use these files, as they do not require you to have administrative privileges, and allow you to install ImageJ in any folder in your user directory.
Download the file
ij146.zip (or the one currently being offered) from the download page and unzip it to the folder where ImageJ will be installed. Inside the
ImageJ/ folder, double-click on
ImageJ.exe. The following dialog will pop up:
The auto-configuration process is pretty straightforward, and consists basically of detecting the path to your Java installation. If the path cannot be automatically found, you will be asked to provide the location of the
javaw.exe file. Once this has been done, a new
ImageJ.cfg file will be created in the directory where you have unzipped the file, and ImageJ will start. This file is created only in Windows. From that point on, double clicking on
ImageJ.exe runs ImageJ, and a direct shortcut can be created on the desktop or where it is useful for your purposes.
Just like with the Windows version, download the
ij146.zip (or the most current) file. Unzip it to the desired folder and execute the
run script (on Mac systems, you can also double-click on the application icon). This file just contains a call to the Java virtual machine with the necessary parameters, so the
java command needs to be in the system path; in this case, there is no Java autodetection or
ImageJ.cfg generation. You can safely delete
ImageJ.exe, as it is a Windows-only file.
As you can see on the ImageJ News webpage, new versions appear quite regularly. For this book, we installed version 1.46r, but we wanted to catch up with version 1.47q. This latest ImageJ version has new functionalities and bug fixes that may be interesting for the user. Fortunately, ImageJ has an internal update command that will allow you to perform the update process easily, and without any user intervention. Simply run the Help | Update ImageJ... command and you will get the following dialog:
As you can see, it allows us to upgrade to the latest release and to other older versions, and bleeding-edge daily builds that are of no interest here. If you click on OK, your ImageJ installation will be upgraded and then automatically closed. The new version will be used the next time you run it.
Once you have a working ImageJ installation, you might want to tweak some configuration options, such as the appearance, font size, and proxy settings. These options are easily modified using the menus Edit | Options | Fonts…, Edit | Options | Appearance…, and Edit | Options | Proxy Settings….
The next section is dedicated to explain how to tweak the one configuration parameter that might be vital during your analysis tasks: the amount of system memory available to ImageJ.
Along with the version (note the upgrade!), the information of ImageJ's main author, and some other data that resembles those previously commented, you can see that 4095 KB of RAM memory is used, from a total of 640 MB (less than 1 percent). Every time you open a new image, the amount of memory being used increases, until the limit is reached. Once you get to this point, an error will pop up, as ImageJ will not have the necessary resources. The error will be something like this:
If you are going to work with big images, or you need to keep open a great number of them, it is wise to increase the memory limit for your system. It can be done, as the error message states, by navigating to the Options | Memory & Threads command from the menu. This will open the following dialog:
Here, you can select the total amount of memory you want ImageJ to use. For example, we change the Maximum memory field to a value of
2048, and click on OK. A new window will inform us that ImageJ will use the new limit upon restart.
In Windows systems, this value is stored in the
Image.cfg file. Another option is to edit that file before running ImageJ. These are the contents of that file in a regular installation, though the exact path may vary:
C:\Program Files\Java\jre7\bin\javaw.exe -Xmx640m -cp ij.jar ij.ImageJ
As you can see, this is just a call to the Java Runtime Environment with the appropriate parameters to run ImageJ.
-Xmx640m defines the amount of memory available for the Java virtual machine. If we change that value to
-Xmx2048m, we will accomplish the same result as before. This way of changing the total amount of memory can also be used in Linux; in this case, the value is stored in the
run script as another argument for the Java virtual machine. These are the typical contents of the
run script upon installation:
java –Xmx512m –jar ij.jar
This script just calls the
java executable with the configured memory limits, and launches the application inside the
ij.jar file. This memory limit can be changed directly in the script file.
Bear in mind that, for memory amounts bigger than 2 GB, a 64-bit system and appropriate Java version is needed.
In this chapter, you have learned what ImageJ is, and how it can be downloaded and installed. Now, you are ready for basic image processing concepts and examples detailed in the next chapter. For further reference, you are encouraged to visit the ImageJ Information and Documentation portal at http://imagejdocu.tudor.lu/, which complements the information provided in the official webpage.