Class PathUtils


  • public class PathUtils
    extends qupath.lib.scripting.QP
    • Field Summary

      • Fields inherited from class qupath.lib.scripting.QP

        BRIGHTFIELD_H_DAB, BRIGHTFIELD_H_E, BRIGHTFIELD_OTHER, FLUORESCENCE, OTHER, PROJECT_BASE_DIR
    • Constructor Summary

      Constructors 
      Constructor Description
      PathUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.List<qupath.lib.objects.PathObject> createCellObjects​(qupath.lib.objects.PathObject parent, java.util.List<qupath.lib.objects.PathObject> objects, double thickness_um)  
      static double getArea​(qupath.lib.objects.PathObject object)
      returns the area of the current PathObject in pixels If the area is not defined (like points) it returns 0
      static double getAreaMicrons​(qupath.lib.objects.PathObject object)
      returns the area of the current PathObject in calibrated units.
      static qupath.lib.objects.PathObject getFullImageAnnotation()
      returns a rectangle with teh whole dataset as an annotation.
      static qupath.lib.roi.interfaces.ROI LineToArea​(qupath.lib.roi.interfaces.ROI line, double thickness)
      Converts a line to a very thin 4 sided polygon, so it has an area
      static qupath.lib.objects.PathObject mergePathObjects​(java.util.List<qupath.lib.objects.PathObject> pathobjects)  
      static java.util.List<qupath.lib.objects.PathObject> mergeTouchingPathObjects​(java.util.List<qupath.lib.objects.PathObject> objects)
      This method tries to merge all the pathobjects that are touching, but keeping all others intact
      static java.util.List<qupath.lib.objects.PathObject> splitObject​(qupath.lib.objects.PathObject pathObject, qupath.lib.objects.PathObject splitter)
      Splits the defined pathobject using the provided splitter.
      • Methods inherited from class qupath.lib.scripting.QP

        addObject, addObjects, addObjects, addPixelClassifierMeasurements, addPixelClassifierMeasurements, addShapeMeasurements, addShapeMeasurements, addShapeMeasurements, buildFilePath, buildServer, buildServer, classifyDetectionsByCentroid, classifyDetectionsByCentroid, classifySelected, classifySelected, clearAllObjects, clearAllObjects, clearAnnotationMeasurements, clearAnnotationMeasurements, clearAnnotations, clearCellMeasurements, clearCellMeasurements, clearDetectionMeasurements, clearDetectionMeasurements, clearDetections, clearMeasurements, clearMeasurements, clearMeasurements, clearMeasurements, clearMeasurements, clearRootMeasurements, clearRootMeasurements, clearSelectedObjects, clearSelectedObjects, clearTileMeasurements, clearTileMeasurements, clearTMACoreMeasurements, clearTMACoreMeasurements, clearTMAGrid, createAnnotationsFromPixelClassifier, createAnnotationsFromPixelClassifier, createDetectionsFromPixelClassifier, createDetectionsFromPixelClassifier, createSelectAllObject, createSelectAllObject, describe, describe, deselectAll, deselectAll, detectionCentroidDistances, detectionCentroidDistances, detectionCentroidDistances, detectionToAnnotationDistances, detectionToAnnotationDistances, detectionToAnnotationDistances, duplicateSelectedAnnotations, fileExists, fireHierarchyUpdate, fireHierarchyUpdate, getAllObjects, getAnnotationObjects, getAnnotationObjectsAsArray, getBasePathClass, getCellObjects, getColorRGB, getCoreClasses, getCurrentHierarchy, getCurrentImageData, getCurrentServer, getCurrentServerPath, getDerivedPathClass, getDerivedPathClass, getDetectionObjects, getDetectionObjectsAsArray, getNonIntensityAncestorPathClass, getObjects, getObjects, getPathClass, getPathClass, getProject, getProjectEntry, getProjectEntryMetadataValue, getSelectedObject, getSelectedObjects, getSelectedROI, getTMACoreList, hasMeasurement, insertObjects, insertObjects, isDirectory, isTMADearrayed, loadImageData, loadObjectClassifier, loadPixelClassifier, makeInverseAnnotation, makeInverseAnnotation, makeInverseAnnotation, makeInverseAnnotation, makeInverseAnnotation, measurement, mergeAnnotations, mergeAnnotations, mergePointsForAllClasses, mergePointsForSelectedObjectClasses, mergeSelectedAnnotations, mergeSelectedAnnotations, mkdirs, nObjects, relabelTMAGrid, relabelTMAGrid, removeMeasurements, removeMeasurements, removeObject, removeObjects, removeObjects, replaceClassification, replaceClassification, replaceClassification, replaceClassification, resetBatchProjectAndImage, resetClassifications, resetClassifications, resetDetectionClassifications, resetIntensityClassifications, resetIntensityClassifications, resetIntensityClassifications, resetSelection, resetTMAMetadata, resetTMAMetadata, resolveHierarchy, resolveHierarchy, resolvePath, runClassifier, runClassifier, runClassifier, runObjectClassifier, runObjectClassifier, runPlugin, runPlugin, selectAnnotations, selectAnnotations, selectCells, selectCells, selectDetections, selectDetections, selectObjects, selectObjects, selectObjects, selectObjects, selectObjects, selectObjects, selectObjectsByClass, selectObjectsByClass, selectObjectsByClassification, selectObjectsByClassification, selectObjectsByMeasurement, selectObjectsByPathClass, selectObjectsByPathClass, selectTiles, selectTiles, selectTMACores, selectTMACores, selectTMACores, selectTMACores, setBatchProjectAndImage, setCellIntensityClassifications, setCellIntensityClassifications, setChannelColors, setChannelColors, setChannelNames, setChannelNames, setChannels, setChannels, setColorDeconvolutionStains, setDetectionIntensityClassifications, setDetectionIntensityClassifications, setImageType, setImageType, setIntensityClassifications, setIntensityClassifications, setIntensityClassifications, setIntensityClassificationsForSelected, setPixelSizeMicrons, setPixelSizeMicrons, setPixelSizeMicrons, setSelectedObject, writeImage, writeImage, writeImageRegion, writePredictionImage, writePredictionImage
      • Methods inherited from class java.lang.Object

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

      • PathUtils

        public PathUtils()
    • Method Detail

      • getFullImageAnnotation

        public static qupath.lib.objects.PathObject getFullImageAnnotation()
        returns a rectangle with teh whole dataset as an annotation. It does not add it to the Hierarchy
        Returns:
        an Annotation Object with the whole image
      • getAreaMicrons

        public static double getAreaMicrons​(qupath.lib.objects.PathObject object)
        returns the area of the current PathObject in calibrated units.
        Parameters:
        object - the object to try and compute the area from
        Returns:
        the calibrated area in um2
      • getArea

        public static double getArea​(qupath.lib.objects.PathObject object)
        returns the area of the current PathObject in pixels If the area is not defined (like points) it returns 0
        Parameters:
        object - the object to try and compute the area from
        Returns:
        the area in px2
      • splitObject

        public static java.util.List<qupath.lib.objects.PathObject> splitObject​(qupath.lib.objects.PathObject pathObject,
                                                                                qupath.lib.objects.PathObject splitter)
        Splits the defined pathobject using the provided splitter. it's basically a subtract but NOTE that this method will not return any shapes with holes, so please be aware of this limitation objects that end up separated become new PathObjects
        Parameters:
        pathObject - the object that will be split.
        splitter - the object used for splitting
        Returns:
        a List of PathObject with the resulting Paths
      • LineToArea

        public static qupath.lib.roi.interfaces.ROI LineToArea​(qupath.lib.roi.interfaces.ROI line,
                                                               double thickness)
        Converts a line to a very thin 4 sided polygon, so it has an area
        Parameters:
        line - the line roi to transform
        thickness - how thick the polygon should be (the width of the rectangle)
        Returns:
        a new ROI that is a PolygonROI
      • createCellObjects

        public static java.util.List<qupath.lib.objects.PathObject> createCellObjects​(qupath.lib.objects.PathObject parent,
                                                                                      java.util.List<qupath.lib.objects.PathObject> objects,
                                                                                      double thickness_um)
      • mergeTouchingPathObjects

        public static java.util.List<qupath.lib.objects.PathObject> mergeTouchingPathObjects​(java.util.List<qupath.lib.objects.PathObject> objects)
        This method tries to merge all the pathobjects that are touching, but keeping all others intact
        Parameters:
        objects -
        Returns:
      • mergePathObjects

        public static qupath.lib.objects.PathObject mergePathObjects​(java.util.List<qupath.lib.objects.PathObject> pathobjects)