Some issues with runImageJ

Hi,

First I would like to thank you all CellProfiler team for their work on CP. It’s very easy and quick to analyse a lot of images.

I’m asking for help because I tried to use RunImageJ module to be able to perform a background substraction on my images. I have three issues with this module :

***** Probably the most important, I have a memory problem when I want to analyse a lot of images (more than 700). The pipeline stop at ~150 images and I got this error :

Traceback (most recent call last): File "/home/hmary/CellProfiler/CellProfiler-10971/cellprofiler/pipeline.py", line 309, in run self.module.run(self.workspace) File "/home/hmary/CellProfiler/CellProfiler-10971/cellprofiler/modules/saveimages.py", line 445, in run should_save = self.run_image(workspace) File "/home/hmary/CellProfiler/CellProfiler-10971/cellprofiler/modules/saveimages.py", line 489, in run_image self.save_image(workspace) File "/home/hmary/CellProfiler/CellProfiler-10971/cellprofiler/modules/saveimages.py", line 836, in save_image return self.save_image_with_bioformats(workspace) File "/home/hmary/CellProfiler/CellProfiler-10971/cellprofiler/modules/saveimages.py", line 765, in save_image_with_bioformats env.make_byte_array(pixels), ifd, True) File "/home/hmary/CellProfiler/CellProfiler-10971/cellprofiler/utilities/jutil.py", line 368, in call raise JavaException(jexception) JavaException: saveBytes

If I click on “continue processing”, one or two images after, I got a new error :

Traceback (most recent call last): File "/home/hmary/CellProfiler/CellProfiler-10971/cellprofiler/pipeline.py", line 309, in run self.module.run(self.workspace) File "/home/hmary/CellProfiler/CellProfiler-10971/cellprofiler/modules/saveimages.py", line 445, in run should_save = self.run_image(workspace) File "/home/hmary/CellProfiler/CellProfiler-10971/cellprofiler/modules/saveimages.py", line 489, in run_image self.save_image(workspace) File "/home/hmary/CellProfiler/CellProfiler-10971/cellprofiler/modules/saveimages.py", line 836, in save_image return self.save_image_with_bioformats(workspace) File "/home/hmary/CellProfiler/CellProfiler-10971/cellprofiler/modules/saveimages.py", line 765, in save_image_with_bioformats env.make_byte_array(pixels), ifd, True) File "javabridge.pyx", line 1278, in javabridge.JB_Env.make_byte_array (javabridge.c:12393) MemoryError: Failed to allocate byte array of size 8257536

This is my main problem because I it doesnt work, I would have to remove the runImageJ module and that sould be a shame because I really need the backgournd substraction.

***** Secondly,the two other problems are linked I think. When RunImageJ module is processing ImageJ window opens and doesnt close itself. So I add an other RunImageJ module just after the previous with this macro:

while (nImages>0) { selectImage(nImages); close(); }
This is working well to close ImageJ window but I’m often distrubing because sometime ImageJ window opens for 0.5s and I lose the focus on the window I was working. The other issue is when I want to run CellProfiler headless I got this error (probably linked with ImageJ) :

hmary martini ~ $ runPipeline.sh running build_ext Using jdk_home = None Using jdk_home = None running build_ext running build_ext /usr/lib/python2.6/dist-packages/pytz/__init__.py:32: UserWarning: Module decorator was already imported from /home/hmary/CellProfiler/CellProfiler-10971/decorator.pyc, but /usr/lib/pymodules/python2.6 is being added to sys.path from pkg_resources import resource_stream /usr/lib/python2.6/dist-packages/pytz/__init__.py:32: UserWarning: Module _mysql was already imported from /usr/lib/pymodules/python2.6/_mysql.so, but /usr/lib/pymodules/python2.6 is being added to sys.path from pkg_resources import resource_stream Subversion revision: 10971 Pipeline saved with CellProfiler SVN revision 10971 Thu Apr 7 09:18:38 2011: Image # 1, module LoadImages # 1: 3.76 sec (bg) Thu Apr 7 09:18:41 2011: Image # 1, module RescaleIntensity # 2: 0.13 sec (bg) Thu Apr 7 09:18:41 2011: Image # 1, module CorrectIlluminationApply # 3: 0.12 sec (bg) Thu Apr 7 09:18:41 2011: Image # 1, module Smooth # 4: 0.48 sec (bg) Thu Apr 7 09:18:42 2011: Image # 1, module EnhanceOrSuppressFeatures # 5: 0.33 sec Exception in thread "Thread-0" java.awt.HeadlessException at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:159) at java.awt.Window.<init>(Window.java:432) at java.awt.Frame.<init>(Frame.java:403) at ij.gui.ImageWindow.<init>(ImageWindow.java:60) at ij.gui.ImageWindow.<init>(ImageWindow.java:56) at ij.ImagePlus.show(ImagePlus.java:370) at ij.ImagePlus.show(ImagePlus.java:346) Traceback (most recent call last): File "/home/hmary/CellProfiler/CellProfiler-10971/cellprofiler/pipeline.py", line 1134, in run_with_yield module.run(workspace) File "/home/hmary/CellProfiler/CellProfiler-10971/cellprofiler/modules/run_imagej.py", line 378, in run ijb.inject_image(img.pixel_data, input_image_name) File "/home/hmary/CellProfiler/CellProfiler-10971/imagej/ijbridge.py", line 110, in inject_image ijwm.set_current_image(image_plus) File "/home/hmary/CellProfiler/CellProfiler-10971/imagej/windowmanager.py", line 63, in set_current_image imagej_obj.show() File "/home/hmary/CellProfiler/CellProfiler-10971/cellprofiler/utilities/jutil.py", line 439, in method return call(self.o, name, sig, *args) File "/home/hmary/CellProfiler/CellProfiler-10971/cellprofiler/utilities/jutil.py", line 377, in call raise JavaException(x) JavaException Thu Apr 7 09:18:42 2011: Image # 1, module RunImageJ # 6: 0.13 sec (bg)

I tried to run CP with xvfb-run but I got the same error.

All this issues are related to RunImageJ because when I used CP without RunImageJ all was working perfectly.

I upload my pipeline with one image. Below, you can find some of the softwares I am using :

  • CellProfiler r10971
  • Python 2.6
  • java version “1.6.0_24”
    Java™ SE Runtime Environment (build 1.6.0_24-b07)
    Java HotSpot™ 64-Bit Server VM (build 19.1-b02, mixed mode)
  • Ubuntu 10.04 with Linux 2.6.32-31-generic x86_64
  • matplotlib.version ‘0.99.1.1’

Thank you for all,

HadiM
pipeline.tar.gz (1.21 MB)

Hi HadiM,

I think part of this issue can be dealt with by removing the RunImageJ modules altogether and using appropriate CellProfiler modules to do the same job. Attached is a pipeline which I think does a better job of object detection than before. Several of the module settings can be optimized, making other modules unnecessary.

Regards,
-Mark
2011_04_07.cp (16.9 KB)

Thanks, your pipeline seems to work well! I just had to play with treshold correction factor and lower and upper bounds on threshold parameters.

Thanks again :smile: