Class PixelProcessorUtils

java.lang.Object
qupath.lib.experimental.pixels.PixelProcessorUtils

public class PixelProcessorUtils extends Object
Utility functions to help with the PixelProcessor class.
Since:
v0.5.0
  • Constructor Details

    • PixelProcessorUtils

      public PixelProcessorUtils()
  • Method Details

    • extractMaskedPixels

      public static double[] extractMaskedPixels(Parameters<BufferedImage,BufferedImage> params, int channel, Function<PathObject,ROI> roiFunction) throws IOException
      Extract the pixels from one channel of an image using the specified transform, and applying any ROI mask.
      Parameters:
      params - processor parameters
      channel - number of the channel to extract (0-based index)
      roiFunction - the function used to select a ROI from an object (generally the main ROI or nucleus), or null to use no ROI at all
      Returns:
      Throws:
      IOException
    • extractMaskedPixels

      public static double[] extractMaskedPixels(Parameters<BufferedImage,BufferedImage> params, String channelName, Function<PathObject,ROI> roiFunction) throws IOException
      Extract the pixels from one channel of an image using the specified transform, and applying any ROI mask.
      Parameters:
      params - processor parameters
      channelName - name of the channel to extract
      roiFunction - the function used to select a ROI from an object (generally the main ROI or nucleus), or null to use no ROI at all
      Returns:
      Throws:
      IOException
    • extractMaskedPixels

      public static double[] extractMaskedPixels(Parameters<BufferedImage,BufferedImage> params, ColorTransforms.ColorTransform transform, Function<PathObject,ROI> roiFunction) throws IOException
      Extract the pixels from the image using the specified transform, and applying any ROI mask.
      Parameters:
      params - processor parameters
      transform - transform to extract single-channel pixels
      roiFunction - the function used to select a ROI from an object (generally the main ROI or nucleus), or null to use no ROI at all
      Returns:
      Throws:
      IOException
    • maskObject

      public static List<PathObject> maskObject(ROI parentROI, PathObject child)
      Apply a ROI mask to an object, ensuring that the child object's ROI does not extend beyond the mask.
      Parameters:
      parentROI -
      child -
      Returns:
      either an empty or singleton list, depending upon whether the child object has a non-empty ROI after the masking is applied
    • maskObjectAndSplit

      public static List<PathObject> maskObjectAndSplit(ROI parentROI, PathObject child)
      Apply a ROI mask to an object, ensuring that the child object's ROI does not extend beyond the mask, and splitting the child object's ROI to create multiple objects if it contains disjoint regions.
      Parameters:
      parentROI -
      child -
      Returns:
      a list of objects, either empty or containing one or more objects
    • containsCentroid

      public static boolean containsCentroid(ROI roi, PathObject child)
      Check whether a child object's centroid is contained within a ROI.
      Parameters:
      roi -
      child -
      Returns: