주요 콘텐츠

openslideinfo

Read whole slide image file metadata using OpenSlide library

Since R2026a

    Description

    Add-On Required: This feature requires the Medical Imaging Toolbox Interface for Whole Slide Imaging File Reader add-on.

    info = openslideinfo(filename) reads the metadata from the whole slide imaging (WSI) file filename using the OpenSlide library and returns the metadata structure info.

    example

    Examples

    collapse all

    Run this code to download a whole slide image from the MathWorks® website, and unzip the downloaded folder. The image, stored in the NDPI format, contains an H&E stained microscopy slide provided by the OpenSlide library test data set [1].

    zipFile = matlab.internal.examples.downloadSupportFile("image","data/CMU-1.zip");
    filepath = fileparts(zipFile);
    if ~exist(filepath)
        unzip(zipFile,filepath)
    end
    filename = fullfile(filepath,"CMU-1.ndpi");

    Read the metadata from the file. The function returns a structure, info, that contains fields for the filename, vendor name, associated images, and raw metadata.

    info = openslideinfo(filename);

    The AssociatedImages field specifies which, if any, associated label, macro, or thumbnail images are present in the file. In this example, the file contains a macro image, which provides a low-resolution overview of the full slide.

    info.AssociatedImages
    ans = 
    "macro"
    

    The RawMetadata field contains the raw metadata that the OpenSlide library finds in the file. The exact attributes in the raw metadata vary between file formats and imaging setups. In general, the metadata specifies the image dimensions, size, and microscope acquisition settings. Many whole slide images are tiled and contain multiple downsampled resolution levels, so the metadata might also specify the tiling and image pyramid scheme.

    info.RawMetadata
    ans = struct with fields:
                     hamamatsu_SourceLens: 20
         hamamatsu_XOffsetFromSlideCentre: 4876667
         hamamatsu_YOffsetFromSlideCentre: -2340000
        openslide_associated_macro_height: 408
         openslide_associated_macro_width: 1191
                    openslide_level_count: 9
             openslide_level_0_downsample: 1
                 openslide_level_0_height: 38144
            openslide_level_0_tile_height: 8
             openslide_level_0_tile_width: 2048
                  openslide_level_0_width: 51200
             openslide_level_1_downsample: 2
                 openslide_level_1_height: 19072
            openslide_level_1_tile_height: 4
             openslide_level_1_tile_width: 1024
                  openslide_level_1_width: 25600
             openslide_level_2_downsample: 4
                 openslide_level_2_height: 9536
            openslide_level_2_tile_height: 8
             openslide_level_2_tile_width: 512
                  openslide_level_2_width: 12800
             openslide_level_3_downsample: 8
                 openslide_level_3_height: 4768
            openslide_level_3_tile_height: 4
             openslide_level_3_tile_width: 256
                  openslide_level_3_width: 6400
             openslide_level_4_downsample: 16
                 openslide_level_4_height: 2384
            openslide_level_4_tile_height: 8
             openslide_level_4_tile_width: 128
                  openslide_level_4_width: 3200
             openslide_level_5_downsample: 32
                 openslide_level_5_height: 1192
            openslide_level_5_tile_height: 4
             openslide_level_5_tile_width: 64
                  openslide_level_5_width: 1600
             openslide_level_6_downsample: 64
                 openslide_level_6_height: 596
            openslide_level_6_tile_height: 596
             openslide_level_6_tile_width: 800
                  openslide_level_6_width: 800
             openslide_level_7_downsample: 128
                 openslide_level_7_height: 298
            openslide_level_7_tile_height: 298
             openslide_level_7_tile_width: 400
                  openslide_level_7_width: 400
             openslide_level_8_downsample: 256
                 openslide_level_8_height: 149
            openslide_level_8_tile_height: 149
             openslide_level_8_tile_width: 200
                  openslide_level_8_width: 200
                          openslide_mpp_x: 0.4564
                          openslide_mpp_y: 0.4551
                openslide_objective_power: 20
                    openslide_quickhash_1: "f14cd7dcf9dff2b7b3551672a1f3248bd35cc4a2e57e3ca47a2b83eac9ad3987"
                            tiff_DateTime: "2009:12:31 09:11:46"
                                tiff_Make: "Hamamatsu"
                               tiff_Model: "NanoZoomer"
                      tiff_ResolutionUnit: "centimeter"
                            tiff_Software: "NDP.scan"
                         tiff_XResolution: 21910
                         tiff_YResolution: 21975
    
    

    Input Arguments

    collapse all

    Name of the file, specified as a string scalar or a character vector. Specify filename as the absolute path to the file, a relative path from the current directory, or a relative path from a directory on the MATLAB® path.

    The file must be in a format supported by the OpenSlide library. For a list of supported formats, see Virtual Slide Formats Understood by OpenSlide in the OpenSlide documentation.

    Data Types: char | string

    Output Arguments

    collapse all

    File metadata, returned as a structure that contains these fields.

    FieldDescription
    FilenameThe full path to the file.
    VendorInformation about the instrument used to acquire the image.
    AssociatedImagesList of related images in the file, such as thumbnails or low-resolution overviews.
    RawMetadata

    Detailed raw metadata from the file. The content of the raw metadata depends on the file format and imaging setup.

    References

    [1] "CMU‑1.ndpi". OpenSlide Test Data. Accessed November 10, 2025. https://openslide.cs.cmu.edu/download/openslide-testdata/Hamamatsu/.

    Version History

    Introduced in R2026a