aicsimageio icon indicating copy to clipboard operation
aicsimageio copied to clipboard

Image Format Readers as Plugins

Open toloudis opened this issue 4 years ago • 5 comments

Use Case

readers for proprietary formats have various licensing requirements which may or may not be compatible with being bundled in aicsimageio. It could possibly enable more community development of image format plugins if they didn't require pull requests to aicsimageio itself.

Solution

Any class conforming to a particular "simple" API can be an aicsimageio Reader. These classes could be authored and distributed as separate independent python packages. We would need to work out how plugins register themselves with (or are discovered by) core aicsimageio. And also how to identify which file formats they can read. One technical consideration is how much shared implementation is in our current base Reader class.

Alternatives

There are many examples of plugin architectures in python (and otherwise) from which we could draw.

toloudis avatar Nov 20 '21 00:11 toloudis

off the cuff example: pip install my_format_reader ... aicsimageio.register_reader(my_format_reader) which internally calls something like my_format_reader.get_supported_formats to add itself to aicsimageio.

toloudis avatar Nov 20 '21 00:11 toloudis

I really like this idea! Here are a few potential options if we wanted to go with an existing plugin system (these were pulled from a talk I remembered from PyCascades 2020^1):

  • Yapsy (Yet Another Plugin System): http://yapsy.sourceforge.net/
  • Plugins project: https://pypi.org/project/Plugins/
  • PluginBase: https://github.com/mitsuhiko/pluginbase
  • stevedore: https://github.com/openstack/stevedore

AetherUnbound avatar Nov 21 '21 00:11 AetherUnbound

I vote we adopt the model of fsspec and use their similar interface for registering "plugins" / extensions

bioimagespec

bioimage-tiff bioimage-czi bioimage-nd2 etc.

evamaxfield avatar Nov 21 '21 01:11 evamaxfield

Useful official documentation regarding plugins:

https://packaging.python.org/en/latest/guides/creating-and-discovering-plugins/

eode avatar Jul 09 '22 19:07 eode

https://github.com/AllenCellModeling/aicsimageio/discussions/372#discussioncomment-3175617

toloudis avatar Jul 20 '22 20:07 toloudis

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Jul 21 '23 01:07 github-actions[bot]