Login  Register

Re: a tutorial on a custom image format file reader / writer

Posted by Francis Burton on Apr 17, 2008; 9:17am
URL: http://imagej.273.s1.nabble.com/a-tutorial-on-a-custom-image-format-file-reader-writer-tp3696492p3696505.html

Hi Curtis,

I'm not sure if it is appropriate to continue this exchange on the mailing
list. If not, we can continue in private. Still, this discussion may be of
interest to someone - who knows.

At 16:24 16/04/08 -0500, Curtis Rueden <[hidden email]> wrote:

>Output from showinf looks good. Note that you can suppress reading of the
>pixels by using:
>
>showinf 07.lsm -nopix
>
>Or you can limit to a smaller subset of image planes with:
>
>showinf 07.lsm -range 0 2
>
>The latter is a good way to quickly test that the pixels are being read
>properly, without waiting for 20000 image planes to load. :-)

Ah, this might indicate where part of the problem lies. I am not expecting
to see 20000 image planes in the LSM file. Rather, it contains two 'images'
each comprising 20000 line scans. So the long (20000 pixels) axis represents
time, and the short axis (512 pixels) is space; pixel values are fluorescence
intensities. In practice, this 2d array is treated as a normal image for
display purposes (Syla's recent post "Color profile for calcium waves" has a
link to such an image), though for analysis the axes are of course handled
rather differently.

>Therein lies the rub. It's a bug in ZeissLSMReader. Hopefully the latest
>code will fix it -- if not, let me know and I'll send you our FTP server
>information off-list. If you are willing to send me a nonworking file, we'll
>get it fixed for you.

You are welcome to have a sample file if you don't mind downloading >30Mb!

>From what you said, I'm confident that the bfconvert tool will help simplify
>your TIFF conversion process once we iron out the
>ArrayIndexOutOfBoundsException bug. Alternately, you could use a Java-Delphi
>bridge to call the Bio-Formats import routine directly from your Delphi
>program. Then you could ask for the data plane by plane, ask about
>associated metadata, etc., all from within your Delphi app. Here are some
>resources for doing that:
>
>1) Article on using JNI for communication between Delphi & Java:
>http://www.pacifier.com/~mmead/jni/delphi/informant/di200309kw.htm
>
>2) Delphi-Java Bridge library on SourceForge:
>http://sourceforge.net/projects/djbridge/
>
>3) JVMLink library that we developed for communication between Java and
>native languages via TCP/IP sockets:
>http://www.loci.wisc.edu/ome/jvmlink.html

Thanks for the pointers! This sounds like an efficient (in terms of run time)
solution. I just need to come up to speed with the new technology.

>Or you could just make system calls to showinf from Delphi to extract
>metadata parameters from the LSMs and dump the results to text files, which
>your program could parse. There are lots of ways to do what you want. Just
>let me know if you have any questions, and I'll try to help.

My idea of a simple-to-implement solution was to spawn (ShellExecute in Delphi)
"bfconvert" to read the LSM file and dump out the two TIFF images (one for each
wavelength), and then read the two TIFF files as I am doing now, using existing
code. Creating two new large files will be slower than unpacking the images in
memory, but faster than my colleagues can manually extract the images using the
Zeiss Browser!

Francis

--
Dr Francis L Burton,          |  [hidden email]
West Medical Building,        |
University of Glasgow,        |  Tel +44-141-330-6598
Glasgow, G12 8QQ, Scotland.   |  Fax +44-141-330-4612