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.Adapter
class. Type the following syntax as the first line of your class definition file:classdef MyAdapter < images.blocked.Adapter ... end
Define 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
Adapter
methods.Optionally, for single-file destinations, define an
Extension
property 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
Adapter
class. 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 theapply
object function.Adapter Description BINBlocks
Store each block as a binary file in a folder GenericImage
Store blocks in a single image GenericImageBlocks
Store each block as an image file in a folder H5
Store blocks in a single HDF5 image H5Blocks
Store each block as an HDF5 file in a folder InMemory
Store blocks in a variable in main memory JPEG2000
Read blocks of a single JPEG2000 file (since R2023a) JPEGBlocks
Store each block as a JPEG file in a folder LevelConcatenator
Access blocks of concatenated blocked images (since R2023a) MATBlocks
Store each block as a MAT file in a folder PNGBlocks
Store each block as a PNG file in a folder TIFF
Store blocks in a single TIFF file
Version History
Introduced in R2021a