Main Content

read

Read data and metadata from blocked image datastore

Since R2021a

    Description

    example

    b = read(bimds) returns the data extracted from the blocked image datastore bimds. b is a cell array of block data. The value of the ReadSize property of the blocked image datastore determines the length of the cell array.

    [b,info] = read(bimds) also returns info, a structure containing information about where the data was extracted from the blocked image datastore.

    Examples

    collapse all

    Create a blocked image.

    bim = blockedImage('tumor_091R.tif');

    Create a blockedImageDatastore from the blocked image.

    bimds = blockedImageDatastore(bim);

    Read data and metadata from the blockedImageDatastore. Display the metadata.

    while hasdata(bimds)
          [data, info] = read(bimds);
          disp(info);
    end
           BlockSub: [1 1 1]
              Start: [1 1 1]
                End: [1024 1024 3]
              Level: 1
        ImageNumber: 1
         BorderSize: [0 0 0]
          BlockSize: [1024 1024 3]
    
           BlockSub: [1 2 1]
              Start: [1 1025 1]
                End: [1024 2048 3]
              Level: 1
        ImageNumber: 1
         BorderSize: [0 0 0]
          BlockSize: [1024 1024 3]
    
           BlockSub: [1 3 1]
              Start: [1 2049 1]
                End: [1024 3072 3]
              Level: 1
        ImageNumber: 1
         BorderSize: [0 0 0]
          BlockSize: [1024 1024 3]
    
           BlockSub: [1 4 1]
              Start: [1 3073 1]
                End: [1024 4096 3]
              Level: 1
        ImageNumber: 1
         BorderSize: [0 0 0]
          BlockSize: [1024 1024 3]
    
           BlockSub: [1 5 1]
              Start: [1 4097 1]
                End: [1024 5120 3]
              Level: 1
        ImageNumber: 1
         BorderSize: [0 0 0]
          BlockSize: [1024 1024 3]
    
           BlockSub: [1 6 1]
              Start: [1 5121 1]
                End: [1024 6144 3]
              Level: 1
        ImageNumber: 1
         BorderSize: [0 0 0]
          BlockSize: [1024 1024 3]
    
           BlockSub: [2 1 1]
              Start: [1025 1 1]
                End: [2048 1024 3]
              Level: 1
        ImageNumber: 1
         BorderSize: [0 0 0]
          BlockSize: [1024 1024 3]
    
           BlockSub: [2 2 1]
              Start: [1025 1025 1]
                End: [2048 2048 3]
              Level: 1
        ImageNumber: 1
         BorderSize: [0 0 0]
          BlockSize: [1024 1024 3]
    
           BlockSub: [2 3 1]
              Start: [1025 2049 1]
                End: [2048 3072 3]
              Level: 1
        ImageNumber: 1
         BorderSize: [0 0 0]
          BlockSize: [1024 1024 3]
    
           BlockSub: [2 4 1]
              Start: [1025 3073 1]
                End: [2048 4096 3]
              Level: 1
        ImageNumber: 1
         BorderSize: [0 0 0]
          BlockSize: [1024 1024 3]
    
           BlockSub: [2 5 1]
              Start: [1025 4097 1]
                End: [2048 5120 3]
              Level: 1
        ImageNumber: 1
         BorderSize: [0 0 0]
          BlockSize: [1024 1024 3]
    
           BlockSub: [2 6 1]
              Start: [1025 5121 1]
                End: [2048 6144 3]
              Level: 1
        ImageNumber: 1
         BorderSize: [0 0 0]
          BlockSize: [1024 1024 3]
    
           BlockSub: [3 1 1]
              Start: [2049 1 1]
                End: [3072 1024 3]
              Level: 1
        ImageNumber: 1
         BorderSize: [0 0 0]
          BlockSize: [1024 1024 3]
    
           BlockSub: [3 2 1]
              Start: [2049 1025 1]
                End: [3072 2048 3]
              Level: 1
        ImageNumber: 1
         BorderSize: [0 0 0]
          BlockSize: [1024 1024 3]
    
           BlockSub: [3 3 1]
              Start: [2049 2049 1]
                End: [3072 3072 3]
              Level: 1
        ImageNumber: 1
         BorderSize: [0 0 0]
          BlockSize: [1024 1024 3]
    
           BlockSub: [3 4 1]
              Start: [2049 3073 1]
                End: [3072 4096 3]
              Level: 1
        ImageNumber: 1
         BorderSize: [0 0 0]
          BlockSize: [1024 1024 3]
    
           BlockSub: [3 5 1]
              Start: [2049 4097 1]
                End: [3072 5120 3]
              Level: 1
        ImageNumber: 1
         BorderSize: [0 0 0]
          BlockSize: [1024 1024 3]
    
           BlockSub: [3 6 1]
              Start: [2049 5121 1]
                End: [3072 6144 3]
              Level: 1
        ImageNumber: 1
         BorderSize: [0 0 0]
          BlockSize: [1024 1024 3]
    
           BlockSub: [4 1 1]
              Start: [3073 1 1]
                End: [4096 1024 3]
              Level: 1
        ImageNumber: 1
         BorderSize: [0 0 0]
          BlockSize: [1024 1024 3]
    
           BlockSub: [4 2 1]
              Start: [3073 1025 1]
                End: [4096 2048 3]
              Level: 1
        ImageNumber: 1
         BorderSize: [0 0 0]
          BlockSize: [1024 1024 3]
    
           BlockSub: [4 3 1]
              Start: [3073 2049 1]
                End: [4096 3072 3]
              Level: 1
        ImageNumber: 1
         BorderSize: [0 0 0]
          BlockSize: [1024 1024 3]
    
           BlockSub: [4 4 1]
              Start: [3073 3073 1]
                End: [4096 4096 3]
              Level: 1
        ImageNumber: 1
         BorderSize: [0 0 0]
          BlockSize: [1024 1024 3]
    
           BlockSub: [4 5 1]
              Start: [3073 4097 1]
                End: [4096 5120 3]
              Level: 1
        ImageNumber: 1
         BorderSize: [0 0 0]
          BlockSize: [1024 1024 3]
    
           BlockSub: [4 6 1]
              Start: [3073 5121 1]
                End: [4096 6144 3]
              Level: 1
        ImageNumber: 1
         BorderSize: [0 0 0]
          BlockSize: [1024 1024 3]
    
           BlockSub: [5 1 1]
              Start: [4097 1 1]
                End: [5120 1024 3]
              Level: 1
        ImageNumber: 1
         BorderSize: [0 0 0]
          BlockSize: [1024 1024 3]
    
           BlockSub: [5 2 1]
              Start: [4097 1025 1]
                End: [5120 2048 3]
              Level: 1
        ImageNumber: 1
         BorderSize: [0 0 0]
          BlockSize: [1024 1024 3]
    
           BlockSub: [5 3 1]
              Start: [4097 2049 1]
                End: [5120 3072 3]
              Level: 1
        ImageNumber: 1
         BorderSize: [0 0 0]
          BlockSize: [1024 1024 3]
    
           BlockSub: [5 4 1]
              Start: [4097 3073 1]
                End: [5120 4096 3]
              Level: 1
        ImageNumber: 1
         BorderSize: [0 0 0]
          BlockSize: [1024 1024 3]
    
           BlockSub: [5 5 1]
              Start: [4097 4097 1]
                End: [5120 5120 3]
              Level: 1
        ImageNumber: 1
         BorderSize: [0 0 0]
          BlockSize: [1024 1024 3]
    
           BlockSub: [5 6 1]
              Start: [4097 5121 1]
                End: [5120 6144 3]
              Level: 1
        ImageNumber: 1
         BorderSize: [0 0 0]
          BlockSize: [1024 1024 3]
    

    Input Arguments

    collapse all

    Blocked image datastore, specified as a blockedImageDatastore object.

    Output Arguments

    collapse all

    Data from the blocked image datastore, returned as a cell array of block data of length ReadSize.

    Metadata from the blocked image datastore, returned as a scalar struct with these fields. If ReadSize is greater than 1, these fields are arrays.

    FieldDescription
    Level

    Resolution level from which this data was read.

    ImageNumber

    Index into the bimds.Images array corresponding to the blockedImage from which this block was read.

    Start

    Subscripts of the first element in the block. If BorderSize is specified, this subscript can be out-of-bounds for edge blocks.

    End

    Subscripts of the last element in the block. If BorderSize is specified, this subscript can be out-of-bounds for edge blocks.

    Blocksub

    Block subscripts of the current block

    BorderSize

    Value of the BorderSize parameter

    BlockSize

    Value of the BlockSize parameter

    Version History

    Introduced in R2021a