imagej matlab garbage collection

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

imagej matlab garbage collection

Vincent Bonin
Hi,

I am using the ImageJ API (1.38) to process large tiff stacks from
MATLAB (2007b)
and am looking for a way to free up the java memory heap once this
processing is done.

Specifically, I load the stack using the following code:
> td=ij.io.TiffDecoder([directory '\'],[name ext]);
> tfi=td.getTiffInfo();
> op=ij.io.Opener();
> imp=op.openTiffStack(tfi);
and would like to free storage taken up by 'imp' and the associated
ImageStack.

I have tried clearing up references to the ImagePlus, to the ImageStack,
calling
ImagePlus.killStack(), ImagePlus.close(), setting the ImagePlus stack to
a dummy one.

None of this has freed the allocated space from the java memory heap
(except for quitting MATLAB).

Has anyone encountered this before?

Many thanks,

Vincent

--
Vincent Bonin, PhD
Department of Neurobiology
Harvard Medical School
220 Longwood Avenue
Goldenson Building, Room 243
Boston, MA 02115
Tel: (617) 432-1326
fax: (617) 734-7557
Reply | Threaded
Open this post in threaded view
|

sound in imageJ

Jeff Spector
Hi all,
 Is there a way to make imageJ play a sound of a given frequency for a
given time ? Basically I'd like to change the frequency(pitch) of the
.beep method, the end goal being to translate pixel intensities to
audible sound. Any suggestions ?
thanks,
 -Jeff
Reply | Threaded
Open this post in threaded view
|

Re: sound in imageJ

Gabriel Landini
On Friday 18 January 2008 07:16:41 Jeff Spector wrote:
> Hi all,
>  Is there a way to make imageJ play a sound of a given frequency for a
> given time ? Basically I'd like to change the frequency(pitch) of the
> .beep method, the end goal being to translate pixel intensities to
> audible sound. Any suggestions ?

I haven't tried it interfacing it with IJ, but I tried a few demos and it
works nicely:

http://jmusic.ci.qut.edu.au/

Please post any follow ups.

Cheers,

Gabriel
Reply | Threaded
Open this post in threaded view
|

Re: imagej matlab garbage collection

dscho
In reply to this post by Vincent Bonin
Hi,

On Fri, 18 Jan 2008, Vincent Bonin wrote:

> I am using the ImageJ API (1.38) to process large tiff stacks from
> MATLAB (2007b) and am looking for a way to free up the java memory heap
> once this processing is done.
>
> [...]
>
> I have tried clearing up references to the ImagePlus, to the ImageStack,
> calling ImagePlus.killStack(), ImagePlus.close(), setting the ImagePlus
> stack to a dummy one.

That's half of it.  Now you need to call the garbage collector,
System.gc().  With some JREs you need to call it twice to have an
immediate effect.

Hth,
Dscho
Reply | Threaded
Open this post in threaded view
|

Re: imagej matlab garbage collection

Albert Cardona
In reply to this post by Vincent Bonin
Hi Vincent,

If you are sure there are no more references to opened tifs, then don't
worry that the JVM is not "freeing" it. When needed, such heap memory
regions will be used. That is what automtic garbage collection means: do
not spend time freeing memory when there is no need to do so.

You should only worry if you get an OutOfMemoryException.

Have a look at:

http://imagejdocu.tudor.lu/imagej-documentation-wiki/how-to/imagej-performance-tuning



If you really, really want to "free" memory, then make a loop and call
System.gc() repeatedly like 10 times until it catches. But it will do a
lot more harm than good.


Albert

--
Albert Cardona
http://www.mcdb.ucla.edu/Research/Hartenstein/acardona