Login  Register

Re: Image Browser plugin

Posted by Albert Cardona on Dec 19, 2005; 4:43pm
URL: http://imagej.273.s1.nabble.com/Image-Browser-plugin-tp3704180p3704182.html

Jon & Gabriel,

I run the Image Browser plugin both in a macosx 10.3.9 with 512 MB of
RAM (ImageJ uses -Xmx384m), and in a FreeBSD 5.3 with 1GB RAM (ImageJ
uses -Xmx256m). In both machines I have zero problems in loading a CD
with 700 MB of image sequences (23 sequences, between 14 and 32 images
each).

What the plugin does is to read the name of all files, compile a
String[] for each identified sequence, and then open an image
corresponding to the central image in the sequence (for my data, much
more informative than the first). It does NOT load the 700 Mb of
images, only 23 * 1 MB (images are 1024 x 1024). The whole process
takes 13 seconds in the FreeBSD machine, and about 35 in the mac (the
CD reader is 8x only, versus 32x in the FreeBSD).

Then when any of the images is selected by clicking it, the '>' and '<'
keys are used to navigate the sequence it belongs to as a virtual
stack, with the speed of a virtual stack (one can tell the difference,
but not by much). One can open the whole sequence as a stack by
double-clicking it, and then that is a real stack completely loaded in
RAM.

The plugin is setup so that it uses 70% of ImageJ's maximum memory at
most. When it reaches that limit, it will start to release the first
loaded images. If your ImageJ memory -Xmx setting is too low you may be
experiencing slow loads. Otherwise I don't have an explanation for the
slow loads.

Images are loaded in full scale because that's the most convenient for
me. I thought about setting up a dialog to ask for several options, but
I believe it's not worth it. First, the processor is fake: it's a 4x4
pixels ByteProcessor which has been told to use a much larger width and
height, so the ImageCanvas gets the necessary dimensions. But this are
never the super huge "processor" that it would use otherwise. Second,
if the user shift-double-clicks, all resources are released except the
awt images, which in the above CD take up to 22 Mb only. The zomming
and navigating with the hand tool don't affect at all the memory load.
The rest of the memory is free for other tasks.

Jon: the image browser that you want is perfectly doable and for me
quite straight forward. I use a macro in the CLI plugin for that. If
you want a plugin to do it for you, please email me on the side.

Gabriel: the purpose of the Image Browser plugin is to see all the
contents at a glance and to be able to use/process it right away. This
is why I hard-coded the ability to read directories recursively and to
load the images in full size.

About stacks: since they are an image sequence stored as a single file,
the whole stack has to be loaded to show any given slice. Even using
JAI, which the API kind of suggests it can read any slice directly, the
whole stack is loaded (and much slower by the way). So if the user
shift-double-clicks to release all resources, whenever '>' or '<' are
used again the whole stack is loaded, and then stays in memory. But all
other stacks remain unloaded.

Gabriel: the exception you are getting most likely has to do with a
file not being readable. I did not write in any checks for whether the
Opener succeeded in loading a file. I will put them in. Thanks for
reporting on this.

Albert


--
Albert Cardona
Molecular Cell Developmental Biology
University of California Los Angeles
Tel +1 310 2067376
http://www.pensament.net/java/
http://www.mcdb.ucla.edu/Research/Hartenstein/