Main Content

multicube

Read multispectral data

Since R2025a

    Description

    The multicube object represents the multispectral data cube and its related properties. Create multicube objects using the immulticube or geomulticube function. Use the multicube object functions to assign new pixel values, crop data, select desired bands, resample bands, and generate a colored image.

    The multicube object supports multispectral data acquired by these satellites.

    • EO-1 Advanced Land Imager (EO-1 ALI)

    • Landsat Multispectral Scanner (Landsat MSS)

    • Landsat Thematic Mapper (Landsat TM)

    • Landsat Enhanced Thematic Mapper Plus (Landsat ETM+)

    • Landsat Operational Land Imager / Thermal Infrared Scanner (Landsat OLI / TIRS)

    • Advanced Spaceborne Thermal Emission and Reflection Radiometer (ASTER) onboard the Terra satellite

    • Sentinel-2

    Note

    This object requires the Hyperspectral Imaging Library for Image Processing Toolbox™. You can install the Hyperspectral Imaging Library for Image Processing Toolbox from Add-On Explorer. For more information about installing add-ons, see Get and Manage Add-Ons.

    The Hyperspectral Imaging Library for Image Processing Toolbox requires desktop MATLAB®, as MATLAB Online™ and MATLAB Mobile™ do not support the library.

    Creation

    • Read multispectral data without geospatial information using the immulticube function.

    • Read multispectral data with geospatial information using the geomulticube function.

      Note

      The geomulticube function requires a Mapping Toolbox™ license.

    Properties

    expand all

    This property is read-only.

    List of image files, represented as a string array.

    • If you create a multicube object from a file, the ImageFiles property represents the list of image files. If you load the multispectral data cube into memory, such as by using the gather function or any other function that loads the data cube in memory as part of its operation, the ImageFiles property becomes empty.

    • If you create a multicube object from a numeric data cube, the ImageFiles property is empty.

    Data Types: string

    This property is read-only.

    Size of image in each band, represented as a C-by-2 matrix. C is the number of bands in the multispectral image. The first column represents the height and the second column represents the width of the image.

    Data Types: double

    This property is read-only.

    Center wavelength value of each spectral band, represented as a C-element vector. C is the spectral dimension, defined as the number of spectral bands, of the input multispectral data.

    Data Types: double

    This property is read-only.

    Metadata of the multispectral data, represented as a structure. The fields of the structure contain the properties of the multispectral image and spectral information. The set of fields in the structure depends on the individual image and file format. This table lists the common fields.

    FieldDescription
    DataType

    Data type of the data, represented as a C-element vector of strings. C is the number of bands in the multispectral image. Each element of the vector represents the data type of the image in that band.

    WavelengthUnits

    Units for the wavelengths of the spectral bands, represented as one of these strings.

    • "Nanometers" — All wavelengths are in nanometers (greater than 200 and less than 100000).

    • "Micrometers" — All wavelengths are in micrometers (greater than 0.2 and less than 100).

    • "" — Wavelengths are neither all in nanometers, nor all in micrometers.

    RasterReference

    Geospatial information of the multispectral image, represented as a structure.

    • If you create a multicube object with geospatial information using the geomulticube function, the RasterReference field contains the geospatial information. When you perform operations such as cropping on the multicube object, themulticube updates the geospatial information.

    • If you create a multicube object without geospatial information using the immulticube function, the RasterReference field is empty.

    Data Types: struct

    This property is read-only.

    Resolution of the image in each band, represented as a C-element vector. C is the number of bands in the multispectral image. Each element represents the resolution of the corresponding band.

    Data Types: double

    This property is read-only.

    Size of the data blocks, represented as a 2-element vector of positive integers. The first and second elements of the vector correspond to the number of rows and columns in each block, respectively. Loading the multispectral data cube using blocks enables you to load smaller regions of large data sets without running out of memory.

    • A small value for BlockSize reduces the memory usage of the function at the cost of increased execution time.

    • A large value for BlockSize reduces execution time at the cost of increased memory usage.

    You can set this property using the blockSize name-value argument of the immulticube or geomulticube function.

    • The number of rows in each block must be less than or equal to the number of rows in the multispectral image. If you specify a value greater than the number of rows in the multispectral image, BlockSize uses the number of rows in the multispectral image, instead. If the image contains more than 1024 rows, the default value for the number of rows in each block is 1024.

    • The number of columns in each block must be less than or equal to the number of columns in the multispectral image. If you specify a value greater than the number of columns in the multispectral image, BlockSize uses the number of columns in the multispectral image, instead. If the image contains more than 1024 columns, the default value for the number of columns in each block is 1024.

    Data Types: double

    Object Functions

    gatherRead data cube of spectral image into workspace
    assignDataAssign new data to spectral image data cube
    cropDataCrop regions-of-interest of spectral image
    selectBandsSelect bands from spectral image
    resampleBandsResample multispectral data
    colorizeEstimate color image of spectral image
    applyApply function to each block of spectral image

    Examples

    collapse all

    Download Landsat 8 multispectral data.

    zipfile = "LC08_L1TP_113082_20211206_20211215_02_T1.zip";
    landsat8Data_url = "https://ssd.mathworks.com/supportfiles/image/data/" + zipfile;
    hyper.internal.downloadLandsatDataset(landsat8Data_url,zipfile)
    filepath = fullfile("LC08_L1TP_113082_20211206_20211215_02_T1","LC08_L1TP_113082_20211206_20211215_02_T1_MTL.txt");

    Read a multispectral image into the workspace, and resample it to a uniform resolution.

    mcube = immulticube(filepath);
    mcube = resampleBands(mcube,30);

    Estimate and visualize the RGB image of the multispectral data.

    rgbImg = colorize(mcube);
    figure
    imshow(rgbImg)

    Convert the digital numbers to radiance values to perform radiometric calibration of the data.

    newmcube = dn2radiance(mcube);

    Compute and visualize the NDVI index for the corrected data.

    ndviImg = ndvi(newmcube);
    figure
    imagesc(ndviImg)
    axis equal tight
    colorbar

    More About

    expand all

    Version History

    Introduced in R2025a