Selection causing "Out of Memory" Error

I have been using the Ellipse Split plugin to separate overlapping spots on binary images. First, I run the Ellipse split plugin. Then I measure each ellipse in the ROImanager. There is an issue when I use the Ellipse Split plugin on this image:

When I try to measure the 47th ellipse created by the Ellipse Split plugin on the above image I get an “out of memory” error.

I looked at the coordinates of the selection that was causing the out of memory error and all the x-coordinates were approximately -1073741504.

Is there any way to fix this error?

P.S. Here are the errors that appeared when I tried to measure the selection:


I am not sure how to exactly fix your memory issue… perhaps other experts here on the Forum can chime-in.

You can read up a bit yourself on the ImageJ wiki page discussing Troubleshooting in ImageJ - specifically the section on Out-of-Memory Errors.

Give those instructions a try… and let us know if you are still having issues.

eta :slight_smile:

@myrgth It would be helpful if you could post a minimal macro or script which reproduces the issue you are seeing, along with pertinent details such as how much memory you have allocated to ImageJ. See Bug reporting best practices for guidance. Then we could try to reproduce the issue.


Here is an example macro that reproduces the error:

run(“Ellipse Split”, “binary=[Use standard watershed] add_to_manager merge_when_relativ_overlap_larger_than_threshold overlap=95 major=0-Infinity minor=0-Infinity aspect=1-Infinity”);
arr = Array.getSequence(roiManager(“Count”));
roiManager(“Select”, arr);

This macro requires the “Ellipse Split” plugin from biomedgroup.

Run the macro on this image to get the out of memory error:

The current memory settings for FIJI on my machine are 4484MB with 4 threads. However, I have reproduced this error on another machine that allocated 9999MB to FIJI.

Thanks @myrgth, that is super helpful. I am able to reproduce the problem on my macOS 10.12.5 machine with ImageJ 2.0.0-rc-61/1.51n. I have >10G allocated to ImageJ, and the OOM message appears very quickly. The Monitor Memory command does not show any spike, so I question the validity of the message in this case. The first time the macro is run, it makes some progress and a detailed error message appears. Subsequent invocations on the same running JVM instance seem to make no progress and print simply <Out of memory> with no additional details.

I have an urgent project to finish today, so cannot investigate further, and then I’m on holiday, so I fear I cannot personally investigate more deeply in coming days. If no one else responds within a few days here, please feel welcome to ping me (by writing @ctrueden) and I’ll take a look after August 1.

In the meantime: @twagner, any ideas?

1 Like


Here is some additional information:

I am running ImageJ 1.51n with Java 1.8.0_66 (64-bit).
My OS is Windows 10 Home 10.0.10586

@ctrueden @myrgth

This behavior is very odd. I’m currently out of office but will have a look tomorrow.

1 Like

OK, I’m able to reproduce the error. For ROI 47 seems to be out of the image. I guess during the fitting procedure something bad happens. The only thing I could do is to add some validity check during fitting to remove bad fitted ellipses (e.g with negative coordinates).



I would appreciate it if you could add some checks to the plugin. I have been trying to detect the bad ellipses using a macro and I have not succeeded.



Would you try the following version:

1 Like


The plugin works. I didn’t get any errors on the above image or any other similar images.

Thank you very much.