Class SimpleThresholding

java.lang.Object
qupath.imagej.processing.SimpleThresholding

public class SimpleThresholding extends Object
Collection of static methods to threshold images, either with single global thresholds or using the pixel values of a second image.

Output is a ByteProcessor where 255 represents 'positive' pixels, and zero represents the background.

Author:
Pete Bankhead
  • Constructor Details

    • SimpleThresholding

      public SimpleThresholding()
  • Method Details

    • greaterThanOrEqual

      public static ByteProcessor greaterThanOrEqual(ImageProcessor ip1, ImageProcessor ip2)
      Created a binary image by thresholding pixels to find where ip1 >= ip2
      Parameters:
      ip1 -
      ip2 -
      Returns:
    • greaterThan

      public static ByteProcessor greaterThan(ImageProcessor ip1, ImageProcessor ip2)
      Created a binary image by thresholding pixels to find where ip1 > ip2
      Parameters:
      ip1 -
      ip2 -
      Returns:
    • thresholdBelow

      public static ByteProcessor thresholdBelow(ImageProcessor ip, float threshold)
      Created a binary image by thresholding pixels to find where ip1 < threshold
      Parameters:
      ip -
      threshold -
      Returns:
    • thresholdBelowEquals

      public static ByteProcessor thresholdBelowEquals(ImageProcessor ip, float threshold)
      Created a binary image by thresholding pixels to find where ip1 <= threshold
      Parameters:
      ip -
      threshold -
      Returns:
    • imagesEqual

      public static ByteProcessor imagesEqual(ImageProcessor ip1, ImageProcessor ip2)
      Created a binary image by identifying pixels where ip1 == ip2
      Parameters:
      ip1 -
      ip2 -
      Returns:
    • thresholdAbove

      public static ByteProcessor thresholdAbove(ImageProcessor ip, float threshold)
      Created a binary image by thresholding pixels to find where ip1 > threshold
      Parameters:
      ip -
      threshold -
      Returns:
    • thresholdAboveEquals

      public static ByteProcessor thresholdAboveEquals(ImageProcessor ip, float threshold)
      Created a binary image by thresholding pixels to find where ip1 >= threshold
      Parameters:
      ip -
      threshold -
      Returns:
    • thresholdBetween

      public static ByteProcessor thresholdBetween(ImageProcessor ip, float lowThreshold, float highThreshold)
      Created a binary image by thresholding pixels to find where ip >= lowThreshold and ip <= highThreshold
      Parameters:
      ip -
      lowThreshold -
      highThreshold -
      Returns:
    • thresholdToROI

      public static ROI thresholdToROI(BufferedImage img, double minThreshold, double maxThreshold, int band, RegionRequest request)
      Generate a QuPath ROI by thresholding an image channel image.
      Parameters:
      img - the input image (any type)
      minThreshold - minimum threshold; pixels >= minThreshold will be included
      maxThreshold - maximum threshold; pixels <= maxThreshold will be included
      band - the image band to threshold (channel)
      request - a RegionRequest corresponding to this image, used to calibrate the coordinates. If null, we assume no downsampling and an origin at (0,0).
      Returns:
      See Also:
      • thresholdToROI(ImageProcessor, TileRequest)
    • thresholdToROI

      public static ROI thresholdToROI(Raster raster, double minThreshold, double maxThreshold, int band, TileRequest request)
      Generate a QuPath ROI by thresholding an image channel image, deriving coordinates from a TileRequest.

      This can give a more accurate result than depending on a RegionRequest because it is possible to avoid some loss of precision.

      Parameters:
      raster -
      minThreshold -
      maxThreshold -
      band -
      request -
      Returns:
      See Also:
    • thresholdToROI

      public static ROI thresholdToROI(ImageProcessor ip, RegionRequest request)
      Generate a QuPath ROI from an ImageProcessor.

      It is assumed that the ImageProcessor has had its min and max threshold values set.

      Parameters:
      ip -
      request -
      Returns: