bioio icon indicating copy to clipboard operation
bioio copied to clipboard

Add a way to query what plugin was used to read the image

Open TimMonko opened this issue 1 month ago • 2 comments

Feature Description

Add some kind of object on BioImage that allows querying which reader plugin was used to reader a path

Use Case

Sometimes, with multiple feasible plugins (bioio.plugin_feasability_report()) it's not immediately obvious which plugin was used. This came up because I was reorganizing some dependencies in my project and now images are being read by bioio-imageio rather than bioio-tifffile (which, I don't mind). It took a while to debug if this was some change to bioio or, what it turned out to be, was just reading with a different plugin than I expected.

The only way I can find to actually query this is img.reader.__module__ but that is undocumented

Solution

BioImage.reader.name or BioImage.reader_plugin returns the plugin used to initialize the BioImage, it would return something like "bioio-ome-tiff"

TimMonko avatar Nov 25 '25 18:11 TimMonko

I like this idea, that readers should have an easy way to self-identify. does __module__ return the name in a format you expect (e.g. bioio-ome-tiff)? Makes me wonder if such a thing should include version number too.

toloudis avatar Nov 28 '25 18:11 toloudis

Yes, I would prefer the dist package name returned as a string, like "bioio-ome-tiff, or some similar type, if you choose to include version number that's great too (perhaps even quite useful given your rapid development recently!). Would be much easier than me explaining to colleagues how to sort out and read back their environment to me and sleuth that way.

TimMonko avatar Nov 28 '25 23:11 TimMonko

@TimMonko Thank you for opening these tickets

A couple things here.

  1. Plugin Feasibility There was some hidden nuance around the plugin_feasibility_report. The list of extensions is actually a approved list by bioio, the reader itself can support more file types (and often will). At runtime BioImage will only read files with the specific instruction. plugin_feasibility_report is not bound by extension and will try all readers regardless. This shows things like bioio-imageio supporting tiff images. This is intended but not explained.

The use case for this is if you have a file with a strange or new ext. you want to see if any of the readers can parse it. you use the plugin_feasibility_report to assess the file and see that bioio-bioformats can read it! you can then override the extension restriction by passing the the bioio-bioformats reader directly.

I have opened #162 and added a warning around this to clarify this behavior

  1. I wasn't able to replicate a situation where bioio-imageio took priority and read a tiff file when bioio-tifffile was installed. When no plugin is specified BioImage should respect the extension lists. If you can show a repro of this Id be super interested.

  2. I opened https://github.com/bioio-devs/bioio-czi/pull/82 to add support for Reader Names. I didn't add support for version number as this is somewhat harder to ensure correctness for.

  3. Also in #162 is a new param plugin_priority which you may find useful for envs with lots of plugins!

BrianWhitneyAI avatar Dec 03 '25 23:12 BrianWhitneyAI