Hi Everyone
We're using ImageJ to open some huge engineering drawings and memory usage is currently a concern. The images are black and white TIFF images and can be 23000 x 12000 pixels. The way ImageJ currently works is that every pixel takes up a byte of memory. For an image of this size ImageJ would need 263MB of RAM to keep the image in memory. In the uncompressed TIFF format the image only takes up about 32MB because each pixel is 1 bit, so you can store 8 pixels in a byte. Would it be practical and possible to store the data as 1 bit per pixel and as it is needed turn it into 1 byte per pixel or does ImageJ rely heavily upon having access to all the pixels as bytes in an array? Some pointers in the right direction would be much appreciated. Thanks, Sarel |
Sarel:
If you can program in java, take the BitVector class from the colt.jar package (a very nice high performance java computation package) and use it in a BitProcessor (that would extend ByteProcessor) to store your pixels, and then adapt the Tiff opener class to load the data from the stream into the BitVector in the BitProcessor. Then, any call to getPixel() and putPixel() can be redirected (by overriding these methods), in the BitProcessor class, to the proper values in the BitVector. I don't have a solution for the getPixels() which returns the byte[], you'd have to make it return null and flag a warning or something. Which means, for saving a file you'll need an special, extended ij.io.TiffEncoder as well. I believe you can use most ImageJ plugins and commands on such a setup because they call the getPixel() and putPixel() methods, not the getPixels() that returns the byte[]. Hope it helped. -- Albert Cardona Molecular Cell Developmental Biology University of California Los Angeles Tel +1 310 2067376 Programming: http://www.pensament.net/java/ Research: http://www.mcdb.ucla.edu/Research/Hartenstein/ Web design: http://www.pixelets.com |
In reply to this post by Sarel Botha
Thank you very much, Albert.
That's what I was looking for. Sarel -----Original Message----- From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Albert Cardona Sent: Tuesday, March 21, 2006 12:27 AM To: [hidden email] Subject: Re: Large black and white images Sarel: If you can program in java, take the BitVector class from the colt.jar package (a very nice high performance java computation package) and use it in a BitProcessor (that would extend ByteProcessor) to store your pixels, and then adapt the Tiff opener class to load the data from the stream into the BitVector in the BitProcessor. Then, any call to getPixel() and putPixel() can be redirected (by overriding these methods), in the BitProcessor class, to the proper values in the BitVector. I don't have a solution for the getPixels() which returns the byte[], you'd have to make it return null and flag a warning or something. Which means, for saving a file you'll need an special, extended ij.io.TiffEncoder as well. I believe you can use most ImageJ plugins and commands on such a setup because they call the getPixel() and putPixel() methods, not the getPixels() that returns the byte[]. Hope it helped. -- Albert Cardona Molecular Cell Developmental Biology University of California Los Angeles Tel +1 310 2067376 Programming: http://www.pensament.net/java/ Research: http://www.mcdb.ucla.edu/Research/Hartenstein/ Web design: http://www.pixelets.com |
Dear list,
I have two questions: 1: although the virtual stack opener is recordable it always opens a dialog box when used in a macro, for example as in run("Virtual Stack Opener", "open="+ redDir + " number="+redfiles+ " starting=1 increment=1 file=.tif"); 2: I would like to open a file list, either from a text file or an array, into a virtual stack. Is this possible using a macro. Cheers, Till -- Dr. Till Bretschneider AG Celldynamics (Gerisch) Max-Planck-Institut fuer Biochemie Am Klopferspitz 18a D-82152 Martinsried, Germany Tel: +49-89-8578-2329 Fax: +49-89-8578-3885 E-mail: [hidden email] WWW: http://www.till-bretschneider.de |
Free forum by Nabble | Edit this page |