Package qupath.lib.images.servers
Class ImageServerMetadata
java.lang.Object
qupath.lib.images.servers.ImageServerMetadata
Class for storing primary ImageServer metadata fields.
Can be used when the metadata needs to be adjusted (e.g. to correct erroneous pixel sizes).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder to create a newImageServerMetadataobject.static enumEnum representing possible channel (band) types for an image.static classWidth and height of each resolution in a multi-level image pyramid. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ImageChannelDefault channel to use with images where the channel type isImageServerMetadata.ChannelType.CLASSIFICATION. -
Method Summary
Modifier and TypeMethodDescriptionDuplicate this metatadata.booleandoubleGet the averaged pixel size in microns, if available - or Double.NaN otherwise.getChannel(int n) Get the specified channel.Get an unmodifiable list of all channels.Get the channel type, which can be used to interpret the channels.Get map between labels and classification names.doublegetDownsampleForLevel(int level) Get the downsample factor for a specific resolution level.intGet the full-resolution image height.getLevel(int level) Get resolution information for a specified pyramidal level.Get an unmodifiable list containing the resolution levelsdoubleGet the magnification value, or Double.NaN if this is unavailable.Get the minimum value supported by this image.Get the minimum value supported by this image.getName()Get the image name.Get aPixelCalibrationobject representing the pixel size information for this metadata object.doubleGet the pixel height in microns, if available - or Double.NaN otherwise.Returns the bit-depth for individual pixels in the image.doubleGet the pixel width in microns, if available - or Double.NaN otherwise.double[]Request the preferred downsamples from the image metadata.intGet the preferred tile height, which can be used to optimize pixel requests for large images.intGet the preferred tile width, which can be used to optimize pixel requests for large images.intgetSizeC()Get the number of image channels.intgetSizeT()Get the number of time points.intgetSizeZ()Get the number of z-slices.doublegetTimepoint(int ind) Get the time point, defined ingetTimeUnit(), or Double.NaN if this is unknown.Get the time unit for a time series.intgetWidth()Get the full-resolution image width.doubleGet the z-spacing in microns, if available - or Double.NaN otherwise.inthashCode()booleanisCompatibleMetadata(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.).booleanisRGB()Returns true if the pixels are stored in (A)RGB form.intnLevels()Get the number of resolution levels.booleanReturns true if pixel width and height calibration information is available for the image.toString()booleanReturns true if z-spacing calibration information is available for the image.
-
Field Details
-
DEFAULT_CLASSIFICATION_LABELS_CHANNEL
Default channel to use with images where the channel type isImageServerMetadata.ChannelType.CLASSIFICATION.
-
-
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
Get aPixelCalibrationobject 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
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
Returns the bit-depth for individual pixels in the image.- Returns:
-
getMinValue
Get the minimum value supported by this image. By default, this is the lower bound of thePixelTypeunless otherwise specified.- Returns:
- See Also:
-
getMaxValue
Get the minimum value supported by this image. By default, this is the lower bound of thePixelTypeunless 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
Get the time unit for a time series.- Returns:
-
getTimepoint
public double getTimepoint(int ind) Get the time point, defined ingetTimeUnit(), 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
Duplicate this metatadata.- Returns:
-
getName
Get the image name.- Returns:
-
getChannel
Get the specified channel.- Parameters:
n- channel index, starting at 0.- Returns:
-
getChannels
Get an unmodifiable list of all channels.- Returns:
-
getClassificationLabels
Get map between labels and classification names. This is relevant only where the channel type isImageServerMetadata.ChannelType.CLASSIFICATION, otherwise it returns an empty map.- Returns:
-
getChannelType
Get the channel type, which can be used to interpret the channels.- Returns:
-
isCompatibleMetadata
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
-
hashCode
public int hashCode() -
equals
-