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).
- Author:
- Pete Bankhead
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Builder to create a newImageServerMetadata
object.static enum
Enum representing possible channel (band) types for an image.static class
Width and height of each resolution in a multi-level image pyramid. -
Field Summary
Modifier and TypeFieldDescriptionstatic final ImageChannel
Default channel to use with images where the channel type isImageServerMetadata.ChannelType.CLASSIFICATION
. -
Method Summary
Modifier and TypeMethodDescriptionDuplicate this metatadata.boolean
double
Get 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.double
getDownsampleForLevel
(int level) Get the downsample factor for a specific resolution level.int
Get the full-resolution image height.getLevel
(int level) Get resolution information for a specified pyramidal level.Get an unmodifiable list containing the resolution levelsdouble
Get 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 aPixelCalibration
object representing the pixel size information for this metadata object.double
Get the pixel height in microns, if available - or Double.NaN otherwise.Returns the bit-depth for individual pixels in the image.double
Get the pixel width in microns, if available - or Double.NaN otherwise.double[]
Request the preferred downsamples from the image metadata.int
Get the preferred tile height, which can be used to optimize pixel requests for large images.int
Get the preferred tile width, which can be used to optimize pixel requests for large images.int
getSizeC()
Get the number of image channels.int
getSizeT()
Get the number of time points.int
getSizeZ()
Get the number of z-slices.double
getTimepoint
(int ind) Get the time point, defined ingetTimeUnit()
, or Double.NaN if this is unknown.Get the time unit for a time series.int
getWidth()
Get the full-resolution image width.double
Get the z-spacing in microns, if available - or Double.NaN otherwise.int
hashCode()
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.).boolean
isRGB()
Returns true if the pixels are stored in (A)RGB form.int
nLevels()
Get the number of resolution levels.boolean
Returns true if pixel width and height calibration information is available for the image.toString()
boolean
Returns 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 aPixelCalibration
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
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 thePixelType
unless otherwise specified.- Returns:
- See Also:
-
getMaxValue
Get the minimum value supported by this image. By default, this is the lower bound of thePixelType
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
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
-