Creating ImageReader without setId. iRODS, S3

Hi
I’m trying to find a way to read a TIFF file stored in iRODS using Jargon library. The library provides all kind of random access classes (jargon-core/src/main/java/org/irods/jargon/core/pub/io/IRODSRandomAccessFile.java and the streams too). However, it seems that the only way to create ImageReader is to setId with a string parameter which is not suitable for my case of course. I ended up digging deep into bio formats source code trying to find the place where that string becomes actual file or stream. I found https://downloads.openmicroscopy.org/bio-formats/5.0.6/api/loci/common/RandomAccessInputStream.html and https://downloads.openmicroscopy.org/bio-formats/5.0.6/api/loci/common/IRandomAccess.html but this looks way too risky to mess with :slight_smile:
I guess people using S3 storage should have the similar problem. Is there any solution? All advices are appreciated.

1 Like

The way S3 is handled is indeed to create a RandomAccessInputStream, the main logic for returning the stream is in Location. S3 in particular then has its own S3 handle (https://github.com/ome/ome-common-java/blob/0cfb62ccf347f5733afc1309121ebac225cb5c6d/src/main/java/loci/common/S3Handle.java)

Im not really familiar with iRODs but this would likely be a similar approach needed, probably a new IRODSHandle and then small changes in the Location class to make use of it.

2 Likes

Thanks for the tip!
I guess I could try to implement IRODSHandle.java. But the changes in Location.java would require forking the entire project. Can I avoid this somehow?

2 Likes

I don’t think there is an easy way to avoid that, though if you created an IRODSHandle I would be happy to help put the necessary changes into Location and integrate the IRODSHandle into the Bio-Formats mainline.

2 Likes

Big :thumbsup: for support for IRODS. It’s something that’s come up a number of times. (e.g. by @olatarkowska)

Eventually, having an extension point for location implementations would be great to have, but for the moment, something like https://github.com/ome/ome-common-java/pull/33 doesn’t seem too onerous.

~J.

1 Like