主要内容

封锁的绘制

Datastore for use with blocks from阻塞objects

    描述

    A封锁的绘制object manages a collection of image blocks that belong to one or more阻塞objects. A封锁的绘制is analogous to an成像, which manages a collection of unrelated images.

    创建

    描述

    example

    bimds = blockedImageDatastore(Images)创建一个封锁的绘制object that manages a collection of image blocks of one or more阻塞objects,Images

    IfImagescontains an object with multiple resolution levels, then封锁的绘制从最优质的分辨率级别选择块。这BlockSize第一个元素的属性Images是默认数据存储块大小。

    bimds = blockedImageDatastore(sources)从指定的文件中创建数据存储sources

    bimds = blockedImageDatastore(___,Name,Value)还使用名称-值参数设置一个或多个properties, except forImagesandTotalNumBlocks

    Input Arguments

    展开全部

    Name of the blocked image files, specified as a cell array of character vectors, a string scalar, or aFileSet目的。这封锁的绘制object converts the images in the files into blocked images and sets those images as theImagesproperty.

    特性

    展开全部

    在数据存储中包含的块,指定为blockLocationSet目的。该对象指定哪些封锁从封锁图像中包含bims。您可以重复或省略单个块。要获得默认值,封锁的绘制calls theselectBlockLocationsfunction.

    You cannot change the区块划分集创建属性封锁的绘制

    块大小,指定为1乘Dnumeric vector, whereD是第一个阻止图像的尺寸的数量Images,在第一个分辨率级别水平

    You cannot change theBlockSize创建属性封锁的绘制

    附加边框元素的大小in each dimension, specified as a 1-by-Dnumeric vector, whereD是第一个阻止图像的尺寸的数量Images,在第一个分辨率级别水平。这default value iszeros(1,D)

    封锁图像,以供应块封锁的绘制,指定为阻塞objects. All elements ofImagesmust have the same number of dimensions and be of the same type.

    You cannot change theImages创建属性封锁的绘制

    用于填充不完整块的方法,指定为该表中的值之一。默认情况下,数据存储板数字块,具有InitialValueproperty of the first blocked image in the array of blocked images,Images

    Value

    意义

    数字标量

    带有指定标量值的PAD不完整块。值的类型取决于ClassUnderlying封锁图像Images

    'replicate'

    Pad by repeating border elements of array.

    边缘上存在的垫部分块,指定为逻辑标量trueorfalse。Whentrue,被阻止的图像数据存储根据指定的填充方法添加填充PadMethodproperty.

    Number of blocks to return in each call to theread函数,指定为正整数。每个电话read功能最多读取读取尺寸blocks

    此属性仅阅读。

    可用的块总数,指定为数字标量。

    Object Functions

    combine Combine data from multiple datastores
    countEachLabel 计算每个类的像素标签的数量
    hasdata Returnstrueif more data is available in封锁的绘制
    数字 数据存储分区的数量
    分割 返回分区的部分封锁的绘制
    预习 Preview subset of data in datastore
    read Read data and metadata from封锁的绘制
    readall 阅读所有数据封锁的绘制
    重置 将数据存储重置为初始状态
    shuffle Shuffle data in datastore
    subset Create subset of datastore or file-set
    transform Transform datastore

    例子

    collapse all

    Create a blockedImage.

    bim = blockedImage('tumor_091R.tif');

    创建一个数据存储,指定分辨率级别和块。

    bls = selectBlockLocations(bim,"Levels",2,"BlockSize",[512, 512]); bimds = blockedImageDatastore(bim,"BlockLocationSet", bls);

    Read all the blocks in the datastore.

    b = readall(bimds)
    b=9×1单元格数组{512×512×3 Uint8} {512×512×3 Uint8} {512×512×3 Uint8} {512×512×512×3 Uint8} {512×3 uint8} {512×3 Uint8}×512×3 UINT8} {512×512×3 UINT8} {512×512×3 UINT8}

    Display the blocked image

    蒙太奇(b)

    Create aFileSet包含PNG文件格式的多个图像文件的对象。

    fs = matlab.io.datastore.fileset(...Fullfile(Matlabroot,"toolbox",“图片”,“ imdata”),..."FileExtensions",".png");

    Create a阻塞object, specifying an adapter. This saves time by skipping the need to inspect each file to pick a suitable adapter.

    readAdapter = images.blocked.GenericImage; bims = blockedImage(fs,“适配器”,readAdapter);

    All images must have the same number of dimensions, so only retain RGB images.

    bims = bims([bims.NumDimensions]==3); bimds = blockedImageDatastore(bims,"BlockSize",[300 500],...“ padMethod”,“复制”);

    Display all of the blocks in the封锁的绘制

    蒙太奇(readall(bimds),"Border",2,“背景颜色”,“ W”);

    Figure contains an axes object. The axes object contains an object of type image.

    Create a阻塞

    bim = blockedImage('tumor_091R.tif');

    Specify overlapping blocks.

    blockSize = [512 512]; overlapPct = 0.5; blockOffsets = round(blockSize.*overlapPct); bls = selectBlockLocations(bim,...“阻止”,封锁,...“阻止分子”, blockOffsets,...'ExcludeIncompleteBlocks', 真的);

    创建封锁的绘制

    bimds = blockedimagedatastore(bim,"BlockLocationSet", bls);

    显示重叠的块。

    bimds.ReadSize = 6;blocks = read(bimds);蒙太奇(块,"BorderSize",5,“背景颜色”,'b');

    Figure contains an axes object. The axes object contains an object of type image.

    Create a blockedImage.

    bim = blockedImage('tumor_091R.tif');

    在最佳级别上创建一个口罩。

    bmask = apply(bim, @(bs)〜imbinarize(im2gray(bs.data)),"Level",3);

    Create a封锁的绘制对于在染色区域中至少具有90%像素为“ ON”的块。

    mbls = selectBlockLocations(bim,...'Levels',1,...'Masks',bmask,“包含思想”, 0.90,...“阻止”,[256 256]);bimds = blockedimagedatastore(bim,'BlockLocationSet', mbls);

    读取块并显示它们。

    bimds.ReadSize = 5; blocks = read(bimds); montage(blocks,"BorderSize",5,“背景颜色”,'b')

    Figure contains an axes object. The axes object contains an object of type image.

    Create blocked images from numeric and labeled data.

    bim = blockedImage('yellowlily.jpg',“阻止”,[512 512]);lbim = blockedImage('Yellowlily-ragended.png',“阻止”,[512 512]);

    Create封锁的绘制objects for each blocked image.

    bimds = blockedimagedatastore(bim);lbimds = blockedimagedatastore(lbim);

    将标记的数字数据转换为分类数据。

    catbimds = transform(lbimds,...@(bs){分类(bs {1},[0,1,2,3],["Unknown",“花”,“叶子”,"Background"))});

    Combine the original封锁的绘制使用分类数据存储。

    cbimds = combine(bimds,catbimds);

    Read data from the datastore and display it. The first cell is image data, second is categorical labels.

    data = read(cbimds);imshow(labeloverlay(data {1},data {2}));

    Figure contains an axes object. The axes object contains an object of type image.

    Version History

    Introduced in R2021a