imageJ unexpectedly crashes when I quantify cells


#1

Hi,

When I am quantifying my cells by running the this macro

// select the green channel, which has the best contrast
run("RGB Stack");
setSlice(2);
// change scale from inches to microns
run("Set Scale...", "distance=317 known=200 pixel=1 unit=um");
// erase scale bar
setBackgroundColor(255, 255, 255);
makeRectangle(1019, 906, 320, 44);
run("Clear", "slice");
run("Select None");
// set threshold
setAutoThreshold();
getThreshold(min, max)
setThreshold(0, max/2);
// measure area and area fraction
run("Set Measurements...", "area area_fraction limit display redirect=None decimal=3");
run("Measure");
selectWindow("Results");

I analyze a lot of images and I usually save my data after I get the %area for around 50 images but a lot of the times it crashes before I am able to save…Is there anyway I can make the results window automatically save the %area I am getting for my images? Or is there a way I can prevent imageJ from crashing so often? I always report the crash but it does not seem to do anything. Thank you.


#2

Hi @Pat_Jas

So - I’m no expert here… but I think it might be a memory issue if processing so many images. There would be two things you could try:

  1. You could adjust your memory in Memory & Threads dialog. Info on that can also be found on the ImageJ wiki’s FAQ page.
  2. You can also include this code at the top of your macro code: setBatchMode(true); This call will keep all image windows hidden - will stop them from popping up during processing… which should help save on memory.

I hope this at least gives you a few things to try - let’s see if it helps!

eta :slight_smile: