Problem with RunImageJ + Close All in CP2.1.1, but not in CP2.1.0 or CP 2.1.2

I have come across a problem when trying to clean up after using RunImageJ. It works well in CP2.1.0 and CP2.1.2, but not in CP2.1.1. Attached is a simple pipeline that shows the problem. To reproduce the problem do the following steps:

  1. Add at least 2 grayscale images to the file list.
  2. Start Test Mode
  3. Run
  4. Next Image set (F7)
  5. Run


  1. Add more grayscale images than you will have workers.
  2. Analyze images.

Traceback (most recent call last):
File “cellprofiler\gui\pipelinecontroller.pyc”, line 2777, in do_step
File “cellprofiler\modules\run_imagej.pyc”, line 747, in run
File “cellprofiler\modules\run_imagej.pyc”, line 859, in do_imagej
File “imagej\macros.pyc”, line 84, in run_batch_macro
File “cellprofiler\utilities\jutil.pyc”, line 514, in execute_future_in_main_thread
File “cellprofiler\utilities\jutil.pyc”, line 872, in method
File “cellprofiler\utilities\jutil.pyc”, line 785, in call
File “cellprofiler\utilities\jutil.pyc”, line 762, in fn
JavaException: org.mozilla.javascript.WrappedException: Wrapped java.lang.NullPointerException (#3)

(When I run it on my real application using some of my own ImageJ-plugins I get an exception “java.lang.IllegalArgumentException: Stack is empty”. It works fine in CP2.1.0 and CP2.1.2)

My guess is that there is still something left in the ImageJ memory, even though “Close All” is used.
Any ideas? It would be good to have a solution to this in an official release since many people are using the latest official version.

Petter Ranefalldebug211.cppipe (8.7 KB)

Pettar, try replacing the macro, run(“close_all”) with the command File > Close All. debug211_lee.cppipe (8.7 KB) That works for me. I think it’s a problem with ImageJ 2 getting confused about the images within ImageJ 1, so using ImageJ 2 to close the images makes both happy.

Thanks Lee, that worked just fine.