I've created an Image Browser plugin that, when given a folder, finds
all images, stacks and image sequences and places them in a single window, as sort of virtual stacks. It handles memory automatically so it can *never* run out of memory. It can create stacks on the fly out of image sequences, even if composed of images of different dimensions. I use it to instantly browse 700MB of several image sequences in CDs. See all details here: http://www.pensament.net/java/other_plugins.html#image_browser 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/ |
Hi,
I gave it a try, but even a small (for me) directory of images takes too long to load. System (win 2000 with 512M memory) grinds to a halt, probably because of memory disk swapping. I've wanted an imagej image browser for a while, with simple functionality like irfanview where next and previous buttons send you to the next or previous image in the current directory. Jon Albert Cardona wrote: > I've created an Image Browser plugin that, when given a folder, finds > all images, stacks and image sequences and places them in a single > window, as sort of virtual stacks. It handles memory automatically so > it can *never* run out of memory. It can create stacks on the fly out > of image sequences, even if composed of images of different > dimensions. I use it to instantly browse 700MB of several image > sequences in CDs. See all details here: > > http://www.pensament.net/java/other_plugins.html#image_browser > > 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/ > |
On Sunday 18 December 2005 21:31, Jon Harman wrote:
> I gave it a try, but even a small (for me) directory of images takes too > long to load. System (win 2000 with 512M memory) grinds to a halt, > probably because of memory disk swapping. I really like the browser idea, although I also found very slow loads in linux. I wonder if adding some options would reduce the slow load, for example: option to avoid doing recursive search of directories, option to load only the first slice of a stack, option to create a smaller thumbnail rather than the full size collage. In one computer it gave me this error when compiled for the first time: java.lang.NullPointerException at Image_Browser$IBImage.<init>(Image_Browser.java:748) at Image_Browser$IBImage.<init>(Image_Browser.java:740) at Image_Browser.extractIBImage(Image_Browser.java:275) at Image_Browser.browse(Image_Browser.java:152) at Image_Browser.browse(Image_Browser.java:160) at Image_Browser.browse(Image_Browser.java:160) at Image_Browser.browse(Image_Browser.java:160) at Image_Browser.browse(Image_Browser.java:160) at Image_Browser.browse(Image_Browser.java:160) at Image_Browser.run(Image_Browser.java:74) at ij.IJ.runUserPlugIn(IJ.java:271) at ij.ImageJ.runUserPlugIn(ImageJ.java:216) at ij.plugin.PlugInExecuter.run(Compiler.java:188) at java.lang.Thread.run(Thread.java:595) and the second time it run but then froze IJ after loading 22 images. (There was a huge frame with 22 images in it, but otherwise empty). The system monitor showed near 100% CPU load and near 100% cached memory use. (I had to kill the java process to end IJ). I eventually run successfully on a directory with 5 or 6 images, but it was very slow. Not sure what the problem really is. Albert Cardona wrote: > I use it to instantly browse 700MB of several image > sequences in CDs. But isn't the plugin loading the whole 700MB of images? Can one really browse "instantly" the whole contents? What amount of memory do you assign to IJ? Cheers, Gabriel |
Seems to work fine on OSX.
I might take some of the code and try to implement some kind of preview function in my ImageViewer plugin. kurt On 18 Dec 2005, at 23:00, Gabriel Landini wrote: > On Sunday 18 December 2005 21:31, Jon Harman wrote: >> I gave it a try, but even a small (for me) directory of images >> takes too >> long to load. System (win 2000 with 512M memory) grinds to a halt, >> probably because of memory disk swapping. > > I really like the browser idea, although I also found very slow > loads in > linux. > > I wonder if adding some options would reduce the slow load, for > example: > option to avoid doing recursive search of directories, > option to load only the first slice of a stack, > option to create a smaller thumbnail rather than the full size > collage. > > In one computer it gave me this error when compiled for the first > time: > > java.lang.NullPointerException > at Image_Browser$IBImage.<init>(Image_Browser.java:748) > at Image_Browser$IBImage.<init>(Image_Browser.java:740) > at Image_Browser.extractIBImage(Image_Browser.java:275) > at Image_Browser.browse(Image_Browser.java:152) > at Image_Browser.browse(Image_Browser.java:160) > at Image_Browser.browse(Image_Browser.java:160) > at Image_Browser.browse(Image_Browser.java:160) > at Image_Browser.browse(Image_Browser.java:160) > at Image_Browser.browse(Image_Browser.java:160) > at Image_Browser.run(Image_Browser.java:74) > at ij.IJ.runUserPlugIn(IJ.java:271) > at ij.ImageJ.runUserPlugIn(ImageJ.java:216) > at ij.plugin.PlugInExecuter.run(Compiler.java:188) > at java.lang.Thread.run(Thread.java:595) > > and the second time it run but then froze IJ after loading 22 images. > (There was a huge frame with 22 images in it, but otherwise empty). > The system monitor showed near 100% CPU load and near 100% cached > memory use. > (I had to kill the java process to end IJ). > > I eventually run successfully on a directory with 5 or 6 images, > but it was > very slow. Not sure what the problem really is. > > Albert Cardona wrote: >> I use it to instantly browse 700MB of several image >> sequences in CDs. > > But isn't the plugin loading the whole 700MB of images? Can one > really browse > "instantly" the whole contents? > What amount of memory do you assign to IJ? > > Cheers, > > Gabriel *--*--*--*--*--*--*--*--*--*--*--*--*--* University of Sheffield Academic Neurology Unit Division of Genomic Medicine E Floor, Medical School Beech Hill Road Sheffield S10 2RX United Kingdom Tel: ++44 (0) 114 271 2473 Fax: ++44 (0) 114 226 1201 Email: [hidden email] *--*--*--*--*--*--*--*--*--*--*--*--*--* |
In reply to this post by Albert Cardona
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/ |
Albert,
Thanks for the extensive explanation. Lots of tricks, eh! :-) On Monday 19 December 2005 16:43, Albert Cardona wrote: > 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. Sure, I understand, it was just a suggestion that may improve use. Sometimes one may not want to do recursive search. When I browse the IJ directory it also browses the JDK one :-/ Sure, it would be more sensible to put the JDK somewhere else. > Gabriel: the exception you are getting most likely has to do with a > file not being readable. I will have a look if I have a non-readable image, I will try giving more memory to the JVM and see if I get any improvements. Cheers, Gabriel |
In reply to this post by Albert Cardona
Gabriel et al,
I've updated the Image Browser plugin: - introduced failsafe loading, so images which cannot be loaded will not disrupt anything (will be show as a black canvas, even if within a sequence) (thanks to Gabriel Landini for reporting on this). - Added futher memory control when creating awt.Image objects, since it was not checked that there was enough memory before creating them (only when loading the files to an ImagePlus object). Yes out of memory errors where possible because of the double memory representation of any image (the ImageProcessor and the awt.Image), but hopefully not anymore. - Increased the minimum amount of memory to be free before loading an image file or creating an awt.Image to 40%, to ensure proper opening of large files under low memory conditions. Users may want to fine tune this value for their specific needs. - Clicking a panel now makes it be unloaded last in the cache, so most recently browsed are kept for a longer time. - Added alt+double-click to open a single slice in a stack or sequence. Albert |
Free forum by Nabble | Edit this page |