Class ImageServerMetadata

java.lang.Object
qupath.lib.images.servers.ImageServerMetadata

public class ImageServerMetadata extends Object
Class for storing primary ImageServer metadata fields.

Can be used when the metadata needs to be adjusted (e.g. to correct erroneous pixel sizes).

Author:
Pete Bankhead
  • Field Details

  • Method Details

    • getPreferredDownsamplesArray

      public double[] getPreferredDownsamplesArray()
      Request the preferred downsamples from the image metadata.

      Note that this makes a defensive copy, and so should not be called often; it is generally preferably to request downsample values individually.

      Returns:
    • getLevels

      Get an unmodifiable list containing the resolution levels
      Returns:
    • getWidth

      public int getWidth()
      Get the full-resolution image width.
      Returns:
    • getHeight

      public int getHeight()
      Get the full-resolution image height.
      Returns:
    • nLevels

      public int nLevels()
      Get the number of resolution levels. For a non-pyramidal image, this is 1.
      Returns:
    • getPixelCalibration

      public PixelCalibration getPixelCalibration()
      Get a PixelCalibration object representing the pixel size information for this metadata object.
      Returns:
    • getDownsampleForLevel

      public double getDownsampleForLevel(int level)
      Get the downsample factor for a specific resolution level.
      Parameters:
      level -
      Returns:
    • getLevel

      public ImageServerMetadata.ImageResolutionLevel getLevel(int level)
      Get resolution information for a specified pyramidal level.
      Parameters:
      level -
      Returns:
    • isRGB

      public boolean isRGB()
      Returns true if the pixels are stored in (A)RGB form.
      Returns:
    • getPixelType

      public PixelType getPixelType()
      Returns the bit-depth for individual pixels in the image.
      Returns:
    • getMinValue

      public Number getMinValue()
      Get the minimum value supported by this image. By default, this is the lower bound of the PixelType unless otherwise specified.
      Returns:
      See Also:
    • getMaxValue

      public Number getMaxValue()
      Get the minimum value supported by this image. By default, this is the lower bound of the PixelType unless otherwise specified. This purpose of this method is to support other effective bit-depths (e.g. 12-bit, 14-bit).
      Returns:
      See Also:
    • pixelSizeCalibrated

      public boolean pixelSizeCalibrated()
      Returns true if pixel width and height calibration information is available for the image.
      Returns:
    • zSpacingCalibrated

      public boolean zSpacingCalibrated()
      Returns true if z-spacing calibration information is available for the image.
      Returns:
    • getAveragedPixelSize

      public double getAveragedPixelSize()
      Get the averaged pixel size in microns, if available - or Double.NaN otherwise.
      Returns:
    • getPixelWidthMicrons

      public double getPixelWidthMicrons()
      Get the pixel width in microns, if available - or Double.NaN otherwise.
      Returns:
    • getPixelHeightMicrons

      public double getPixelHeightMicrons()
      Get the pixel height in microns, if available - or Double.NaN otherwise.
      Returns:
    • getZSpacingMicrons

      public double getZSpacingMicrons()
      Get the z-spacing in microns, if available - or Double.NaN otherwise.
      Returns:
    • getTimeUnit

      public TimeUnit getTimeUnit()
      Get the time unit for a time series.
      Returns:
    • getTimepoint

      public double getTimepoint(int ind)
      Get the time point, defined in getTimeUnit(), or Double.NaN if this is unknown.
      Parameters:
      ind -
      Returns:
    • getSizeZ

      public int getSizeZ()
      Get the number of z-slices.
      Returns:
    • getSizeT

      public int getSizeT()
      Get the number of time points.
      Returns:
    • getSizeC

      public int getSizeC()
      Get the number of image channels.
      Returns:
    • getMagnification

      public double getMagnification()
      Get the magnification value, or Double.NaN if this is unavailable.
      Returns:
    • getPreferredTileWidth

      public int getPreferredTileWidth()
      Get the preferred tile width, which can be used to optimize pixel requests for large images.
      Returns:
    • getPreferredTileHeight

      public int getPreferredTileHeight()
      Get the preferred tile height, which can be used to optimize pixel requests for large images.
      Returns:
    • duplicate

      public ImageServerMetadata duplicate()
      Duplicate this metatadata.
      Returns:
    • getName

      public String getName()
      Get the image name.
      Returns:
    • getChannel

      public ImageChannel getChannel(int n)
      Get the specified channel.
      Parameters:
      n - channel index, starting at 0.
      Returns:
    • getChannels

      public List<ImageChannel> getChannels()
      Get an unmodifiable list of all channels.
      Returns:
    • getClassificationLabels

      public Map<Integer,PathClass> getClassificationLabels()
      Get map between labels and classification names. This is relevant only where the channel type is ImageServerMetadata.ChannelType.CLASSIFICATION, otherwise it returns an empty map.
      Returns:
    • getChannelType

      public ImageServerMetadata.ChannelType getChannelType()
      Get the channel type, which can be used to interpret the channels.
      Returns:
    • isCompatibleMetadata

      public boolean isCompatibleMetadata(ImageServerMetadata metadata)
      Returns true if a specified ImageServerMetadata is compatible with this one, that is it has the same path and dimensions (but possibly different pixel sizes, magnifications etc.).
      Parameters:
      metadata -
      Returns:
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object