Read and write blocked image data as single image file
GenericImage object is an adapter that reads and writes 2-D
single-resolution blocked image data as a single image file.
When writing to disk, if the blocked image has any additional metadata in the
UserData property, then the
GenericImage object writes
the data to a separate MAT file with the same file name.
By default, the object saves image data as a PNG file. To use a different file format,
create the object and then change the file format using the
property. For example, to write a blocked image as a JPG file, use this code.
adapter = images.blocked.GenericImage; adapter.Extension = "jpg";
When reading from disk, the object reads all image data into memory as a single block. To
access smaller blocks of image data, create a
blockedImage object from the
image file and specify a block size that is smaller than the full size of the image.
The table lists the support that the
GenericImage object has for various
This object supports 2-D images only:
|Multiple resolution levels||No|
|Process blocks in parallel using the ||No|
|Resume block processing using the ||Limited. Only useful when processing an array of |
adapter = images.blocked.GenericImage creates a
GenericImage object that reads and writes blocked image data as a
single image file.
Create a blocked image.
bim = blockedImage("tumor_091R.tif");
Write blocked image data to a PNG file using the
write function. Create a
GenericImage object as the adapter for the
write function to use.
writeAdapter = images.blocked.GenericImage; write(bim,"tumorL3.png","Adapter",writeAdapter,"Levels",3);
Create a blocked image from the PNG file that you just created. The
blockedImage object automatically picks the appropriate adapter for the data.
bgi = blockedImage("tumorL3.png"); disp(bgi.Adapter.Format)
Formatproperty is not recommended
Starting in R2021b, the
Format property is no longer recommended.
Extension property instead. If you specify the
Format property using dot notation, then the value is assigned to the