Class Utils


  • public class Utils
    extends qupath.lib.scripting.QP
    Utilities for QuPath scripting that make no use of the GUI
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String um  
      • 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
      Utils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static qupath.lib.gui.measure.ObservableMeasurementTableData getAllMeasurements()
      Returns all the measurements available in QuPath for the all pathObjects Then we can use things like getStringValue() and getDoubleValue()
      static qupath.lib.gui.measure.ObservableMeasurementTableData getAllMeasurements​(java.util.List<qupath.lib.objects.PathObject> pathObjects)
      Creates an ObservableMeasurementTableData for the requested PathObjects
      static double getPixelSize()
      Returns the current pixel size of the active image in microns
      static void sendResultsToFile​(java.util.ArrayList<java.lang.String> resultColumns, java.util.ArrayList<qupath.lib.objects.PathObject> objects)  
      static void sendResultsToFile​(java.util.ArrayList<java.lang.String> resultColumns, java.util.ArrayList<qupath.lib.objects.PathObject> objects, java.io.File resultsFile)
      By making use of ObservableMeasurementTableData, we can query each result and get a string back Works, for area, pathclasses, parents, and of course any other measurement in the final table
      static void sendResultsToFile​(java.util.ArrayList<qupath.lib.objects.PathObject> objects)  
      • 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

      • Utils

        public Utils()
    • Method Detail

      • sendResultsToFile

        public static void sendResultsToFile​(java.util.ArrayList<java.lang.String> resultColumns,
                                             java.util.ArrayList<qupath.lib.objects.PathObject> objects,
                                             java.io.File resultsFile)
        By making use of ObservableMeasurementTableData, we can query each result and get a string back Works, for area, pathclasses, parents, and of course any other measurement in the final table
        Parameters:
        resultColumns - a list of all the results we want to have, exactly the same names as in teh Measurement Results tables
        objects - the pathObjects we want to get the measurements from
        resultsFile - the file where this tool should write to. Note that if the file exists, it will be appended
        See Also:
        ObservableMeasurementTableData
      • sendResultsToFile

        public static void sendResultsToFile​(java.util.ArrayList<java.lang.String> resultColumns,
                                             java.util.ArrayList<qupath.lib.objects.PathObject> objects)
      • sendResultsToFile

        public static void sendResultsToFile​(java.util.ArrayList<qupath.lib.objects.PathObject> objects)
      • getAllMeasurements

        public static qupath.lib.gui.measure.ObservableMeasurementTableData getAllMeasurements()
        Returns all the measurements available in QuPath for the all pathObjects Then we can use things like getStringValue() and getDoubleValue()
        Returns:
        a class that you can use to access the results
        See Also:
        ObservableMeasurementTableData
      • getAllMeasurements

        public static qupath.lib.gui.measure.ObservableMeasurementTableData getAllMeasurements​(java.util.List<qupath.lib.objects.PathObject> pathObjects)
        Creates an ObservableMeasurementTableData for the requested PathObjects
        Parameters:
        pathObjects - a list of PathObjects to compute measurements from
        Returns:
        an object you can access the results getStringValue() and getDoubleValue()
        See Also:
        ObservableMeasurementTableData
      • getPixelSize

        public static double getPixelSize()
        Returns the current pixel size of the active image in microns
        Returns:
        the pixel size in um/px