Package qupath.lib.images.servers
Class PixelCalibration
java.lang.Object
qupath.lib.images.servers.PixelCalibration
Class used to represent pixel sizes.
Currently only 'pixel' and 'µm' units are supported.
- Author:
- Pete Bankhead
-
Nested Class Summary
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreateScaledInstance
(double scaleX, double scaleY) Get a scaled instance of this PixelCalibration, multiplying pixel sizes for x and y by the specified scale values.createScaledInstance
(double scaleX, double scaleY, double scaleZ) Get a scaled instance of this PixelCalibration, multiplying pixel sizes for x, y and z by the specified scale values.boolean
Get an average ofgetPixelWidth()
andgetPixelHeight()
.double
Get the average of the pixel width and height in microns if possible, or Double.NaN if the pixel size is not available.static PixelCalibration
Get the default PixelCalibration.Get the numeric value representing the pixel height, in the stored units.double
Get the pixel height in microns, or Double.NaN if this is unknown.Get a String representation of the preferred pixel height unit.Get the numeric value representing the pixel width, in the stored units.double
Get the pixel width in microns, or Double.NaN if this is unknown.Get a String representation of the preferred pixel width unit.double
getTimepoint
(int ind) Get the time for the specified time point, or Double.NaN if this is unknown.Get the time unit for a time series.Get the numeric value representing the z-spacing, in the stored units.double
Get the z-spacing in microns, or Double.NaN if this is unknown.Get a String representation of the preferred z-spacing unit.int
hashCode()
boolean
Returns true if the pixel width and height information in microns is known.boolean
Returns true if the z-spacing is known in microns.int
Get the number of known time points.toString()
boolean
Returns true if the units for pixel width and height are the same.boolean
Returns true if the units for pixel width, height and z-spacing are the same.
-
Field Details
-
PIXEL
String to represent 'pixel' units. This is the default when no pixel size calibration is known.- See Also:
-
MICROMETER
String to represent 'micrometer' units. -
Z_SLICE
String to represent 'z-slice' units.- See Also:
-
-
Method Details
-
createScaledInstance
Get a scaled instance of this PixelCalibration, multiplying pixel sizes for x and y by the specified scale values. Units are kept the same.- Parameters:
scaleX
-scaleY
-- Returns:
-
createScaledInstance
Get a scaled instance of this PixelCalibration, multiplying pixel sizes for x, y and z by the specified scale values. Units are kept the same.- Parameters:
scaleX
-scaleY
-scaleZ
-- Returns:
-
getTimeUnit
Get the time unit for a time series.- Returns:
-
nTimepoints
public int nTimepoints()Get the number of known time points.- Returns:
-
getTimepoint
public double getTimepoint(int ind) Get the time for the specified time point, or Double.NaN if this is unknown.- Parameters:
ind
-- Returns:
-
hasPixelSizeMicrons
public boolean hasPixelSizeMicrons()Returns true if the pixel width and height information in microns is known.- Returns:
-
hasZSpacingMicrons
public boolean hasZSpacingMicrons()Returns true if the z-spacing is known in microns.- Returns:
-
getAveragedPixelSizeMicrons
public double getAveragedPixelSizeMicrons()Get the average of the pixel width and height in microns if possible, or Double.NaN if the pixel size is not available.- Returns:
-
getZSpacingMicrons
public double getZSpacingMicrons()Get the z-spacing in microns, or Double.NaN if this is unknown.- Returns:
-
getPixelWidthMicrons
public double getPixelWidthMicrons()Get the pixel width in microns, or Double.NaN if this is unknown.- Returns:
-
getPixelHeightMicrons
public double getPixelHeightMicrons()Get the pixel height in microns, or Double.NaN if this is unknown.- Returns:
-
getPixelWidthUnit
Get a String representation of the preferred pixel width unit.- Returns:
- See Also:
-
unitsMatch2D
public boolean unitsMatch2D()Returns true if the units for pixel width and height are the same.- Returns:
-
unitsMatch3D
public boolean unitsMatch3D()Returns true if the units for pixel width, height and z-spacing are the same.- Returns:
-
getPixelHeightUnit
Get a String representation of the preferred pixel height unit.- Returns:
- See Also:
-
getZSpacingUnit
Get a String representation of the preferred z-spacing unit.- Returns:
- See Also:
-
getAveragedPixelSize
Get an average ofgetPixelWidth()
andgetPixelHeight()
. No check is made to ensure that these are returned in the same units; rather, the numbers are simply averaged.- Returns:
-
getPixelWidth
Get the numeric value representing the pixel width, in the stored units.- Returns:
- See Also:
-
getPixelHeight
Get the numeric value representing the pixel height, in the stored units.- Returns:
- See Also:
-
getZSpacing
Get the numeric value representing the z-spacing, in the stored units.- Returns:
- See Also:
-
toString
-
getDefaultInstance
Get the default PixelCalibration. This isn't terribly informative, giving pixel sizes in pixel units.- Returns:
-
hashCode
public int hashCode() -
equals
-