http://imagej.273.s1.nabble.com/Memory-leak-when-using-Macro-to-process-1000-images-tp5009264p5009275.html
>SCIFIO is known to cause memory leaks.
SCIFIO when opening files" disabled. Furthermore, in recent versions of
Fiji all known SCIFIO-related memory leaks have been addressed.
The macro looks correct. I tested with and without SCIFIO enabled and did
not see a significant memory leak. If you still see crashes with an
processing runs.
console and recording the exact error on crashing.
> guide.
Let us know how things work out.
> On Aug 19, 2014, at 7:14 AM, George H wrote:
>
> > Hi,
> >
> > I am using ImageJ v1.49e and I wrote a simple macro that will read in
> 1000+
> > images from a directory and perform some processing. Once its all over I
> > save the summaries to a file. I do this all in batchmode so the windows
> > don't open and close quickly.
> >
> > So the issue is that the memory usage keeps rising until the program
> > crashes. I really do not know why this is happening and I am opening and
> > closing each image.
>
> It looks like you are using Fiji so you should verify that "Use SCIFIO
> when opening files" is disabled in Edit>Options>ImageJ2. SCIFIO is known to
> cause memory leaks. The SCIFIO option is disabled by default in
> Fiji/ImageJ2 2.0.0-rc14 and later.
>
> -wayne
>
> > Can anyone locate in the code below where things are going wrong?
> Thanks.
> >
> > -----
> > Dialog.create("Select Options");
> > Dialog.addSlider("Subtract Background Rolling:", 0.0, 90.0, 30.0);
> > Dialog.addSlider("Min Particle Size (px):", 5, 90, 15);
> > Dialog.addSlider("Min Particle Circularity:", 0.0, 1.0, 0.40);
> > Dialog.addCheckbox("Save Summaries to file", true);
> > Dialog.show();
> >
> > inputDir = getDirectory("Choose the Input Directory");
> > inputDir = replace(inputDir, "\\\\", "\\\\\\\\");
> >
> > if(inputDir != "") {
> > inputList = getFileList(inputDir);
> > rollingValue = Dialog.getNumber();
> > minParticleSize = Dialog.getNumber();
> > minParticleCirc = Dialog.getNumber();
> > saveSummaries = Dialog.getCheckbox();
> > setBatchMode(true);
> > for (i=0; i < inputList.length; i++) {
> > showProgress(i+1, inputList.length);
> > fileName = inputList[i];
> > imageAnalysis(inputDir, fileName, rollingValue, minParticleSize,
> > minParticleCirc);
> > }
> > if(saveSummaries) {
> > selectWindow("Summary");
> > saveAs("Results", inputDir+"summaries.txt");
> > }
> >
> > call("java.lang.System.gc");
> > setBatchMode(false);
> >
> > if(isOpen("Summary")) {
> > selectWindow("Summary");
> > run("Close" );
> > }
> > }
> > else {
> > exit("Must select an input and output directory");
> > }
> >
> >
> > function imageAnalysis(inputDir, fileName, rollingValue, circSize,
> > minCircularity) {
> > open(inputDir+fileName);
> > run("Enhance Local Contrast (CLAHE)", "blocksize=127 histogram=256
> > maximum=3 mask=*None* fast_(less_accurate)");
> > run("8-bit");
> > run("Subtract Background...", "rolling="+rollingValue);
> > setAutoThreshold("Triangle");
> > setOption("BlackBackground", false);
> > run("Convert to Mask");
> > run("Set Measurements...", "area mean min centroid shape feret's
> > area_fraction redirect=None decimal=3");
> > run("Analyze Particles...", "size="+circSize+"-Infinity
> > circularity="+minCircularity+"-1.00 exclude clear summarize");
> > close();
> > }
> >
> >
> > --
> > George
> >
[hidden email]
> >
> > --
> > ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>