Class PixelCalibration

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

public class PixelCalibration extends Object
Class used to represent pixel sizes.

Currently only 'pixel' and 'µm' units are supported.

Author:
Pete Bankhead
  • Field Details

    • PIXEL

      public static final String PIXEL
      String to represent 'pixel' units. This is the default when no pixel size calibration is known.
      See Also:
    • MICROMETER

      public static final String MICROMETER
      String to represent 'micrometer' units.
    • Z_SLICE

      public static final String Z_SLICE
      String to represent 'z-slice' units.
      See Also:
  • Method Details

    • createScaledInstance

      public PixelCalibration createScaledInstance(double scaleX, double scaleY)
      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

      public PixelCalibration 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. Units are kept the same.
      Parameters:
      scaleX -
      scaleY -
      scaleZ -
      Returns:
    • getTimeUnit

      public TimeUnit 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

      public String 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

      public String getPixelHeightUnit()
      Get a String representation of the preferred pixel height unit.
      Returns:
      See Also:
    • getZSpacingUnit

      public String getZSpacingUnit()
      Get a String representation of the preferred z-spacing unit.
      Returns:
      See Also:
    • getAveragedPixelSize

      public Number getAveragedPixelSize()
      Get an average of getPixelWidth() and getPixelHeight(). No check is made to ensure that these are returned in the same units; rather, the numbers are simply averaged.
      Returns:
    • getPixelWidth

      public Number getPixelWidth()
      Get the numeric value representing the pixel width, in the stored units.
      Returns:
      See Also:
    • getPixelHeight

      public Number getPixelHeight()
      Get the numeric value representing the pixel height, in the stored units.
      Returns:
      See Also:
    • getZSpacing

      public Number getZSpacing()
      Get the numeric value representing the z-spacing, in the stored units.
      Returns:
      See Also:
    • toString

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

      public static PixelCalibration getDefaultInstance()
      Get the default PixelCalibration. This isn't terribly informative, giving pixel sizes in pixel units.
      Returns:
    • hashCode

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

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