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.
http://romainfrancois.blog.free.fr/index.php?category/R-package/RImageJ
Recently, an integrated interface is available.
Bio7
http://129.70.40.49/modelling/?page_id=75
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/