Package qupath.lib.experimental.pixels
Class PixelProcessorUtils
java.lang.Object
qupath.lib.experimental.pixels.PixelProcessorUtils
Utility functions to help with the
PixelProcessor
class.- Since:
- v0.5.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
containsCentroid
(ROI roi, PathObject child) Check whether a child object's centroid is contained within a ROI.static double[]
extractMaskedPixels
(Parameters<BufferedImage, BufferedImage> params, int channel, Function<PathObject, 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<PathObject, 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, ColorTransforms.ColorTransform transform, Function<PathObject, ROI> roiFunction) Extract the pixels from the image using the specified transform, and applying any ROI mask.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.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.
-
Constructor Details
-
PixelProcessorUtils
public PixelProcessorUtils()
-
-
Method Details
-
extractMaskedPixels
public static double[] extractMaskedPixels(Parameters<BufferedImage, BufferedImage> params, int channel, Function<PathObject, throws IOExceptionROI> roiFunction) Extract the pixels from one channel of an image using the specified transform, and applying any ROI mask.- Parameters:
params
- processor parameterschannel
- 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, throws IOExceptionROI> roiFunction) Extract the pixels from one channel of an image using the specified transform, and applying any ROI mask.- Parameters:
params
- processor parameterschannelName
- name of the channel to extractroiFunction
- 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, throws IOExceptionROI> roiFunction) Extract the pixels from the image using the specified transform, and applying any ROI mask.- Parameters:
params
- processor parameterstransform
- transform to extract single-channel pixelsroiFunction
- 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
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
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
Check whether a child object's centroid is contained within a ROI.- Parameters:
roi
-child
-- Returns:
-