Installation of Apache Commons Math

How to add Apache Commons Math library to ImageJ

Apache commons math is a highly useful library for numerical processing / analysis of images. Though Fiji comes with this library, legacy ImageJ does not include this library in the downloaded package. To install it, first go to the Apache Commons Math website and download the latest binary release. Unzip the file, and place commons-math3-3.x.x.jar file in the plugin folder of ImageJ.

This does not cause any difference in the menu, but if the installation is successful, following Jython script should work ([Plugins > New > Macro…] and then copy&paste the code below. Then in the macro menu, [Macros > Evaluate Python]).

from org.apache.commons.math3.analysis.function import Abs as ApacheABS

val = -10
print ApacheABS().value(val)

It should print “10.0” in the Log window.

Javadoc of Apache Commons Math 3.6.1 is here