Java out of memory error in FIJI on 64-bit windows OS

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Java out of memory error in FIJI on 64-bit windows OS

nhasan
hi everyone,

I am running a batch processing macro on ~450 images and each image is ~35 MB. The macro involves creating a duplicate of the image and then converting the duplicate into 8-bit and thresholding and then area coverage measurement and saves both the original and the duplicate image. So I suppose it takes around ~70 MB to process one image. The machine I am doing this analysis on has 8GB RAM/working memory and has Windows 7 64-bit OS. The issue is that when I run my macro, it can only analyze upto 129 images and then gives the following error -

(Fiji Is Just) ImageJ 2.0.0-rc-8/1.49c; Java 1.6.0_24 [64-bit]; Windows 7 6.1: 6027 MB of 6093 MB (98%)

java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:2786)
at Java.ioByetArrayOutputStream.write(ByteArrayOutputStream.java:94)
at ij.io.ImageWriter.writeRGBImage(ImageWriter.java:224)
at ij.io.ImageWriter.write(ImageWriter.java:299)
at ij.io.TiffEncoder.write(TiffEncoder.java:128)
at ij.io.FileSaver.serialize(FileSaver.java:224)
at ij.gui.ImageRoi.getSerializedImage(ImageRoi.java:80)
at ij.io.RoiEncoder.saveImageRoi(RoiEncoder.java:330)
at ij.io.RoiEncoder.write(RoiEncoder.java:214)
at ij.io.RoiEncoder.write(RoiEncoder.java:53)
at ij.io.RoiEncoder.saveAsByteArray(RoiEncoder.java:68)
at ij.io.FileSaver.getOverlay(FileSaver.java:155)
at ij.io.FileSaver.saveAsTiff(FileSaver.java: 108)
at ij.IJ.saveAsTiff(IJ.java:1746)
at ij.IJ.saveAs(IJ.java:1670)
at ij.IJ.saveAs(IJ.java:1659)
at ij.macro.Functions.saveAs(Functions.java:2868)
at ij.macro.Functions.doFunction(Functions.java:156)
at ij.macro.Interpreter.doStatement (Interpreter.java:227)
at ij.macro.Interpreter.doBlock (Interpreter.java:599)
at ij.macro.Interpreter.doStatement(Interpreter.java:269)
at ij.macro.Interpreter.doFor (Interpreter.java:526)
at ij.macro.Interpreter.doStatement(Interpreter.java:251)
at ij.macro.Interpreter.doStatements(Interpreter.java:215)
at ij.macro.Interpreter.run(Interpreter.java:112)
at ij.macro.Interpreter.run(Interpreter.java:82)
at ij.macro.Interpreter.run(Interpreter.java:93)
at ij.plugin.Macro_runner.runMacro(Macro_Runner.java:153)
at ij.plugin.Macro_runner.runMacroFile(Macro_Runner.java:137)
at ij.plugin.Macro_runner.run(Macro_Runner.java:34)
at ij.IJ.runPlugIn(IJ.java:172)
at ij.Executer.runCommand(Executer.java:131)

I ran the macro with the same images in both FIJI and FIJI life-line version and am getting the same exception error message. Any help would be greatly appreciated.

Thanks!

- Nafis

Reply | Threaded
Open this post in threaded view
|

Re: Java out of memory error in FIJI on 64-bit windows OS

Jean-Philippe Grossier
Hi,

It seems that you don't close your images after processing. In your loop
after saving, try:

while(nImages>0)
{
selectImage(1);
close();
}

cheers,

Jean-Philippe


2014-07-07 22:28 GMT+02:00 nhasan <[hidden email]>:

> hi everyone,
>
> I am running a batch processing macro on ~450 images and each image is ~35
> MB. The macro involves creating a duplicate of the image and then
> converting
> the duplicate into 8-bit and thresholding and then area coverage
> measurement
> and saves both the original and the duplicate image. So I suppose it takes
> around ~70 MB to process one image. The machine I am doing this analysis on
> has 8GB RAM/working memory and has Windows 7 64-bit OS. The issue is that
> when I run my macro, it can only analyze upto 129 images and then gives the
> following error -
>
> (Fiji Is Just) ImageJ 2.0.0-rc-8/1.49c; Java 1.6.0_24 [64-bit]; Windows 7
> 6.1: 6027 MB of 6093 MB (98%)
>
> java.lang.OutOfMemoryError: Java heap space
> at java.util.Arrays.copyOf(Arrays.java:2786)
> at Java.ioByetArrayOutputStream.write(ByteArrayOutputStream.java:94)
> at ij.io.ImageWriter.writeRGBImage(ImageWriter.java:224)
> at ij.io.ImageWriter.write(ImageWriter.java:299)
> at ij.io.TiffEncoder.write(TiffEncoder.java:128)
> at ij.io.FileSaver.serialize(FileSaver.java:224)
> at ij.gui.ImageRoi.getSerializedImage(ImageRoi.java:80)
> at ij.io.RoiEncoder.saveImageRoi(RoiEncoder.java:330)
> at ij.io.RoiEncoder.write(RoiEncoder.java:214)
> at ij.io.RoiEncoder.write(RoiEncoder.java:53)
> at ij.io.RoiEncoder.saveAsByteArray(RoiEncoder.java:68)
> at ij.io.FileSaver.getOverlay(FileSaver.java:155)
> at ij.io.FileSaver.saveAsTiff(FileSaver.java: 108)
> at ij.IJ.saveAsTiff(IJ.java:1746)
> at ij.IJ.saveAs(IJ.java:1670)
> at ij.IJ.saveAs(IJ.java:1659)
> at ij.macro.Functions.saveAs(Functions.java:2868)
> at ij.macro.Functions.doFunction(Functions.java:156)
> at ij.macro.Interpreter.doStatement (Interpreter.java:227)
> at ij.macro.Interpreter.doBlock (Interpreter.java:599)
> at ij.macro.Interpreter.doStatement(Interpreter.java:269)
> at ij.macro.Interpreter.doFor (Interpreter.java:526)
> at ij.macro.Interpreter.doStatement(Interpreter.java:251)
> at ij.macro.Interpreter.doStatements(Interpreter.java:215)
> at ij.macro.Interpreter.run(Interpreter.java:112)
> at ij.macro.Interpreter.run(Interpreter.java:82)
> at ij.macro.Interpreter.run(Interpreter.java:93)
> at ij.plugin.Macro_runner.runMacro(Macro_Runner.java:153)
> at ij.plugin.Macro_runner.runMacroFile(Macro_Runner.java:137)
> at ij.plugin.Macro_runner.run(Macro_Runner.java:34)
> at ij.IJ.runPlugIn(IJ.java:172)
> at ij.Executer.runCommand(Executer.java:131)
>
> I ran the macro with the same images in both FIJI and FIJI life-line
> version
> and am getting the same exception error message. Any help would be greatly
> appreciated.
>
> Thanks!
>
> - Nafis
>
>
>
>
>
> --
> View this message in context:
> http://imagej.1557.x6.nabble.com/Java-out-of-memory-error-in-FIJI-on-64-bit-windows-OS-tp5008608.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Java out of memory error in FIJI on 64-bit windows OS

nhasan
Hi Jean-Philippe,

thanks for the suggestion. Yeah looks like the problem was because the images weren't closing and just took up space on the working memory.

It's working now.

Cheers
Nafis