Re: Array question?

Posted by Sasmita Rath on
URL: http://imagej.273.s1.nabble.com/Array-question-tp3695862p3695864.html

Dear Wayne,
So I did as follows.
ImageJ>Plugins>New>

I creat a new plugin and run it. My pugin program is as follows:


a=newArray (24832000);
z=0;
for(k=0;k<388;k++) {

run("Text Image... ", "open=[C:\\Documents and Settings\\Desktop\\20080423-152704--58C-255x-985ms\\" +1000+k + ".dat]");
for(i=0;i<512;i++) //width
                {for(j=0; j<125; j++)

                                                                        //height
                                {
      y=getPixel(i,j);
                                a[z]=y;
                                print(a[z]);
                                z=z+1; }
                                        }
close();
}

But I get the  error message.saying java out of space ..............
Please help.
Sasmita

----- Original Message -----
From: "Wayne Rasband" <[hidden email]>
To: [hidden email]
Sent: Tuesday, June 17, 2008 4:30:05 PM GMT -06:00 US/Canada Central
Subject: Re: Array question?

> Dear ImageJ group,
> Is there a maximum limit for an array in imageJ macro?I want to save
> 24832000 many pixel values (i.e.my array length is 24832000 ) in an
> array.When I do that I get an error message saying
> "java.lang.OutOfMemoryError: Java heap space ".

You don't want to create a 24,832,000 element array in the ImageJ macro
language. Each element requires 36 bytes, so a 24,832,000 element array
would require 852MB! In a plugin, a 24,832,000 element byte array would
require only 24MB. Plus you would be able to access the elements at
least 100 times faster.

-wayne