Image Format Readers as Plugins
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.
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.
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
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.
Useful official documentation regarding plugins:
https://packaging.python.org/en/latest/guides/creating-and-discovering-plugins/
https://github.com/AllenCellModeling/aicsimageio/discussions/372#discussioncomment-3175617
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.