Hi,
I'm writing a converter to a very simple custom byte stream file format.
I quite like the abstraction of the ImageReader, i.e. the IFormatReader, nevertheless I find there is somewhat funky behavior when it comes to formats/files that entail multiple files eventually.
I noticed the first time when I was contemplating tossing a zip at the readers setId() and of course it read it and that was all well and good and it has -from my understanding/debugging- an embedded image reader in it, namely of the first supported format. Now, here is where I'm getting puzzled and perhaps I'm just missing a detail. The encapsulation of the class does not let me have a go at the reader private member so I can only go via openBytes but that method does not give me meta-info regarding important image info of the file.
Furthermore, while the reader has a getUsedFiles and similiar methods, the files are stuffed into a Location class which -and I did not double check that- it occurred to me could contain the files of another zip potentially. So, again, I was prevented by encapsulation, when running through the Location files map to verify which originating zip they came from to ensure that I would not use a wrong one.
Either way, I abandoned the zip reader in favor of manually looping over the zip entries and instantiating the readers once extracted. But soon I hit a similiar issue:
I have a series of OME Tiffs incl an OME XML. The question I had from just looking at the Reader was: which to use to attack the entire series? I tried, both, the XML as well as the first tiff in the series. They both populated the image meta data nicely but once again when reading I was facing the dilemma of a getBytes that in the case of the xml returned a buffer that was obviously corresponding correctly in length with X x Y x bit depth but I was hoping in vain for it to be anything but initialized (automatically by java). So perhaps my bad and I should have not expected the actual image data from tossing the XML at the Reader but it is a tiny bit misleading to get back an array that hints (in size) at being the first image but isn't. Then trying the first OME Tiff I had a slightly more promising result: It did give me the image data but, only for that first file, which is once again perhaps a misconception of mine given that it does not -per se- know of the other files in the series, I presume, the XML file would have, however, yet it did not do it either.
So, in summation, do I expect too much of the reader, given the interface? Is it really only reading the one file given to it, even if that file may contain xml that is definitely parsed (I saw that much in the code) and does contain the file locations of all files that are part of the series.
If so I'd like to know whether I have to extract the file locations from the xml "manually" (as I had to in the case of a zip) which is not a problem at all? Also, I could not find the the file locations with getUsedFiles() or any other similarly named function which would have suggested itself given the interface.
Thanks in advance for any clarification provided,
Harald