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.
If you run Help | About ImageJ... you will get this nice image:
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:
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:
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.
Note
It is not a good idea to give ImageJ all the available memory. Your operating system and other programs need their share too.