R is a statistical computing package, and ImageJ is image processing and analysis software (actually, R could do image processing and ImageJ could also do statistics, but not usually used and tools are limited). Ideal work is then to somehow combine these two.
Such attempts has not been rare. Several attempts has been made. Project such as RImageJ is one of such.
Recently, an integrated interface is available.
It seems that this project is mostly oriented towards ecology analysis, but the basic concept is to ease passing data between R and ImageJ. There many instructions on example usage of the software.
Java - R JRI - Java/R Interface http://www.rforge.net/JRI/