images.blocked.Adapter Class
Namespace: images.blocked
Description
The images.blocked.Adapter class specifies the interface for block-based
reading and writing of array data. Classes that inherit from this interface can be used with
blockedImage
objects, enabling block-based stream processing of array data.
The images.blocked.Adapter class is a handle class.
Creation
To implement this class, you must:
Inherit from the
images.blocked.Adapterclass. Type the following syntax as the first line of your class definition file:classdef MyAdapter < images.blocked.Adapter ... endDefine three required methods for reading image data from disk:
openToRead,getInfo, andgetIOBlock.Optionally, define methods that enable additional reading and writing capabilities. The table lists the complete set of capabilities offered by
Adaptermethods.Optionally, for single-file destinations, define an
Extensionproperty that specifies the file extension to use when automatically creating a destination location. The property must be a string, such as "jpg". For adapters that store data in a folder, do not add this property or specify the value of the property as empty ([]).
| Capability | Methods to Implement |
|---|---|
| Read data (Required) |
|
| Write data (Optional) |
|
| Perform clean up tasks (Optional) | close –
Perform clean up tasks such as closing file handles |
| Enable parallel block processing (Optional) | openInParallelToAppend – Use the adapter in parallel mode with the
apply
object function |
| Resume writing after interruption (Optional) | alreadyWritten – Enable the resume option in the
apply object function |
Examples
Tips
The toolbox includes several built-in adapters that subclass from the
Adapterclass. Unless otherwise noted, the adapters support both read and write operations. All of the adapters that work on a per-block basis, such asGenericImageBlocks, can be used with the parallel mode of theapplyobject function.Adapter Description BINBlocksStore each block as a binary file in a folder GenericImageStore blocks in a single image GenericImageBlocksStore each block as an image file in a folder H5Store blocks in a single HDF5 image H5BlocksStore each block as an HDF5 file in a folder InMemoryStore blocks in a variable in main memory JPEG2000Read blocks of a single JPEG2000 file (since R2023a) JPEGBlocksStore each block as a JPEG file in a folder LevelConcatenatorAccess blocks of concatenated blocked images (since R2023a) MATBlocksStore each block as a MAT file in a folder PNGBlocksStore each block as a PNG file in a folder TIFFStore blocks in a single TIFF file
Version History
Introduced in R2021a
