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 Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    containsCentroid(qupath.lib.roi.interfaces.ROI roi, qupath.lib.objects.PathObject child)
    Check whether a child object's centroid is contained within a ROI.
    static double[]
    extractMaskedPixels(Parameters<BufferedImage,BufferedImage> params, int channel, Function<qupath.lib.objects.PathObject,qupath.lib.roi.interfaces.ROI> roiFunction)
    Extract the pixels from one channel of an image using the specified transform, and applying any ROI mask.
    static double[]
    extractMaskedPixels(Parameters<BufferedImage,BufferedImage> params, String channelName, Function<qupath.lib.objects.PathObject,qupath.lib.roi.interfaces.ROI> roiFunction)
    Extract the pixels from one channel of an image using the specified transform, and applying any ROI mask.
    static double[]
    extractMaskedPixels(Parameters<BufferedImage,BufferedImage> params, qupath.lib.images.servers.ColorTransforms.ColorTransform transform, Function<qupath.lib.objects.PathObject,qupath.lib.roi.interfaces.ROI> roiFunction)
    Extract the pixels from the image using the specified transform, and applying any ROI mask.
    static List<qupath.lib.objects.PathObject>
    maskObject(qupath.lib.roi.interfaces.ROI parentROI, qupath.lib.objects.PathObject child)
    Apply a ROI mask to an object, ensuring that the child object's ROI does not extend beyond the mask.
    static List<qupath.lib.objects.PathObject>
    maskObjectAndSplit(qupath.lib.roi.interfaces.ROI parentROI, qupath.lib.objects.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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PixelProcessorUtils

      public PixelProcessorUtils()
  • Method Details

    • extractMaskedPixels

      public static double[] extractMaskedPixels(Parameters<BufferedImage,BufferedImage> params, int channel, Function<qupath.lib.objects.PathObject,qupath.lib.roi.interfaces.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<qupath.lib.objects.PathObject,qupath.lib.roi.interfaces.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, qupath.lib.images.servers.ColorTransforms.ColorTransform transform, Function<qupath.lib.objects.PathObject,qupath.lib.roi.interfaces.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<qupath.lib.objects.PathObject> maskObject(qupath.lib.roi.interfaces.ROI parentROI, qupath.lib.objects.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<qupath.lib.objects.PathObject> maskObjectAndSplit(qupath.lib.roi.interfaces.ROI parentROI, qupath.lib.objects.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(qupath.lib.roi.interfaces.ROI roi, qupath.lib.objects.PathObject child)
      Check whether a child object's centroid is contained within a ROI.
      Parameters:
      roi -
      child -
      Returns: