IOFormat
IOF_v0.33.0_release
|
If you already use IOLink, you know it allows to handle views from any origin. It also allows to create in-memory views to work efficiently on memory images. And it can be sufficient for mosts of your needs. But, with IOLink, Image data cannot be extracted from current formats (bmp, jpeg, tiff, ...) or proprietary formats. Same thing for exporting.
IOLink is just a set of interfaces with few implementations for general needs. As these interfaces are generic and theorically permit to handle any kind of Images, it's up to you to develop your own reader (we call them Extractor) to handle a specific format, by implementing IOLink interfaces. And thanks to this system of interfaces, any applications based on IOLink will be able to handle your specific format.
But you don't want to implement your own reader for any current formats. One implementation is sufficient, and it is often already done.
IOFormat is here to gather and provide image formats readers and writers.
IOFormat is an aggregator of extractors/writers for any ordinary formats and even for your custom formats.
IOFormat handles extractors and writers as plugins (two different plugins for a extractor/writer couple, most often in the same library) which are dynamically loaded. At start-up, each available plugin (in "ioplugins" folder) is loaded and interrogated to retrieve its list of managed formats and extensions.
An extractor is a implementation of IOLink ImageView or MultiImageView or LodImageView interfaces for a specific set of formats.
This extractor has in charge of decoding data (on the fly or not) from a file or an accessor (a stream or/and through the network) and provides decoded data through interface methods (readRegion(), shape(), dataType(), properties(), metadata(), ...).
IOFormat simply creates an instance of this extractors (for given format and data) and provides it to user.
Developer is free to implement an extractor as it wishes for its particular need (custom format, custom loading method...).
IOFormat handles extractors with a plugin system. Each available extractor in IOFormat is developed as a plugin.
To implement a new extractor, somes rules should be respected to maintain coherency:
A writer is an implementation of IOLink Writer interface for a specific set of formats.
They are used when an ImageView content must be encoded into an output format.
By design, a writer owns the view which is exported, because it can need a full read access to Image content. All formats are not encoded line per line (which would be easier), and thus each implementation can use the best (more efficient) way to build its output data into desired format from view content.
Each writer is instantiated through its own factory, because each format has its own list of parameters (compression, mode, ...).