Read and write blocks of blocked image data as H5 files
H5Blocks object is an adapter that reads and writes blocked
image data as chunked H5 files, with one H5 file for each block.
When writing to disk, the object creates an individual H5 file for each block and saves the image files in a folder. For multiresolution images, the object creates one subfolder for each resolution level. The object also creates and saves a MAT file with information about the blocked image, including the image size, block size, and data type.
The object supports lossless compression. By default, the compression level is set to
1. To use a different compression level, create the object and then
change the compression level using the
GZIPLevel property. You can also
use this property to turn off compression. For example, to use a compression level of
3, use this code.
adapter = images.blocked.H5Blocks; adapter.GZIPLevel = 3;
The table lists the support that the
H5Blocks object has for various
adapter = images.blocked.H5Blocked creates a
H5Blocks object that reads and writes blocked image data as chunked H5
files, with one file for each block.
GZIPLevel — GZIP compression level
1 (default) | number in the range [0, 9]
GZIP compression level, specified as a number in the range [0, 9]. This value controls the level of GZIP (lossless) compression. 0 turns off compression. Higher values attempt to increase the level of compression and reduce the file size at the cost of higher runtimes.
Save Image Data in Folder with One HDF5 File Per Block
Create a blocked image.
bim = blockedImage('tumor_091R.tif');
Write image data to files. Specify the
wa = images.blocked.H5Blocks(); wa.GZIPLevel = 5; write(bim, "H5sFolder", "Adapter", wa);
Create a blocked image from the folder of images. The
blockedImage object automatically picks the appropriate adapter.
bh5 = blockedImage("H5sFolder");
Introduced in R2021a