Main Content

images.blocked.JPEGBlocks class

Package: images.blocked

Store each block as JPEG file in folder

Description

The images.blocked.JPEGBlocks class is an adapter for use with blocked images. Use this adapter to save an image in a folder with individual JPEG files for each block. The JPEG format offers lossy compression and usually results in the smallest on-disk size. The adapter stores the images in a folder which also contains a MAT-file with information about the image (including image size, blocksize, type). This folder has one subfolder per resolution level (L1, L2..LN). These subfolders contain JPEG format files for each block.

CapabilitiesSupport
Data Types

M-by-N: logical or uint8; M-by-N-by-3: uint8

Multiresolution levelsYes
Use parallel processingYes
Resume processingYes

The images.blocked.JPEGBlocks class is a handle class.

Class Attributes

HandleCompatible
true

For information on class attributes, see Class Attributes.

Creation

Description

example

adapter = images.blocked.JPEGBlocks() creates an images.blocked.JPEGBlocks instance for use with a blockedImage object.

Properties

expand all

Quality of written image, specified as a numeric scalar between 0 and 100. Higher numbers specify better quality (less image degradation due to compression), but the resulting file size is larger.

JPEG compression mode, specified as the string scalar or char vector "Lossy" or "Lossless". If you specify "LossLess", the adapter ignores the JPEGQuality property.

Data Types: string | char

Examples

collapse all

Create a blocked image.

bim = blockedImage('tumor_091R.tif');

Write image data to files. Specify the images.blocked.JPEGBlocks adapter. Choose to write in highest quality. JPG uses lossy compression, so space required is still significantly lower than other formats.

wa = images.blocked.JPEGBlocks();
wa.JPEGQuality = 100;
write(bim, "folderOfJPGs", "Adapter", wa);

Create a blocked image from the folder of images. The blockedImage object automatically picks the appropriate adapter.

bjpeg = blockedImage("folderOfJPGs");
disp(bjpeg.Adapter)
  JPEGBlocks with properties:

        JPEGQuality: 100
    CompressionMode: "Lossy"
        BlockFormat: "jpeg"
Introduced in R2021a