Class QP
Prior to running a script, the ImageData should be set so that the script can make use of it.
A different ImageData may be stored for different threads.
Note: This design may change in the future, to enable a non-static class to encapsulate the context for a running script. The limited ability to subclass a class containing static methods makes this design a bit problematic, while its package location means it cannot have access to GUI features (which it shouldn't have, because of the need to run headless... but sometimes the GUI is needed, e.g. to export images with markup).
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final qupath.lib.images.ImageData.ImageTypeBrightfield image type with hematoxylin and DAB stainingstatic final qupath.lib.images.ImageData.ImageTypeBrightfield image type with hematoxylin and eosin stainingstatic final qupath.lib.images.ImageData.ImageTypeBrightfield image typestatic final qupath.lib.images.ImageData.ImageTypeFluorescence image typestatic final qupath.lib.images.ImageData.ImageTypeAny other image type (neither brightfield nor fluorescence)static final StringPlaceholder for the path to the current project.static final StringThe user's home directory, as obtained fromSystem.getProperty("user.home").static final qupath.lib.common.VersionThe current QuPath version, parsed according to semantic versioning. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddObject(qupath.lib.objects.PathObject pathObject) Add the specified object to the currentPathObjectHierarchy.static voidaddObjects(Collection<qupath.lib.objects.PathObject> pathObjects) Add the specified collection of objects to the currentPathObjectHierarchy.static voidaddObjects(qupath.lib.objects.PathObject... pathObjects) Add the specified array of objects to the currentPathObjectHierarchy.static voidaddPixelClassifierMeasurements(String classifierName, String measurementID) Add measurements from pixel classification to the selected objects.static voidaddPixelClassifierMeasurements(qupath.lib.classifiers.pixel.PixelClassifier classifier, String measurementID) Add measurements from pixel classification to the selected objects.static voidaddShapeMeasurements(String... features) Add the specified shape measurements to the current selected objects of the current image.static voidaddShapeMeasurements(qupath.lib.images.ImageData<?> imageData, Collection<? extends qupath.lib.objects.PathObject> pathObjects, String feature, String... additionalFeatures) Add shape measurements to the specified objects.static voidaddShapeMeasurements(qupath.lib.images.ImageData<?> imageData, Collection<? extends qupath.lib.objects.PathObject> pathObjects, ObjectMeasurements.ShapeFeatures... features) Add shape measurements to the specified objects.static StringbuildFilePath(String first, String... more) Build a file path from multiple components.static StringbuildPathInProject(String... parts) Build a file or directory path relative to the current project, but do not make any changes on the file system.static <T> qupath.lib.images.servers.ImageServer<T> buildServer(String path, Class<T> cls, String... args) Deprecated.static qupath.lib.images.servers.ImageServer<BufferedImage> buildServer(String path, String... args) Build anImageServerwith the classBufferedImage.static qupath.lib.images.servers.ImageServer<BufferedImage> buildServer(URI uri, String... args) Build anImageServerwith the classBufferedImage.static voidcheckMinVersion(String version) Check whether the current QuPath version is ≥ the specified version.static voidcheckVersionRange(String minVersion, String maxVersion) Check whether the current QuPath version is ≥ the specified minimum version, and < the specified maximum.static voidclassifyDetectionsByCentroid(String classifierName) Classify detections according to the prediction of the pixel corresponding to the detection centroid using aPixelClassifier.static voidclassifyDetectionsByCentroid(qupath.lib.classifiers.pixel.PixelClassifier classifier) Classify detections according to the prediction of the pixel corresponding to the detection centroid using aPixelClassifier.static voidclassifySelected(String pathClassName) Set the classification of the selected objects in the current hierarchy.static voidclassifySelected(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, String pathClassName) Set the classification of the selected objects.static voidDeprecated.For naming consistency; use #removeAllObjects instead.static voidclearAllObjects(Class<? extends qupath.lib.objects.PathObject> cls) Deprecated.For naming consistency; use #removeAllObjects instead.static voidDeprecated.For consistency in naming; use #removeAnnotationMeasurements instead.static voidclearAnnotationMeasurements(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Deprecated.For consistency in naming; use #removeMeasurements instead.static voidDeprecated.For naming consistency; use #removeAnnotations instead.static voidDeprecated.For consistency in naming; use #removeCellMeasurements instead.static voidclearCellMeasurements(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Deprecated.For consistency in naming; use #removeCellMeasurements instead.static voidDeprecated.For consistency in naming; use #removeDetectionMeasurements instead.static voidclearDetectionMeasurements(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Deprecated.For consistency in naming; use #removeDetectionMeasurements instead.static voidDeprecated.For naming consistency; use #removeDetections instead.static voidDeprecated.For consistency in naming; use #removeMeasurements instead.static voidclearMeasurements(Class<? extends qupath.lib.objects.PathObject> cls) Deprecated.For consistency in naming; use #removeMeasurements instead.static voidclearMeasurements(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, Class<? extends qupath.lib.objects.PathObject> cls) Deprecated.For consistency in naming; use #removeMeasurements instead.static voidclearMeasurements(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, Collection<? extends qupath.lib.objects.PathObject> pathObjects) Deprecated.For consistency in naming; use #removeMeasurements instead.static voidclearMeasurements(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, qupath.lib.objects.PathObject... pathObjects) Deprecated.For consistency in naming; use #removeMeasurements instead.static voidDeprecated.For consistency in naming; use #removeRootMeasurements instead.static voidclearRootMeasurements(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Deprecated.For consistency in naming; use #removeRootMeasurements instead.static voidDeprecated.For consistency in naming; use #removeSelectedObjects instead.static voidclearSelectedObjects(boolean keepChildren) Deprecated.For consistency in naming; use #removeSelectedObjects instead.static voidDeprecated.For consistency in naming; use #removeTileMeasurements instead.static voidclearTileMeasurements(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Deprecated.For consistency in naming; use #removeTileMeasurements instead.static voidDeprecated.For consistency in naming; use #removeTMACoreMeasurements instead.static voidclearTMACoreMeasurements(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Deprecated.For consistency in naming; use #removeTMACoreMeasurements instead.static voidDeprecated.For naming consistency; use #removeTMAGrid instead.static voidConvert all detection objects to points, based on the object centroids.static voidConvert the selected objects to points, based on the object centroids.static voidconvertSpecifiedObjectsToPoints(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, Collection<? extends qupath.lib.objects.PathObject> pathObjects) Convert the selected objects to points, based on the object centroids.static booleancopySelectedAnnotationsToPlane(int z, int t) Copy the selected annotations in the current hierarchy to the specified z-slice and timepoint.static booleancopySelectedAnnotationsToPlane(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, qupath.lib.regions.ImagePlane plane) Copy the selected annotations in the specified hierarchy to the specified image plane.static booleancopySelectedAnnotationsToPlane(qupath.lib.regions.ImagePlane plane) Copy the selected annotations in the current hierarchy to the specified image plane.static booleancopySelectedObjectsToPlane(int z, int t) Copy the selected objects in the current hierarchy to the specified z-slice and timepoint.static booleancopySelectedObjectsToPlane(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, qupath.lib.regions.ImagePlane plane) Copy the selected objects in the specified hierarchy to the specified image plane.static booleancopySelectedObjectsToPlane(qupath.lib.regions.ImagePlane plane) Copy the selected objects in the current hierarchy to the specified image plane.static List<qupath.lib.objects.PathObject> createAllFullImageAnnotations(boolean setSelected) Create annotation around the full image for the current image, on all z-slices and timepoints.static List<qupath.lib.objects.PathObject> createAllFullImageAnnotations(qupath.lib.images.ImageData<?> imageData, boolean setSelected) Create annotation around the full image for the specified image, on all z-slices and timepoints.static voidcreateAnnotationsFromDensityMap(String densityMapName, Map<Integer, ? extends Number> thresholds, String pathClassName, String... options) Create annotations from a density map for the current image.static voidcreateAnnotationsFromDensityMap(qupath.lib.images.ImageData<BufferedImage> imageData, String densityMapName, Map<Integer, ? extends Number> thresholds, String pathClassName, String... options) Create annotations from a density map for the specified image.static voidcreateAnnotationsFromDensityMap(qupath.lib.images.ImageData<BufferedImage> imageData, DensityMaps.DensityMapBuilder densityMap, Map<Integer, ? extends Number> thresholds, String pathClassName, PixelClassifierTools.CreateObjectOptions... options) Create annotations from a density map for the specified image.static voidcreateAnnotationsFromPixelClassifier(String classifierName, double minArea, double minHoleArea, String... options) Create annotation objects based upon the output of a pixel classifier, applied to selected objects.static voidcreateAnnotationsFromPixelClassifier(qupath.lib.classifiers.pixel.PixelClassifier classifier, double minArea, double minHoleArea, String... options) Create annotation objects based upon the output of a pixel classifier, applied to selected objects.static voidcreateDetectionsFromPixelClassifier(String classifierName, double minArea, double minHoleArea, String... options) Create detection objects based upon the output of a pixel classifier, applied to selected objects.static voidcreateDetectionsFromPixelClassifier(qupath.lib.classifiers.pixel.PixelClassifier classifier, double minArea, double minHoleArea, String... options) Create detection objects based upon the output of a pixel classifier, applied to selected objects.static StringcreateDirectory(String first, String... more) Build a path to a directory, and create the directory if it does not already exist.static StringcreateDirectoryInProject(String... parts) Build a path to a directory, and create the directory if it does not already exist.static qupath.lib.objects.PathObjectcreateFullImageAnnotation(boolean setSelected) Create an annotation around the full image for the current image, on the default (first) z-slice and timepoint.static qupath.lib.objects.PathObjectcreateFullImageAnnotation(boolean setSelected, int z, int t) Create an annotation around the full image for the current image, on the specified z-slice and timepoint.static qupath.lib.objects.PathObjectcreateFullImageAnnotation(qupath.lib.images.ImageData<?> imageData, boolean setSelected) Create an annotation around the full image for the specified image, on the default (first) z-slice and timepoint.static qupath.lib.objects.PathObjectcreateFullImageAnnotation(qupath.lib.images.ImageData<?> imageData, boolean setSelected, int z, int t) Create an annotation around the full image for the specified image, on the specified z-slice and timepoint.static voidcreateSelectAllObject(boolean setSelected) Deprecated.v0.4.0 usecreateFullImageAnnotation(boolean)insteadstatic voidcreateSelectAllObject(boolean setSelected, int z, int t) Deprecated.v0.4.0 usecreateFullImageAnnotation(boolean, int, int)insteadstatic voidcreateTMAGrid(String hLabels, String vLabels, boolean rowFirst, double diameterCalibrated) Create a new regularTMAGridand set it as active on the hierarchy for the current image.static voidcreateTMAGrid(qupath.lib.images.ImageData<?> imageData, String hLabels, String vLabels, boolean rowFirst, double diameterCalibrated) Create a new regularTMAGridand set it as active on the hierarchy for an image.static StringList the fields and methods of a specified class.static StringList the fields and methods of a specified object.static voidReset the selection for the current hierarchy, so that no objects of any kind are selected.static voiddeselectAll(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Reset the selection, so that no objects of any kind are selected.static voidDeprecated.retained only for compatibility of v0.2.0 milestone releases; use instead #detectionCentroidDistances(boolean)static voiddetectionCentroidDistances(boolean splitClassNames) Compute the distance for all detection object centroids to the closest detection with each valid, not-ignored classification and add the result to the detection measurement list for the current ImageData.static voiddetectionCentroidDistances(qupath.lib.images.ImageData<?> imageData, boolean splitClassNames) Compute the distance for all detection object centroids to the closest detection with each valid, not-ignored classification and add the result to the detection measurement list.static voidDeprecated.retained only for compatibility of v0.2.0 milestone releases; use instead #detectionToAnnotationDistances(boolean)static voiddetectionToAnnotationDistances(boolean splitClassNames) Compute the distance for all detection object centroids to the closest annotation with each valid, not-ignored classification and add the result to the detection measurement list for the current ImageData.static voiddetectionToAnnotationDistances(qupath.lib.images.ImageData<?> imageData, boolean splitClassNames) Compute the distance for all detection object centroids to the closest annotation with each valid, not-ignored classification and add the result to the detection measurement list.static voiddetectionToAnnotationDistancesSigned(boolean splitClassNames) Compute the signed distance for all detection object centroids to the closest annotation with each valid, not-ignored classification and add the result to the detection measurement list for the current ImageData.static voiddetectionToAnnotationDistancesSigned(qupath.lib.images.ImageData<?> imageData, boolean splitClassNames) Compute the signed distance for all detection object centroids to the closest annotation with each valid, not-ignored classification and add the result to the detection measurement list.static booleanDuplicate the selected annotations in the current hierarchy.static booleanduplicateSelectedAnnotations(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Duplicate the selected annotations in the specified hierarchy.static voidexportAllObjectsToGeoJson(String path, String option, String... additionalOptions) Export all objects (excluding root object) to an output file as GeoJSON.static voidexportAllObjectsToGeoJson(String path, qupath.lib.io.PathIO.GeoJsonExportOptions... options) Export all objects (excluding root object) to an output file as GeoJSON.static voidexportObjectsToGeoJson(Collection<? extends qupath.lib.objects.PathObject> pathObjects, String path, String option, String... additionalOptions) Export specified objects to an output file as GeoJSON.static voidexportObjectsToGeoJson(Collection<? extends qupath.lib.objects.PathObject> pathObjects, String path, qupath.lib.io.PathIO.GeoJsonExportOptions... options) Export specified objects to an output file as GeoJSON.static voidexportSelectedObjectsToGeoJson(String path, String option, String... additionalOptions) Export the selected objects to an output file as GeoJSON.static voidexportSelectedObjectsToGeoJson(String path, qupath.lib.io.PathIO.GeoJsonExportOptions... options) Export the selected objects to an output file as GeoJSON.static booleanfileExists(String path) Query if a file exists.static voidfindDensityMapHotspots(String densityMapName, int channel, int numHotspots, double minCounts, boolean deleteExisting, boolean peaksOnly) Find hotspots in a density map for the current image.static voidfindDensityMapHotspots(qupath.lib.images.ImageData<BufferedImage> imageData, String densityMapName, int channel, int numHotspots, double minCounts, boolean deleteExisting, boolean peaksOnly) Find hotspots in a density map.static voidfindDensityMapHotspots(qupath.lib.images.ImageData<BufferedImage> imageData, DensityMaps.DensityMapBuilder densityMap, int channel, int numHotspots, double minCounts, boolean deleteExisting, boolean peaksOnly) Find hotspots in a density map.static voidTrigger an update for the current hierarchy.static voidfireHierarchyUpdate(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Trigger an update for the specified hierarchy.static Collection<qupath.lib.objects.PathObject> Get all objects in the current hierarchy, including the root object (which represents the entire image).static Collection<qupath.lib.objects.PathObject> getAllObjects(boolean includeRootObject) Get all objects in the current hierarchy.static Collection<qupath.lib.objects.PathObject> Get all objects in the current hierarchy, excluding the root object (which represents the entire image).static Collection<qupath.lib.objects.PathObject> Get a list of the current annotation objects.static qupath.lib.objects.classes.PathClassgetBasePathClass(qupath.lib.objects.PathObject pathObject) Get a base class - which is either a valid PathClass which is *not* an intensity class, or else null.static Collection<qupath.lib.objects.PathObject> Get a list of the current cell objects.static IntegergetColorRGB(int... v) Deprecated.Use insteadmakeRGB(int, int, int)ormakeARGB(int, int, int, int)static Collection<Class<?>> Get a list of core classes that are likely to be useful for scripting.static qupath.lib.objects.hierarchy.PathObjectHierarchyGet thePathObjectHierarchyof the currentImageData.static qupath.lib.images.ImageData<BufferedImage> Get the path to the currentImageData.static StringGet the name of the current image.static StringGet the name of the current image, removing any file extension.static qupath.lib.images.servers.ImageServer<?> Get theImageServerof the currentImageData.static StringGet the path to theImageServerof the currentImageData.static qupath.lib.objects.classes.PathClassgetDerivedPathClass(qupath.lib.objects.classes.PathClass baseClass, String name) Get a PathClass with the specified name, derived from another PathClass.static qupath.lib.objects.classes.PathClassgetDerivedPathClass(qupath.lib.objects.classes.PathClass baseClass, String name, Integer rgb) Get a PathClass with the specified name, derived from another PathClass.static Collection<qupath.lib.objects.PathObject> Get a list of the current detection objects.static org.slf4j.LoggerGet the logger associated with this class.static org.slf4j.LoggerGet a logger associated with a specified class.static org.slf4j.LoggerGet a logger with a specified name.static qupath.lib.objects.classes.PathClassgetNonIntensityAncestorPathClass(qupath.lib.objects.PathObject pathObject) Get the first ancestor class of pathObject.getPathClass() that is not an intensity class (i.e.static List<qupath.lib.objects.PathObject> getObjects(Predicate<qupath.lib.objects.PathObject> predicate) Get a list of all objects in the current hierarchy according to a specified predicate.static List<qupath.lib.objects.PathObject> getObjects(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, Predicate<qupath.lib.objects.PathObject> predicate) Get a list of all objects in the specified hierarchy according to a specified predicate.static qupath.lib.objects.classes.PathClassgetPathClass(String name) Get a PathClass with the specified name.static qupath.lib.objects.classes.PathClassgetPathClass(String name, Integer rgb) Get a PathClass with the specified name and color.static qupath.lib.projects.Project<BufferedImage> Get the current project.static qupath.lib.projects.ProjectImageEntry<BufferedImage> Get the project entry for the currently-open image within the current project, or null if no project/image is open.static StringGet the metadata value from the current project entry for the specified key, or null if no such metadata value exists (or no project entry is open).static qupath.lib.objects.PathObjectGet the primary selected object within the currentPathObjectHierarchy.static Collection<qupath.lib.objects.PathObject> Get the selected objects within the currentPathObjectHierarchy.static qupath.lib.roi.interfaces.ROIGet theROIfor the primary selected object within the currentPathObjectHierarchy.static Collection<qupath.lib.objects.PathObject> Get a list of the current tile objects.static List<qupath.lib.objects.TMACoreObject> Get the list of TMA core objects for the current hierarchy.static booleanhasMeasurement(qupath.lib.objects.PathObject pathObject, String measurementName) Test whether a PathObject has a specified measurement in its measurement list.static booleanimportObjectsFromFile(String path) Import allPathObjects from the given file.static voidinsertObjects(Collection<? extends qupath.lib.objects.PathObject> pathObjects) Insert objects into the hierarchy, resolving their location and setting parent/child relationships.static voidinsertObjects(qupath.lib.objects.PathObject pathObject) Insert object into the hierarchy, resolving its location and setting parent/child relationships.static booleanisDirectory(String path) Query if a file path corresponds to a directory.static booleanReturnstrueif TMA cores are available.loadDensityMap(String name) Load a density map for a project or file path.static qupath.lib.images.ImageData<BufferedImage> loadImageData(String path, boolean setBatchData) Deprecated.static qupath.lib.classifiers.object.ObjectClassifier<BufferedImage> loadObjectClassifier(String... names) Load an object classifier for a project or file path.static qupath.lib.classifiers.pixel.PixelClassifierloadPixelClassifier(String name) Load a pixel classifier for a project or file path.static StringlocateFile(String nameOrPath) Locate a specified file based upon its name or path, with a search depth of 4.static StringlocateFile(String nameOrPath, int searchDepth) Locate a specified file based upon its name or path.static IntegermakeARGB(int a, int r, int g, int b) Make a packed int representation of an ARGB color.static FilemakeFileInProject(String... more) Build a file path relative to the current project, and create aFileobject.static booleanMake an inverse annotation using the currentImageDataand its current selected objects.static booleanmakeInverseAnnotation(qupath.lib.images.ImageData<?> imageData) Make an inverse annotation using the specifiedImageDataand current selected objects.static booleanmakeInverseAnnotation(qupath.lib.images.ImageData<?> imageData, Collection<qupath.lib.objects.PathObject> pathObjects) Make an annotation, for which the ROI is obtained by subtracting the ROIs of the specified objects from the closest common ancestor ROI (or entire image if the closest ancestor is the root).static booleanmakeInverseAnnotation(qupath.lib.images.ImageData<?> imageData, qupath.lib.objects.PathObject pathObject) Make an annotation for the specifiedImageData, for which the ROI is obtained by subtracting the existing ROI from the ROI of its parent object (or entire image if no suitable parent object is available).static booleanmakeInverseAnnotation(qupath.lib.objects.PathObject pathObject) Make an annotation for the currentImageData, for which the ROI is obtained by subtracting the existing ROI from the ROI of its parent object (or entire image if no suitable parent object is available).static StringmakePathInProject(String... more) Deprecated.v0.6.0, usecreateDirectoryInProject(String...)instead.static IntegermakeRGB(int r, int g, int b) Make a packed int representation of an RGB color.static doublemeasurement(qupath.lib.objects.PathObject pathObject, String measurementName) Extract the specified measurement from a PathObject.static booleanmergeAnnotations(Collection<qupath.lib.objects.PathObject> annotations) Merge annotations for the current hierarchy.static booleanmergeAnnotations(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, Collection<qupath.lib.objects.PathObject> annotations) Merge the specified annotations to create a new annotation containing the union of their ROIs.static booleanMerge point annotations sharing the samePathClassandImagePlaneas the selected annotations of the current hierarchy, creating multi-point annotations for all matching points and removing the (previously-separated) annotations.static booleanMerge point annotations sharing the samePathClassandImagePlanefor the current hierarchy, creating multi-point annotations for all matching points and removing the (previously-separated) annotations.static booleanMerge the currently-selected annotations of the current hierarchy to create a new annotation containing the union of their ROIs.static booleanmergeSelectedAnnotations(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Merge the currently-selected annotations to create a new annotation containing the union of their ROIs.static booleanEnsure directories exist for the specified path, callingfile.mkdirs()if not.static intnObjects()Get a count of the total number of objects in the current hierarchy.static booleanRefresh all object IDs for the current hierarchy to ensure there are no duplicates, retaining the original IDs where possible.static booleanrefreshDuplicateIDs(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Refresh all object IDs for the current hierarchy to ensure there are no duplicates, retaining the original IDs where possible.static voidRefresh all object IDs for the current hierarchy.static voidrefreshIDs(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Refresh all object IDs for the current hierarchy.static booleanrelabelTMAGrid(String labelsHorizontal, String labelsVertical, boolean rowFirst) Relabel the current TMA grid.static booleanrelabelTMAGrid(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, String labelsHorizontal, String labelsVertical, boolean rowFirst) Relabel a TMA grid.static voidRemove all the objects in the currentPathObjectHierarchy, and reset the selection.static voidremoveAllObjects(Class<? extends qupath.lib.objects.PathObject> cls) Remove all the objects of a specified Java class.static voidRemove the measurements from all annotations in the current hierarchy.static voidremoveAnnotationMeasurements(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Remove the measurements from all annotations in a hierarchy.static voidRemove all the annotation objects from the currentPathObjectHierarchy.static voidRemove the measurements from all cells in the current hierarchy.static voidremoveCellMeasurements(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Remove the measurements from all cells in a hierarchy.static booleanRemove all objects that touch or overlap the bounds of the selected objects in the current image, and are direct children of the selected objects.static booleanremoveChildObjectsTouchingSelectedBounds(Predicate<qupath.lib.objects.PathObject> filter) Remove objects that touch or overlap the bounds of the selected objects in the current image, and are direct children of the selected objects.static booleanremoveChildObjectsTouchingSelectedBounds(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, Predicate<qupath.lib.objects.PathObject> filter) Remove objects that touch or overlap the bounds of the selected objects in the specified image, and are direct children of the selected objects.static voidRemove the measurements from all detections in the current hierarchy.static voidremoveDetectionMeasurements(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Remove the measurements from all detections in a hierarchy (including sub-classes of detections).static voidRemove all the detection objects from the currentPathObjectHierarchy.static voidRemove the measurements from all detections in the current hierarchy.static voidremoveMeasurements(Class<? extends qupath.lib.objects.PathObject> cls) Remove the measurements from objects of a specific class in the current hierarchy (subclasses are not included!).static voidremoveMeasurements(Class<? extends qupath.lib.objects.PathObject> cls, String... measurementNames) Remove measurements from objects of a specific class for the current image data.static voidremoveMeasurements(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, Class<? extends qupath.lib.objects.PathObject> cls) Remove the measurements from objects of a specific class in a hierarchy (subclasses are not included!).static voidremoveMeasurements(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, Class<? extends qupath.lib.objects.PathObject> cls, String... measurementNames) Remove measurements from objects of a specific class for the specified hierarchy.static voidremoveMeasurements(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, Collection<? extends qupath.lib.objects.PathObject> pathObjects) Remove the measurements from specified objects within a hierarchy.static voidremoveMeasurements(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, qupath.lib.objects.PathObject... pathObjects) Remove the measurements from specified objects within a hierarchy.static voidremoveObject(qupath.lib.objects.PathObject pathObject) Remove the specified object from the currentPathObjectHierarchy, keeping any descendant objects.static voidremoveObject(qupath.lib.objects.PathObject pathObject, boolean keepChildren) Deprecated.static voidremoveObjectAndDescendants(qupath.lib.objects.PathObject pathObject) Remove the specified object and any descendant objects from the currentPathObjectHierarchy.static voidremoveObjects(Collection<? extends qupath.lib.objects.PathObject> pathObjects) Remove the specified collection of objects from the currentPathObjectHierarchy.static voidremoveObjects(Collection<? extends qupath.lib.objects.PathObject> pathObjects, boolean keepChildren) Deprecated.UseremoveObjects(Collection)orremoveObjectsAndDescendants(Collection)instead.static voidremoveObjects(qupath.lib.objects.PathObject... pathObjects) Remove the specified array of objects from the currentPathObjectHierarchy.static voidremoveObjects(qupath.lib.objects.PathObject[] pathObjects, boolean keepChildren) Deprecated.UseremoveObjects(PathObject[])orremoveObjectsAndDescendants(PathObject[])instead.static voidremoveObjectsAndDescendants(Collection<? extends qupath.lib.objects.PathObject> pathObjects) Remove the specified collection of objects from the currentPathObjectHierarchy, and all their descendants.static voidremoveObjectsAndDescendants(qupath.lib.objects.PathObject... pathObjects) Remove the specified array of objects from the currentPathObjectHierarchy, and all their descendants.static booleanRemove objects that are entirely outside the current image.static booleanremoveObjectsOutsideImage(boolean ignoreIntersecting) Remove objects that are entirely or partially outside the current image.static booleanremoveObjectsOutsideImage(qupath.lib.images.ImageData<?> imageData) Remove objects that are entirely or outside the specified image.static booleanremoveObjectsOutsideImage(qupath.lib.images.ImageData<?> imageData, boolean ignoreIntersecting) Remove objects that are entirely or partially outside the specified image.static booleanRemove all objects that touch the boundary of the current image.static booleanremoveObjectsTouchingImageBounds(Predicate<qupath.lib.objects.PathObject> filter) Remove all objects that touch the boundary of the current image.static booleanremoveObjectsTouchingImageBounds(qupath.lib.images.ImageData<?> imageData, Predicate<qupath.lib.objects.PathObject> filter) Remove objects that touch the boundary of the specified image.static booleanRemove all objects that touch or overlap the bounds of the selected objects in the current image.static booleanremoveObjectsTouchingSelectedBounds(Predicate<qupath.lib.objects.PathObject> filter) Remove objects that touch or overlap the bounds of the selected objects in the current image.static booleanremoveObjectsTouchingSelectedBounds(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, Predicate<qupath.lib.objects.PathObject> filter) Remove objects that touch or overlap the bounds of the selected objects in the specified object hierarchy.static booleanRemove objects occurring outside the current image bounds, clipping annotations where possible to retain the part that is inside the image.static booleanremoveOrClipObjectsOutsideImage(qupath.lib.images.ImageData<?> imageData) Remove objects occurring outside the specified image bounds, clipping annotations where possible to retain the part that is inside the image.static voidRemove measurements from the root object of the current hierarchy.static voidremoveRootMeasurements(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Remove the measurements from the root object.static voidRemove selected objects, but keep child (descendant) objects.static voidDelete the selected objects from the current hierarchy, including all the child and descendant objects.static voidRemove the measurements from all tiles in the current hierarchy.static voidremoveTileMeasurements(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Remove the measurements from all tiles in a hierarchy.static voidRemove the measurements from all TMA core objects in the current hierarchy.static voidremoveTMACoreMeasurements(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Remove the measurements from all TMA core objects in a hierarchy.static voidRemove the TMA grid from the currentPathObjectHierarchy.static voidreplaceClassification(String originalClassName, String newClassName) Apply a new classification to all objects in the current hierarchy with a specified classification.static voidreplaceClassification(Collection<qupath.lib.objects.PathObject> pathObjects, qupath.lib.objects.classes.PathClass originalClass, qupath.lib.objects.classes.PathClass newClass) Apply a new classification to all objects with a specified original classification in an object collection.static voidreplaceClassification(qupath.lib.objects.classes.PathClass originalClass, qupath.lib.objects.classes.PathClass newClass) Apply a new classification to all objects in the current hierarchy with a specified original classification.static voidreplaceClassification(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, qupath.lib.objects.classes.PathClass originalClass, qupath.lib.objects.classes.PathClass newClass) Apply a new classification to all objects with a specified original classification in the provided hierarchy.static voidReset theProjectandImageDataused for batch processing for the current thread.static voidresetClassifications(Class<? extends qupath.lib.objects.PathObject> cls) Reset the PathClass for all objects of the specified type in the current hierarchy.static voidresetClassifications(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, Class<? extends qupath.lib.objects.PathObject> cls) Reset the PathClass for all objects of the specified type in the specified hierarchy.static voidReset the PathClass for all detection objects in the current hierarchy.static voidReset the intensity classifications for all detections in the current hierarchy.static voidresetIntensityClassifications(Collection<qupath.lib.objects.PathObject> pathObjects) Reset the intensity classifications for all specified objects.static voidresetIntensityClassifications(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Reset the intensity classifications for all detections in the specified hierarchy.static voidUnselect the selected objects for the currentPathObjectHierarchy.static voidresetTMAMetadata(boolean includeMeasurements) Remove all TMA metadata from the current TMA grid.static voidresetTMAMetadata(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, boolean includeMeasurements) Remove all TMA metadata from the TMA grid of the specified hierarchy.static voidResolve the location of annotations in the current hierarchy by setting parent/child relationships.static voidresolveHierarchy(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Resolve the location of annotations in the specified hierarchy by setting parent/child relationships.static StringresolvePath(String path) Resolve a path, replacing any placeholders.static voidrunObjectClassifier(String... names) Apply an object classifier to the currentImageData.static voidrunObjectClassifier(qupath.lib.images.ImageData imageData, String... names) Apply an object classifier to the specifiedImageData.static booleanRun the specified plugin on the currentImageData.static booleanRun the specified plugin on the currentImageData, using a map for arguments.static booleanRun the specified plugin on the specifiedImageData.static booleanRun the specified plugin on the specifiedImageData, using a map for arguments.static booleanRun the specified plugin on the currentImageData, with Groovy keyword argument support.static booleanRun the specified plugin on the specifiedImageData, with Groovy keyword argument support.static voidscaleAllObjects(double scaleFactor) Resize the ROIs of all objects in the current object hierarchy.static voidscaleAllObjects(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, double scaleFactor) Resize the ROIs of all objects in the specified object hierarchy.static voidSelect all objects in the current hierarchy, excluding the root object.static voidselectAllObjects(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Select all objects in the specified hierarchy, excluding the root object.static voidselectAllObjects(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, boolean includeRootObject) Set selected objects to contain all objects.static voidSelect all annotation objects in the current hierarchy.static voidselectAnnotations(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Select all annotation objects in the specified hierarchy.static voidSelect all cell objects in the current hierarchy.static voidselectCells(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Select all cell objects in the specified hierarchy.static voidSelect all detection objects in the current hierarchy.static voidselectDetections(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Select all detection objects in the specified hierarchy.static voidselectObjects(Collection<? extends qupath.lib.objects.PathObject> pathObjects) Set all objects in a collection to be selected, without any being chosen as the main object.static voidselectObjects(Collection<? extends qupath.lib.objects.PathObject> pathObjects, qupath.lib.objects.PathObject mainSelection) Set all objects in a collection to be selected, including a specified main selected object.static voidselectObjects(Predicate<qupath.lib.objects.PathObject> predicate) Set selected objects to contain (only) all objects in the current hierarchy according to a specified predicate.static voidselectObjects(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, Predicate<qupath.lib.objects.PathObject> predicate) Set selected objects to contain (only) all objects in the specified hierarchy according to a specified predicate.static voidselectObjects(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, qupath.lib.objects.PathObject... pathObjects) Set one or more objects to be selected within the specified hierarchy.static voidselectObjects(qupath.lib.objects.PathObject... pathObjects) Set one or more objects to be selected within the current hierarchy.static voidselectObjectsByClass(Class<? extends qupath.lib.objects.PathObject> cls) Set objects that are a subclass of a specified class.static voidselectObjectsByClass(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, Class<? extends qupath.lib.objects.PathObject> cls) Set objects that are a subclass of a specified class.static voidselectObjectsByClassification(String... pathClassNames) Select objects for the current hierarchy that have one of the specified classifications.static voidselectObjectsByClassification(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, String... pathClassNames) Select objects for the specified hierarchy that have one of the specified classifications.static voidselectObjectsByMeasurement(qupath.lib.images.ImageData<?> imageData, String command) Deprecated.static voidselectObjectsByPathClass(qupath.lib.objects.classes.PathClass... pathClasses) Select objects for the current hierarchy that have one of the specifiedPathClassclassifications assigned.static voidselectObjectsByPathClass(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, qupath.lib.objects.classes.PathClass... pathClasses) Select objects for the specified hierarchy that have one of the specifiedPathClassclassifications assigned.static voidselectObjectsByPlane(int z, int t) Selected objects in the current hierarchy occurring on the specified z-slice and timepoint.static voidselectObjectsByPlane(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, qupath.lib.regions.ImagePlane plane) Selected objects in the specified hierarchy occurring on the specified plane (z-slice and timepoint).static voidselectObjectsByPlane(qupath.lib.regions.ImagePlane plane) Selected objects in the current hierarchy occurring on the specified plane (z-slice and timepoint).static voidSelect all tile objects in the current hierarchy.static voidselectTiles(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Select all tile objects in the specified hierarchy.static voidSelect all TMA core objects in the current hierarchy, excluding missing cores.static voidselectTMACores(boolean includeMissing) Select all TMA core objects in the current hierarchy, optionally including missing cores.static voidselectTMACores(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Select all TMA core objects in the specified hierarchy, excluding missing cores.static voidselectTMACores(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, boolean includeMissing) Select all TMA core objects in the specified hierarchy, optionally including missing cores.static voidsetBatchProjectAndImage(qupath.lib.projects.Project<BufferedImage> project, qupath.lib.images.ImageData<BufferedImage> imageData) Set theProjectandImageDatato use for batch processing for the current thread.static voidsetCellIntensityClassifications(String measurementName, double... thresholds) Set the intensity classifications for cells in the current hierarchy.static voidsetCellIntensityClassifications(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, String measurementName, double... thresholds) Set the intensity classifications for cells in the specified hierarchy.static voidsetChannelColors(Integer... colors) Set the channel colors for the current ImageData.static voidsetChannelColors(qupath.lib.images.ImageData<?> imageData, Integer... colors) Set the channel colors for the specified ImageData.static voidsetChannelNames(String... names) Set the channel names for the current ImageData.static voidsetChannelNames(qupath.lib.images.ImageData<?> imageData, String... names) Set the channel names for the specified ImageData.static voidsetChannels(qupath.lib.images.ImageData<?> imageData, qupath.lib.images.servers.ImageChannel... channels) Set the channels for the specified ImageData.static voidsetChannels(qupath.lib.images.servers.ImageChannel... channels) Set the channels for the current ImageData.static booleanSet the color deconvolution stains for hte current image data using a (JSON) String representationstatic voidSet the color deconvolution stains for the current image data.static voidsetDefaultImageData(qupath.lib.images.ImageData<BufferedImage> imageData) Set the default image data, which will be returned bygetCurrentImageData()if it would otherwise return null (i.e.static voidsetDefaultProject(qupath.lib.projects.Project<BufferedImage> project) Set the default project, which will be returned bygetProject()if it would otherwise return null (i.e.static voidsetDetectionIntensityClassifications(String measurementName, double... thresholds) Set the intensity classifications for detections in the current hierarchy.static voidsetDetectionIntensityClassifications(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, String measurementName, double... thresholds) Set the intensity classifications for detections in the specified hierarchy.static booleansetImageType(String typeName) Set the image type for the current image data, using a String to represent the enumImageData.ImageTypestatic booleansetImageType(qupath.lib.images.ImageData.ImageType type) Set the image type for the current image datastatic voidsetIntensityClassifications(Class<? extends qupath.lib.objects.PathObject> cls, String measurementName, double... thresholds) Set the intensity classifications for objects of the specified class in the current hierarchy.static voidsetIntensityClassifications(Collection<? extends qupath.lib.objects.PathObject> pathObjects, String measurementName, double... thresholds) Set the intensity classifications for the specified objects.static voidsetIntensityClassifications(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, Class<? extends qupath.lib.objects.PathObject> cls, String measurementName, double... thresholds) Set the intensity classifications for objects of the specified class in the specified hierarchy.static voidsetIntensityClassificationsForSelected(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, String measurementName, double... thresholds) Set intensity classifications for all selected (detection) objects in the specified hierarchy.static booleansetPixelSizeMicrons(Number pixelWidthMicrons, Number pixelHeightMicrons) Set the metadata for the current ImageData to have the required pixel sizes.static booleansetPixelSizeMicrons(Number pixelWidthMicrons, Number pixelHeightMicrons, Number zSpacingMicrons) Set the metadata for the current ImageData to have the required pixel sizes and z-spacing.static booleansetPixelSizeMicrons(qupath.lib.images.ImageData<?> imageData, Number pixelWidthMicrons, Number pixelHeightMicrons, Number zSpacingMicrons) Set the metadata for an ImageServer to have the required pixel sizes and z-spacing.static booleansetSelectedObject(qupath.lib.objects.PathObject pathObject) Set the selected object for the currentPathObjectHierarchy.static voidsimplifyAllAnnotations(double altitudeThreshold) Simplify all annotations to a given thresholdstatic voidsimplifySelectedAnnotations(double altitudeThreshold) Simplify the currently selected annotations to a given thresholdstatic voidsimplifySpecifiedAnnotations(Collection<? extends qupath.lib.objects.PathObject> pathObjects, double altitudeThreshold) Simplify a set of pathObjects to a given threshold.static booleanSplit annotation objects with area ROIs using dividing lines extracted from annotations objects with line ROIs, then remove the lines from the object hierarchy.static booleansplitAllAnnotationAreasByLines(double thickness, boolean removeLines) Split annotation objects with area ROIs using dividing lines extracted from annotations objects with line ROIs, with an optional line thickness and optionally removing the dividing lines.static booleansplitAllAnnotationAreasByLines(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Split annotation objects with area ROIs using dividing lines extracted from annotations objects with line ROIs, then remove the lines from the object hierarchy.static booleansplitAllAnnotationAreasByLines(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, double thickness, boolean removeLines) Split annotation objects with area ROIs using dividing lines extracted from annotations objects with line ROIs, with an optional line thickness and optionally removing the dividing lines.static booleanSplit selected annotation objects with area ROIs using dividing lines extracted from annotations objects with line ROIs, then remove the lines from the object hierarchy.static booleansplitSelectedAnnotationAreasByLines(double thickness, boolean removeLines) Split selected annotation objects with area ROIs using dividing lines extracted from annotations objects with line ROIs, with an optional line thickness and optionally removing the dividing lines.static booleansplitSelectedAnnotationAreasByLines(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Split selected annotation objects with area ROIs using dividing lines extracted from annotations objects with line ROIs, then remove the lines from the object hierarchy.static booleansplitSelectedAnnotationAreasByLines(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, double thickness, boolean removeLines) Split selected annotation objects with area ROIs using dividing lines extracted from annotations objects with line ROIs, with an optional line thickness and optionally removing the dividing lines.static booleansplitSpecifiedAreasByLines(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, Collection<? extends qupath.lib.objects.PathObject> pathObjects, double thickness, boolean removeLines) Split the specified objects with area ROIs using dividing lines extracted from specified objects with line ROIs, with an optional line thickness and optionally removing the dividing lines.static voidtransformAllObjects(AffineTransform transform) Apply an affine transform to all selected objects in the current hierarchy.static voidtransformAllObjects(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, AffineTransform transform) Apply an affine transform to all selected objects in the specified hierarchy.static voidtransformSelectedObjects(AffineTransform transform) Apply an affine transform to all objects in the current hierarchy, retaining parent-child relationships between objects.static voidtransformSelectedObjects(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, AffineTransform transform) Apply an affine transform to all objects in the specified hierarchy, retaining parent-child relationships between objects.static voidtranslateAllObjects(double dx, double dy) Translate (move) the ROIs of all objects in the current object hierarchy.static voidtranslateAllObjects(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, double dx, double dy) Translate (move) the ROIs of all objects in the specified object hierarchy.static voidwriteDensityMapImage(String densityMapName, String path) Write the output of applying a density map to the current image image.static voidwriteDensityMapImage(qupath.lib.images.ImageData<BufferedImage> imageData, DensityMaps.DensityMapBuilder densityMap, String path) Write the output of applying a density map to an image.static voidwriteImage(BufferedImage img, String path) Write an image to the specified path.static voidwriteImage(qupath.lib.images.servers.ImageServer<BufferedImage> server, String path) Write a full image to the specified path.static voidwriteImageRegion(qupath.lib.images.servers.ImageServer<BufferedImage> server, qupath.lib.regions.RegionRequest request, String path) Write an image region image to the specified path.static voidwritePredictionImage(String classifierName, String path) Write the output of applying a pixel classifier to the current image image.static voidwritePredictionImage(qupath.lib.images.ImageData<BufferedImage> imageData, qupath.lib.classifiers.pixel.PixelClassifier classifier, String path) Write the output of applying a pixel classifier to an image.
-
Field Details
-
BRIGHTFIELD_H_DAB
public static final qupath.lib.images.ImageData.ImageType BRIGHTFIELD_H_DABBrightfield image type with hematoxylin and DAB staining -
BRIGHTFIELD_H_E
public static final qupath.lib.images.ImageData.ImageType BRIGHTFIELD_H_EBrightfield image type with hematoxylin and eosin staining -
BRIGHTFIELD_OTHER
public static final qupath.lib.images.ImageData.ImageType BRIGHTFIELD_OTHERBrightfield image type -
FLUORESCENCE
public static final qupath.lib.images.ImageData.ImageType FLUORESCENCEFluorescence image type -
OTHER
public static final qupath.lib.images.ImageData.ImageType OTHERAny other image type (neither brightfield nor fluorescence) -
PROJECT_BASE_DIR
Placeholder for the path to the current project. May be used as follows:var path = buildFilePath(PROJECT_BASE_DIR, 'subdir', 'name.txt')- See Also:
-
USER_HOME
The user's home directory, as obtained fromSystem.getProperty("user.home"). May be used as follows:var path = buildFilePath(USER_HOME, "Desktop", "file-on-desktop.txt") -
VERSION
public static final qupath.lib.common.Version VERSIONThe current QuPath version, parsed according to semantic versioning. May be null if the version is not known.
-
-
Constructor Details
-
QP
public QP()
-
-
Method Details
-
describe
List the fields and methods of a specified object.- Parameters:
o-- Returns:
-
describe
List the fields and methods of a specified class.- Parameters:
cls-- Returns:
-
getCoreClasses
Get a list of core classes that are likely to be useful for scripting. The purpose of this is to allow users to find classes they are likely to need, or to import these automatically at the beginning of scripts.- Returns:
-
setDefaultProject
Set the default project, which will be returned bygetProject()if it would otherwise return null (i.e. there has been no project set for the calling thread viasetBatchProjectAndImage(Project, ImageData)).The intended use is for QuPath to set this to be the current project in the user interface, when running interactively.
- Parameters:
project-
-
setDefaultImageData
Set the default image data, which will be returned bygetCurrentImageData()if it would otherwise return null (i.e. there has been no project set for the calling thread viasetBatchProjectAndImage(Project, ImageData)).The intended use is for QuPath to set this to be the current image data in the user interface, when running interactively. This is not necessarily always the image that is 'current' when running scripts, e.g. when batch processing.
- Parameters:
imageData-
-
setBatchProjectAndImage
public static void setBatchProjectAndImage(qupath.lib.projects.Project<BufferedImage> project, qupath.lib.images.ImageData<BufferedImage> imageData) Set theProjectandImageDatato use for batch processing for the current thread.- Parameters:
project-imageData-
-
resetBatchProjectAndImage
public static void resetBatchProjectAndImage()Reset theProjectandImageDataused for batch processing for the current thread. -
loadImageData
@Deprecated public static qupath.lib.images.ImageData<BufferedImage> loadImageData(String path, boolean setBatchData) throws IOException Deprecated.Load ImageData from a file.- Parameters:
path- path to the file containing ImageData.setBatchData- if true, thesetBatchImageData(ImageData)will be called if the loading is successful.- Returns:
- Throws:
IOException- See Also:
-
fireHierarchyUpdate
public static void fireHierarchyUpdate()Trigger an update for the current hierarchy.This should be called after any (non-standard) modifications are made to the hierarchy to ensure that all listeners are notified (including for any GUI).
It is common to call it at the end of any script that does any direct modification of objects (e.g. adding/removing measurements, setting classifications).
-
fireHierarchyUpdate
public static void fireHierarchyUpdate(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Trigger an update for the specified hierarchy.This should be called after any (non-standard) modifications are made to the hierarchy to ensure that all listeners are notified (including for any GUI).
It is common to call it at the end of any script that does any direct modification of objects (e.g. adding/removing measurements, setting classifications).
- Parameters:
hierarchy-
-
getColorRGB
Deprecated.Use insteadmakeRGB(int, int, int)ormakeARGB(int, int, int, int)Create a new packed-int representation of an RGB color.- Parameters:
v- A value between 0 and 255. If a single value is give, the result will be a shade of gray (RGB all with that value). Otherwise, 3 or 4 values may be given to generate either an RGB or RGBA color. Note: values are expected in order RGBA, but Java's packed ints are really ARGB.- Returns:
-
makeRGB
Make a packed int representation of an RGB color. Alpha defaults to 255. Red, green and blue values should be in the range 0-255; if they are not, they will be clipped.- Parameters:
r-g-b-- Returns:
-
makeARGB
Make a packed int representation of an ARGB color. Alpha, red, green and blue values should be in the range 0-255; if they are not, they will be clipped.- Parameters:
a-r-g-b-- Returns:
-
getCurrentServerPath
Get the path to theImageServerof the currentImageData.- Returns:
- See Also:
-
getCurrentImageData
Get the path to the currentImageData.This returns
getBatchImageData()if it is not null; otherwise, it returns the default image data last set throughsetDefaultImageData(ImageData).- Returns:
- See Also:
-
getProject
Get the current project.This returns
getBatchProject()if it is not null; otherwise, it returns the default project last set throughsetDefaultProject(Project).- Returns:
- See Also:
-
resolvePath
Resolve a path, replacing any placeholders. Currently, this means onlyPROJECT_BASE_DIR.- Parameters:
path-- Returns:
- Throws:
IllegalArgumentException- ifPROJECT_BASE_DIRis used but no project is available
-
buildFilePath
Build a file path from multiple components. A common use of this is
although that can now be replaced byString path = buildFilePath(PROJECT_BASE_DIR, "export");buildPathInProject(String...)- Parameters:
first- the first component of the file pathmore- additional path components to append- Returns:
- Throws:
IllegalArgumentException- ifPROJECT_BASE_DIRis used but no project is available- See Also:
-
buildPathInProject
Build a file or directory path relative to the current project, but do not make any changes on the file system. This is equivalent to callingIf you want to additionally create the directory, seeString path = buildFilePath(PROJECT_BASE_DIR, more);makePathInProject(String...)- Parameters:
parts- additional path components to append- Returns:
- Throws:
IllegalArgumentException- if no project path is available- Since:
- v0.4.0
- See Also:
-
createDirectory
Build a path to a directory, and create the directory if it does not already exist.This is an alternative to calling
Note that the path that is returned will end with a separator, e.g.var path = buildFilePath("first", "second"); mkdirs(path);"/path/to/dir/"rather than"/path/to/dir". This is to permit string concatenation as a way to create a full file path.- Parameters:
first- the first component of the file pathmore- additional path components to append- Returns:
- a path to the directory, ending with a suitable separator
- Since:
- v0.6.0
- See Also:
-
createDirectoryInProject
Build a path to a directory, and create the directory if it does not already exist.This is an alternative to calling
Note that the path that is returned will end with a separator, e.g.var path = buildFilePath("first", "second"); mkdirs(path);"/path/to/dir/"rather than"/path/to/dir". This is to permit string concatenation as a way to create a full file path.- Parameters:
parts- additional path components to append- Returns:
- a path to the directory, ending with a suitable separator
- Since:
- v0.6.0
- See Also:
-
makePathInProject
Deprecated.v0.6.0, usecreateDirectoryInProject(String...)instead.Build a file or directory path relative to the current project, and ensure that it exists. If it does not, an attempt will be made to create a directory with the specified name, and all necessary parent directories. This is equivalent to callingNote that if you need a file and not a directory, seeString path = buildPathInProject(PROJECT_BASE_DIR, more); mkdirs(path);makeFileInProject(String...).- Parameters:
more- additional path components to append- Returns:
- a string representing the path
- Throws:
IllegalArgumentException- if no project path is available- Since:
- v0.4.0
- See Also:
-
makeFileInProject
Build a file path relative to the current project, and create aFileobject. An attempt will be made to create any required directories needed to create the file.The purpose is to reduce the lines of code needed to build a usable file in a QuPath script. An example of this method in action:
Note that, if the file does not already exist, it will not be created by this method - only the directories leading to it. Additionally, if the file refers to an existing directory then the directory will be returned - and will not be writable as a file.File file = makeFileInProject("export", "file.txt"); file.text = "Some text here";- Parameters:
more- additional path components to append- Returns:
- the file object, which may or may not refer to a file or directory that exists
- Throws:
IllegalArgumentException- if no project path is available- Since:
- v0.4.0
- See Also:
-
mkdirs
Ensure directories exist for the specified path, callingfile.mkdirs()if not.- Parameters:
path- the directory path- Returns:
- true if a directory was created, false otherwise
-
fileExists
Query if a file exists.- Parameters:
path- full file path- Returns:
- true if the file exists, false otherwise
-
isDirectory
Query if a file path corresponds to a directory.- Parameters:
path- full file path- Returns:
- true if the file exists and is a directory, false otherwise
-
getProjectEntry
Get the project entry for the currently-open image within the current project, or null if no project/image is open.- Returns:
-
getProjectEntryMetadataValue
Get the metadata value from the current project entry for the specified key, or null if no such metadata value exists (or no project entry is open).- Parameters:
key-- Returns:
-
getCurrentHierarchy
public static qupath.lib.objects.hierarchy.PathObjectHierarchy getCurrentHierarchy()Get thePathObjectHierarchyof the currentImageData.- Returns:
- See Also:
-
getCurrentServer
public static qupath.lib.images.servers.ImageServer<?> getCurrentServer()Get theImageServerof the currentImageData.- Returns:
- See Also:
-
getCurrentImageName
Get the name of the current image.This first checks the name associated with
getProjectEntry(), if available. If no name is found (e.g. because no project is in use, then the name is extracted from the metadata ofgetCurrentServer(). If this is also missing, thennullis returned.- Returns:
- Since:
- v0.4.0
- See Also:
-
getCurrentImageNameWithoutExtension
Get the name of the current image, removing any file extension. Equivalent tovar name = GeneralTools.getNameWithoutExtension(getCurrentName());- Returns:
- Since:
- v0.4.0
- See Also:
-
getSelectedObjects
Get the selected objects within the currentPathObjectHierarchy.Note: this implementation returns the selected objects directly. The returned collection may not be modifiable.
- Returns:
- See Also:
-
getSelectedObject
public static qupath.lib.objects.PathObject getSelectedObject()Get the primary selected object within the currentPathObjectHierarchy.- Returns:
- See Also:
-
getSelectedROI
public static qupath.lib.roi.interfaces.ROI getSelectedROI()Get theROIfor the primary selected object within the currentPathObjectHierarchy.This is really a convenience method where the selection indicates (for example) a region that should be extracted.
- Returns:
- See Also:
-
resetSelection
public static void resetSelection()Unselect the selected objects for the currentPathObjectHierarchy. -
setSelectedObject
public static boolean setSelectedObject(qupath.lib.objects.PathObject pathObject) Set the selected object for the currentPathObjectHierarchy.- Parameters:
pathObject- the object to select.- Returns:
- See Also:
-
addObject
public static void addObject(qupath.lib.objects.PathObject pathObject) Add the specified object to the currentPathObjectHierarchy.This will trigger a hierarchy changed event.
- Parameters:
pathObject-
-
addObjects
public static void addObjects(qupath.lib.objects.PathObject... pathObjects) Add the specified array of objects to the currentPathObjectHierarchy.This will trigger a hierarchy changed event.
- Parameters:
pathObjects-
-
addObjects
Add the specified collection of objects to the currentPathObjectHierarchy.This will trigger a hierarchy changed event.
- Parameters:
pathObjects-
-
removeObject
@Deprecated(since="0.6.0") public static void removeObject(qupath.lib.objects.PathObject pathObject, boolean keepChildren) Deprecated.Remove the specified object from the currentPathObjectHierarchy, optionally keeping or removing descendant objects.- Parameters:
pathObject-keepChildren-
-
removeObject
public static void removeObject(qupath.lib.objects.PathObject pathObject) Remove the specified object from the currentPathObjectHierarchy, keeping any descendant objects.- Parameters:
pathObject-- Since:
- v0.6.0
-
removeObjectAndDescendants
public static void removeObjectAndDescendants(qupath.lib.objects.PathObject pathObject) Remove the specified object and any descendant objects from the currentPathObjectHierarchy.- Parameters:
pathObject-- Since:
- v0.6.0
-
removeObjects
@Deprecated(since="0.6.0") public static void removeObjects(qupath.lib.objects.PathObject[] pathObjects, boolean keepChildren) Deprecated.UseremoveObjects(PathObject[])orremoveObjectsAndDescendants(PathObject[])instead.Remove the specified array of objects from the currentPathObjectHierarchy, optionally keeping or removing descendant objects.- Parameters:
pathObjects-keepChildren-
-
nObjects
public static int nObjects()Get a count of the total number of objects in the current hierarchy.- Returns:
- See Also:
-
removeObjects
@Deprecated(since="0.6.0") public static void removeObjects(Collection<? extends qupath.lib.objects.PathObject> pathObjects, boolean keepChildren) Deprecated.UseremoveObjects(Collection)orremoveObjectsAndDescendants(Collection)instead.Remove the specified collection of objects from the currentPathObjectHierarchy, optionally keeping or removing descendant objects.- Parameters:
pathObjects-keepChildren-
-
removeObjects
public static void removeObjects(qupath.lib.objects.PathObject... pathObjects) Remove the specified array of objects from the currentPathObjectHierarchy. Descendant objects are kept.- Parameters:
pathObjects- the objects to remove- Since:
- v0.6.0
-
removeObjectsAndDescendants
public static void removeObjectsAndDescendants(qupath.lib.objects.PathObject... pathObjects) Remove the specified array of objects from the currentPathObjectHierarchy, and all their descendants.- Parameters:
pathObjects- the objects to remove- Since:
- v0.6.0
-
removeObjects
Remove the specified collection of objects from the currentPathObjectHierarchy. Descendant objects are kept.- Parameters:
pathObjects- the objects to remove- Since:
- v0.6.0
-
removeObjectsAndDescendants
public static void removeObjectsAndDescendants(Collection<? extends qupath.lib.objects.PathObject> pathObjects) Remove the specified collection of objects from the currentPathObjectHierarchy, and all their descendants.- Parameters:
pathObjects- the objects to remove- Since:
- v0.6.0
-
isTMADearrayed
public static boolean isTMADearrayed()Returnstrueif TMA cores are available.- Returns:
-
clearAllObjects
Deprecated.For naming consistency; use #removeAllObjects instead.Remove all the objects in the currentPathObjectHierarchy, and clear the selection.- See Also:
-
removeAllObjects
public static void removeAllObjects()Remove all the objects in the currentPathObjectHierarchy, and reset the selection.- See Also:
-
clearAllObjects
@Deprecated(since="0.6.0") public static void clearAllObjects(Class<? extends qupath.lib.objects.PathObject> cls) Deprecated.For naming consistency; use #removeAllObjects instead.Remove all the objects of a specified Java class.- Parameters:
cls- the class, e.g.PathAnnotationObject.class,PathDetectionObject.class, ornullif all objects should be removed.- See Also:
-
removeAllObjects
Remove all the objects of a specified Java class.- Parameters:
cls- the class, e.g.PathAnnotationObject.class,PathDetectionObject.class, ornullif all objects should be removed.- See Also:
-
clearAnnotations
Deprecated.For naming consistency; use #removeAnnotations instead.Remove all the annotation objects from the currentPathObjectHierarchy.- See Also:
-
removeAnnotations
public static void removeAnnotations()Remove all the annotation objects from the currentPathObjectHierarchy.- See Also:
-
clearDetections
Deprecated.For naming consistency; use #removeDetections instead.Remove all the detection objects from the currentPathObjectHierarchy.- See Also:
-
removeDetections
public static void removeDetections()Remove all the detection objects from the currentPathObjectHierarchy.- See Also:
-
clearTMAGrid
Deprecated.For naming consistency; use #removeTMAGrid instead.Remove the TMA grid from the currentPathObjectHierarchy.- See Also:
-
removeTMAGrid
public static void removeTMAGrid()Remove the TMA grid from the currentPathObjectHierarchy.- See Also:
-
addShapeMeasurements
Add the specified shape measurements to the current selected objects of the current image. If no features are specified, all will be added.- Parameters:
features-
-
addShapeMeasurements
public static void addShapeMeasurements(qupath.lib.images.ImageData<?> imageData, Collection<? extends qupath.lib.objects.PathObject> pathObjects, String feature, String... additionalFeatures) Add shape measurements to the specified objects.Note
addShapeMeasurements(ImageData, Collection, ShapeFeatures...)can be used without specifying any features. This method requires at least one feature so as to have a distinct method signature.- Parameters:
imageData- the image to which the objects belong. This is used to determine pixel calibration and to fire an update event. May be null.pathObjects- the objects that should be measuredfeature- first feature to addadditionalFeatures- optional array of Strings specifying the features to add
-
addShapeMeasurements
public static void addShapeMeasurements(qupath.lib.images.ImageData<?> imageData, Collection<? extends qupath.lib.objects.PathObject> pathObjects, ObjectMeasurements.ShapeFeatures... features) Add shape measurements to the specified objects.- Parameters:
imageData- the image to which the objects belong. This is used to determine pixel calibration and to fire an update event. May be null.pathObjects- the objects that should be measuredfeatures- the specific features to add. If none are specified, all available features will be added.
-
setChannelNames
Set the channel names for the current ImageData.- Parameters:
names-- See Also:
-
setChannelNames
Set the channel names for the specified ImageData. It is not essential to pass names for all channels: by passing n values, the first n channel names will be set. Any name that is null will be left unchanged.- Parameters:
imageData-names-
-
setChannelColors
Set the channel colors for the current ImageData.- Parameters:
colors-- See Also:
-
setChannelColors
Set the channel colors for the specified ImageData. It is not essential to pass names for all channels: by passing n values, the first n channel names will be set. Any name that is null will be left unchanged.- Parameters:
imageData-colors-- See Also:
-
setChannels
public static void setChannels(qupath.lib.images.servers.ImageChannel... channels) Set the channels for the current ImageData.- Parameters:
channels-- See Also:
-
setChannels
public static void setChannels(qupath.lib.images.ImageData<?> imageData, qupath.lib.images.servers.ImageChannel... channels) Set the channels for the specified ImageData. Note that number of channels provided must match the number of channels of the current image.- Parameters:
imageData-channels-- See Also:
-
runPlugin
Run the specified plugin on the currentImageData.- Parameters:
className- the full Java class name for the pluginargs- any arguments required by the plugin (usually a JSON-encoded map)- Returns:
- Throws:
InterruptedException- See Also:
-
runPlugin
public static boolean runPlugin(String className, qupath.lib.images.ImageData<?> imageData, String args) throws InterruptedException Run the specified plugin on the specifiedImageData.- Parameters:
className- the full Java class name for the pluginimageData- the ImageData to which the plugin should be appliedargs- any arguments required by the plugin (usually a JSON-encoded map)- Returns:
- Throws:
InterruptedException
-
runPlugin
Run the specified plugin on the currentImageData, using a map for arguments.- Parameters:
className- the full Java class name for the pluginargs- the arguments- Returns:
- Throws:
InterruptedException- Since:
- v0.4.0
- See Also:
- Implementation Note
- this is currently a convenience method that converts the arguments to a JSON-encoded string and calls
runPlugin(String, String)
-
runPlugin
public static boolean runPlugin(String className, qupath.lib.images.ImageData<?> imageData, Map<String, ?> args) throws InterruptedExceptionRun the specified plugin on the specifiedImageData, using a map for arguments.- Parameters:
className- the full Java class name for the pluginimageData- the ImageData to which the plugin should be appliedargs- the arguments- Returns:
- Throws:
InterruptedException- Since:
- v0.4.0
- Implementation Note
- this is currently a convenience method that converts the arguments to a JSON-encoded string and calls
runPlugin(String, ImageData, String)
-
runPlugin
Run the specified plugin on the currentImageData, with Groovy keyword argument support.This reason is that this Groovy supports keyword arguments, but only if a
Mapis the first argument to a method. This therefore makes it possible to change only non-default arguments with a call like this:
It is not even essential to provide the requiredrunPlugin('qupath.imagej.detect.cells.WatershedCellDetection', cellExpansionMicrons: 3, detectionImage: "DAPI", threshold: 1.0)classNamein the first position.- Parameters:
args- the argumentsclassName- the full Java class name for the plugin- Returns:
- Throws:
InterruptedException- Since:
- v0.4.0
- Implementation Note
- this calls
runPlugin(String, Map)
-
runPlugin
public static boolean runPlugin(Map<String, ?> args, String className, qupath.lib.images.ImageData<?> imageData) throws InterruptedExceptionRun the specified plugin on the specifiedImageData, with Groovy keyword argument support.This reason is that this Groovy supports keyword arguments, but only if a
Mapis the first argument to a method. This therefore makes it possible to change only non-default arguments with a call like this:
It is not even essential to provide the requiredrunPlugin('qupath.imagej.detect.cells.WatershedCellDetection', imageData, cellExpansionMicrons: 3, detectionImage: "DAPI", threshold: 1.0)classNamein the first position.- Parameters:
args- the argumentsclassName- the full Java class name for the pluginimageData-- Returns:
- Throws:
InterruptedException- Since:
- v0.4.0
- Implementation Note
- this calls
runPlugin(String, ImageData, Map)
-
getTMACoreList
Get the list of TMA core objects for the current hierarchy.- Returns:
- the list of
TMACoreObjects, or an empty list if there is no TMA grid present. - See Also:
-
getAnnotationObjects
Get a list of the current annotation objects.- Returns:
- See Also:
-
getDetectionObjects
Get a list of the current detection objects.- Returns:
- See Also:
-
getTileObjects
Get a list of the current tile objects.- Returns:
- Since:
- v0.4.0
- See Also:
-
getCellObjects
Get a list of the current cell objects.- Returns:
- See Also:
-
getAllObjects
Get all objects in the current hierarchy.- Parameters:
includeRootObject-- Returns:
- See Also:
-
getAllObjectsWithoutRoot
Get all objects in the current hierarchy, excluding the root object (which represents the entire image).- Returns:
- Since:
- v0.6.0
- See Also:
-
getAllObjects
Get all objects in the current hierarchy, including the root object (which represents the entire image).- Returns:
- See Also:
-
setImageType
Set the image type for the current image data, using a String to represent the enumImageData.ImageType- Parameters:
typeName-- Returns:
-
setImageType
public static boolean setImageType(qupath.lib.images.ImageData.ImageType type) Set the image type for the current image data- Parameters:
type-- Returns:
-
setColorDeconvolutionStains
Set the color deconvolution stains for hte current image data using a (JSON) String representation- Parameters:
arg-- Returns:
-
setColorDeconvolutionStains
Set the color deconvolution stains for the current image data.- Parameters:
stains- a map of stain name to stain values. Each stain value must be a list containing at least three elements (otherwise the value is skipped). A stain must be provided with the name defined byColorDeconvolutionStains.BACKGROUND_KEY. A stain with the name defined byColorDeconvolutionStains.RESIDUAL_KEYwill be set asresidual, others won't. The order of the map matters: the first entry will be the first stain (unless it's the background), and so on.name- the name of the color deconvolution stains- Throws:
IllegalStateException- if there is no current image dataIllegalArgumentException- if the provided stains do not contain a stain with the name defined byColorDeconvolutionStains.BACKGROUND_KEYand with at least three values, or if the provided stains do not contain at least two non-ColorDeconvolutionStains.BACKGROUND_KEYstains with at least three valuesNullPointerException- if one of the parameter is null
-
createSelectAllObject
Deprecated.v0.4.0 usecreateFullImageAnnotation(boolean)insteadCreate an annotation for the entire width and height of the current image data, on the default plane (z-slice, time point).- Parameters:
setSelected- if true, select the object that was created after it is added to the hierarchy
-
createSelectAllObject
Deprecated.v0.4.0 usecreateFullImageAnnotation(boolean, int, int)insteadCreate an annotation for the entire width and height of the current image data, on the default plane (z-slice, time point).- Parameters:
setSelected- if true, select the object that was created after it is added to the hierarchyz- z-slice index for the annotationt- timepoint index for the annotation
-
createAllFullImageAnnotations
public static List<qupath.lib.objects.PathObject> createAllFullImageAnnotations(boolean setSelected) Create annotation around the full image for the current image, on all z-slices and timepoints.- Parameters:
setSelected- if true, set the annotations to be selected when they are created- Returns:
- the annotations that were created, or an empty list if no image data was available
- Since:
- v0.4.0
- See Also:
-
createAllFullImageAnnotations
public static List<qupath.lib.objects.PathObject> createAllFullImageAnnotations(qupath.lib.images.ImageData<?> imageData, boolean setSelected) Create annotation around the full image for the specified image, on all z-slices and timepoints.- Parameters:
imageData- the image datasetSelected- if true, set the annotations to be selected when they are created- Returns:
- the annotations that were created, or an empty list if no image data was available
- Since:
- v0.4.0
-
createFullImageAnnotation
public static qupath.lib.objects.PathObject createFullImageAnnotation(boolean setSelected) Create an annotation around the full image for the current image, on the default (first) z-slice and timepoint.- Parameters:
setSelected- if true, set the annotation to be selected when it is created- Returns:
- the annotation that was created, or null if no image data was available
- Since:
- v0.4.0
- See Also:
-
createFullImageAnnotation
public static qupath.lib.objects.PathObject createFullImageAnnotation(boolean setSelected, int z, int t) Create an annotation around the full image for the current image, on the specified z-slice and timepoint.- Parameters:
setSelected- if true, set the annotation to be selected when it is createdz- z-slice (0-based index)t- timepoint (0-based index)- Returns:
- the annotation that was created, or null if no image data was available
- Since:
- v0.4.0
- See Also:
-
createFullImageAnnotation
public static qupath.lib.objects.PathObject createFullImageAnnotation(qupath.lib.images.ImageData<?> imageData, boolean setSelected) Create an annotation around the full image for the specified image, on the default (first) z-slice and timepoint.- Parameters:
imageData- the image data for which the annotation should be addedsetSelected- if true, set the annotation to be selected when it is created- Returns:
- the annotation that was created, or null if no image data was available
- Since:
- v0.4.0
-
createFullImageAnnotation
public static qupath.lib.objects.PathObject createFullImageAnnotation(qupath.lib.images.ImageData<?> imageData, boolean setSelected, int z, int t) Create an annotation around the full image for the specified image, on the specified z-slice and timepoint.- Parameters:
imageData- the image data for which the annotation should be addedsetSelected- if true, set the annotation to be selected when it is createdz- z-slice (0-based index)t- timepoint (0-based index)- Returns:
- the annotation that was created, or null if no image data was available
- Since:
- v0.4.0
-
buildServer
@Deprecated public static <T> qupath.lib.images.servers.ImageServer<T> buildServer(String path, Class<T> cls, String... args) throws IOException Deprecated.In the usual case whereBufferedImageis the class, usebuildServer(String, String...)instead because it handles default args.Build anImageServerwith a specified class.- Parameters:
path- image path (usually a file path or URI)cls- generic type for the server (usually BufferedImage)args- optional arguments- Returns:
- an
ImageServer, if one could be build from the supplied arguments - Throws:
IOException- if unable to build the server- See Also:
-
buildServer
public static qupath.lib.images.servers.ImageServer<BufferedImage> buildServer(String path, String... args) throws IOException Build anImageServerwith the classBufferedImage.- Parameters:
path- image path (usually a file path or URI)args- optional arguments- Returns:
- an
ImageServer, if one could be build from the supplied arguments - Throws:
IOException- if unable to build the server- See Also:
- API Note
- In v0.3 the behavior of this method changed to support more default arguments.
-
buildServer
public static qupath.lib.images.servers.ImageServer<BufferedImage> buildServer(URI uri, String... args) throws IOException Build anImageServerwith the classBufferedImage.- Parameters:
uri- image URIargs- optional arguments- Returns:
- an
ImageServer, if one could be build from the supplied arguments - Throws:
IOException- if unable to build the server- Since:
- v0.3
- See Also:
-
transformSelectedObjects
Apply an affine transform to all objects in the current hierarchy, retaining parent-child relationships between objects.- Parameters:
transform-- Since:
- v0.4.0
- Implementation Note
- Currently, existing objects will be removed, and replaced with new ones that have had their ROIs transformed and the same IDs retained. However it is best not to rely upon this behavior; it is possible that in the future the ROIs will be updated in-place to improve efficiency.
-
transformSelectedObjects
public static void transformSelectedObjects(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, AffineTransform transform) Apply an affine transform to all objects in the specified hierarchy, retaining parent-child relationships between objects.- Parameters:
hierarchy-transform-- Since:
- v0.4.0
- Implementation Note
- Currently, existing objects will be removed, and replaced with new ones that have had their ROIs transformed and the same IDs retained. However it is best not to rely upon this behavior; it is possible that in the future the ROIs will be updated in-place to improve efficiency.
-
scaleAllObjects
public static void scaleAllObjects(double scaleFactor) Resize the ROIs of all objects in the current object hierarchy.- Parameters:
scaleFactor- scale factor- Since:
- v0.4.0
- See Also:
-
scaleAllObjects
public static void scaleAllObjects(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, double scaleFactor) Resize the ROIs of all objects in the specified object hierarchy.- Parameters:
hierarchy- the object hierarchyscaleFactor- scale factor- Since:
- v0.4.0
- See Also:
-
translateAllObjects
public static void translateAllObjects(double dx, double dy) Translate (move) the ROIs of all objects in the current object hierarchy.- Parameters:
dx- amount to translate horizontally (in pixels)dy- amount to translate vertically (in pixels)- Since:
- v0.4.0
- See Also:
-
translateAllObjects
public static void translateAllObjects(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, double dx, double dy) Translate (move) the ROIs of all objects in the specified object hierarchy.- Parameters:
hierarchy- the object hierarchydx- amount to translate horizontally (in pixels)dy- amount to translate vertically (in pixels)- Since:
- v0.4.0
- See Also:
-
transformAllObjects
Apply an affine transform to all selected objects in the current hierarchy. The selected objects will be replaced by new ones, but parent-child relationships will be lost; if these are needed, consider callingresolveHierarchy()afterwards.- Parameters:
transform-- Since:
- v0.4.0
- Implementation Note
- Currently, existing objects will be removed, and replaced with new ones that have had their ROIs transformed and the same IDs retained. However it is best not to rely upon this behavior; it is possible that in the future the ROIs will be updated in-place to improve efficiency.
-
transformAllObjects
public static void transformAllObjects(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, AffineTransform transform) Apply an affine transform to all selected objects in the specified hierarchy. The selected objects will be replaced by new ones, but parent-child relationships will be lost; if these are needed, consider callingresolveHierarchy(PathObjectHierarchy)afterwards.- Parameters:
hierarchy-transform-- Since:
- v0.4.0
- Implementation Note
- Currently, existing objects will be removed, and replaced with new ones that have had their ROIs transformed and the same IDs retained. However it is best not to rely upon this behavior; it is possible that in the future the ROIs will be updated in-place to improve efficiency.
-
resetTMAMetadata
public static void resetTMAMetadata(boolean includeMeasurements) Remove all TMA metadata from the current TMA grid.- Parameters:
includeMeasurements- remove measurements in addition to textual metadata
-
resetTMAMetadata
public static void resetTMAMetadata(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, boolean includeMeasurements) Remove all TMA metadata from the TMA grid of the specified hierarchy.- Parameters:
hierarchy-includeMeasurements- remove measurements in addition to textual metadata
-
relabelTMAGrid
public static boolean relabelTMAGrid(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, String labelsHorizontal, String labelsVertical, boolean rowFirst) Relabel a TMA grid. This will only be effective if enough labels are supplied for the full grid - otherwise no changes will be made.For a TMA core at column c and row r, the label format will be 'Hc-Vr' or 'Hc-Vr', where H is the horizontal label and V the vertical label, depending upon the status of the 'rowFirst' flag.
An examples of label would be 'A-1', 'A-2', 'B-1', 'B-2' etc.
- Parameters:
hierarchy- The hierarchy containing the TMA grid to be relabelled.labelsHorizontal- A String containing labels for each TMA column, separated by spaces, or a numeric or alphabetic range (e.g. 1-10, or A-G)labelsVertical- A String containing labels for each TMA row, separated by spaces, or a numeric or alphabetic range (e.g. 1-10, or A-G)rowFirst- true if the horizontal label should be added before the vertical label, false otherwise- Returns:
- true if there were sufficient horizontal and vertical labels to label the entire grid, false otherwise.
-
relabelTMAGrid
public static boolean relabelTMAGrid(String labelsHorizontal, String labelsVertical, boolean rowFirst) Relabel the current TMA grid. SeerelabelTMAGrid(PathObjectHierarchy, String, String, boolean)- Parameters:
labelsHorizontal-labelsVertical-rowFirst-- Returns:
-
createTMAGrid
public static void createTMAGrid(qupath.lib.images.ImageData<?> imageData, String hLabels, String vLabels, boolean rowFirst, double diameterCalibrated) Create a new regularTMAGridand set it as active on the hierarchy for an image.For the label string format, see see
PathObjectTools.parseTMALabelString(String).- Parameters:
imageData- the image to which the TMA grid should be added. This is used to determine dimensions and pixel calibration. If there is a ROI selected, it will be used to define the bounding box for the grid.hLabels- a String representing horizontal labelsvLabels- a String representing vertical labelsrowFirst- true if the horizontal label should be added before the vertical label, false otherwisediameterCalibrated- the diameter of each core, in calibrated units- See Also:
-
createTMAGrid
public static void createTMAGrid(String hLabels, String vLabels, boolean rowFirst, double diameterCalibrated) Create a new regularTMAGridand set it as active on the hierarchy for the current image.For the label string format, see see
PathObjectTools.parseTMALabelString(String).- Parameters:
hLabels- a String representing horizontal labelsvLabels- a String representing vertical labelsrowFirst- true if the horizontal label should be added before the vertical label, false otherwisediameterCalibrated- the diameter of each core, in calibrated units- See Also:
-
resetClassifications
Reset the PathClass for all objects of the specified type in the current hierarchy.- Parameters:
cls-
-
refreshIDs
public static void refreshIDs()Refresh all object IDs for the current hierarchy.- Since:
- v0.4.0
-
refreshDuplicateIDs
public static boolean refreshDuplicateIDs()Refresh all object IDs for the current hierarchy to ensure there are no duplicates, retaining the original IDs where possible.- Returns:
- true if object IDs were changed, false otherwise
- Since:
- v0.4.0
-
refreshIDs
public static void refreshIDs(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Refresh all object IDs for the current hierarchy.- Parameters:
hierarchy- the object hierarchy- Since:
- v0.4.0
-
refreshDuplicateIDs
public static boolean refreshDuplicateIDs(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Refresh all object IDs for the current hierarchy to ensure there are no duplicates, retaining the original IDs where possible.- Parameters:
hierarchy- the object hierarchy- Returns:
- true if object IDs were changed, false otherwise
- Since:
- v0.4.0
-
resetClassifications
public static void resetClassifications(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, Class<? extends qupath.lib.objects.PathObject> cls) Reset the PathClass for all objects of the specified type in the specified hierarchy.- Parameters:
hierarchy-cls-
-
resetDetectionClassifications
public static void resetDetectionClassifications()Reset the PathClass for all detection objects in the current hierarchy. -
hasMeasurement
public static boolean hasMeasurement(qupath.lib.objects.PathObject pathObject, String measurementName) Test whether a PathObject has a specified measurement in its measurement list.- Parameters:
pathObject-measurementName-- Returns:
-
measurement
Extract the specified measurement from a PathObject.- Parameters:
pathObject-measurementName-- Returns:
-
clearSelectedObjects
Deprecated.For consistency in naming; use #removeSelectedObjects instead.Clear selected objects, but keep child (descendant) objects. -
removeSelectedObjects
public static void removeSelectedObjects()Remove selected objects, but keep child (descendant) objects. -
clearSelectedObjects
Deprecated.For consistency in naming; use #removeSelectedObjects instead.Delete the selected objects from the current hierarchy, optionally keeping their child (descendant) objects.- Parameters:
keepChildren- Whether to retain or remove child objects in the hierarchy.
-
removeSelectedObjectsAndDescendants
public static void removeSelectedObjectsAndDescendants()Delete the selected objects from the current hierarchy, including all the child and descendant objects. -
getObjects
public static List<qupath.lib.objects.PathObject> getObjects(Predicate<qupath.lib.objects.PathObject> predicate) Get a list of all objects in the current hierarchy according to a specified predicate.- Parameters:
predicate-- Returns:
-
selectAllObjects
public static void selectAllObjects(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, boolean includeRootObject) Set selected objects to contain all objects.- Parameters:
hierarchy-includeRootObject-
-
selectAllObjects
public static void selectAllObjects(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Select all objects in the specified hierarchy, excluding the root object.- Parameters:
hierarchy-- Since:
- v0.4.0
-
selectAllObjects
public static void selectAllObjects()Select all objects in the current hierarchy, excluding the root object.- Since:
- v0.4.0
-
selectObjectsByPlane
public static void selectObjectsByPlane(int z, int t) Selected objects in the current hierarchy occurring on the specified z-slice and timepoint.- Parameters:
z- z-slice (0-based index)t- timepoint (0-based index)- Since:
- v0.4.0
- See Also:
-
selectObjectsByPlane
public static void selectObjectsByPlane(qupath.lib.regions.ImagePlane plane) Selected objects in the current hierarchy occurring on the specified plane (z-slice and timepoint).- Parameters:
plane-- Since:
- v0.4.0
- See Also:
-
selectObjectsByPlane
public static void selectObjectsByPlane(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, qupath.lib.regions.ImagePlane plane) Selected objects in the specified hierarchy occurring on the specified plane (z-slice and timepoint).- Parameters:
hierarchy-plane-- Since:
- v0.4.0
-
selectObjects
Set selected objects to contain (only) all objects in the current hierarchy according to a specified predicate.- Parameters:
predicate-
-
selectObjects
Set all objects in a collection to be selected, without any being chosen as the main object.- Parameters:
pathObjects-
-
selectObjects
public static void selectObjects(Collection<? extends qupath.lib.objects.PathObject> pathObjects, qupath.lib.objects.PathObject mainSelection) Set all objects in a collection to be selected, including a specified main selected object.- Parameters:
pathObjects-mainSelection-
-
selectObjects
public static void selectObjects(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, qupath.lib.objects.PathObject... pathObjects) Set one or more objects to be selected within the specified hierarchy.- Parameters:
hierarchy-pathObjects-
-
selectObjects
public static void selectObjects(qupath.lib.objects.PathObject... pathObjects) Set one or more objects to be selected within the current hierarchy.- Parameters:
pathObjects-
-
getObjects
public static List<qupath.lib.objects.PathObject> getObjects(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, Predicate<qupath.lib.objects.PathObject> predicate) Get a list of all objects in the specified hierarchy according to a specified predicate.- Parameters:
hierarchy-predicate-- Returns:
-
selectObjects
public static void selectObjects(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, Predicate<qupath.lib.objects.PathObject> predicate) Set selected objects to contain (only) all objects in the specified hierarchy according to a specified predicate.- Parameters:
hierarchy-predicate-
-
selectObjectsByClass
Set objects that are a subclass of a specified class. Not to be confused withselectObjectsByPathClass(PathClass...)andselectObjectsByClassification(String...).- Parameters:
cls-
-
selectObjectsByClass
public static void selectObjectsByClass(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, Class<? extends qupath.lib.objects.PathObject> cls) Set objects that are a subclass of a specified class. Not to be confused withselectObjectsByPathClass(PathObjectHierarchy, PathClass...)andselectObjectsByClassification(PathObjectHierarchy, String...).- Parameters:
hierarchy-cls-
-
selectAnnotations
public static void selectAnnotations(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Select all annotation objects in the specified hierarchy.- Parameters:
hierarchy-
-
selectTMACores
public static void selectTMACores(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Select all TMA core objects in the specified hierarchy, excluding missing cores.- Parameters:
hierarchy-
-
selectTMACores
public static void selectTMACores(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, boolean includeMissing) Select all TMA core objects in the specified hierarchy, optionally including missing cores.- Parameters:
hierarchy-includeMissing-
-
selectDetections
public static void selectDetections(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Select all detection objects in the specified hierarchy.- Parameters:
hierarchy-
-
selectCells
public static void selectCells(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Select all cell objects in the specified hierarchy.- Parameters:
hierarchy-
-
selectAnnotations
public static void selectAnnotations()Select all annotation objects in the current hierarchy. -
selectTMACores
public static void selectTMACores()Select all TMA core objects in the current hierarchy, excluding missing cores. -
selectTMACores
public static void selectTMACores(boolean includeMissing) Select all TMA core objects in the current hierarchy, optionally including missing cores.- Parameters:
includeMissing-
-
selectDetections
public static void selectDetections()Select all detection objects in the current hierarchy. -
selectCells
public static void selectCells()Select all cell objects in the current hierarchy. -
selectTiles
public static void selectTiles(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Select all tile objects in the specified hierarchy.- Parameters:
hierarchy-
-
selectTiles
public static void selectTiles()Select all tile objects in the current hierarchy. -
selectObjectsByClassification
Select objects for the current hierarchy that have one of the specified classifications.- Parameters:
pathClassNames- one or more classification names, which may be converted to aPathClasswithgetPathClass(String)
-
selectObjectsByPathClass
public static void selectObjectsByPathClass(qupath.lib.objects.classes.PathClass... pathClasses) Select objects for the current hierarchy that have one of the specifiedPathClassclassifications assigned.- Parameters:
pathClasses- one or more classifications- See Also:
-
selectObjectsByClassification
public static void selectObjectsByClassification(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, String... pathClassNames) Select objects for the specified hierarchy that have one of the specified classifications.- Parameters:
hierarchy- the hierarchy containing objects that may be selectedpathClassNames- one or more classification names, which may be converted to aPathClasswithgetPathClass(String)- See Also:
-
selectObjectsByPathClass
public static void selectObjectsByPathClass(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, qupath.lib.objects.classes.PathClass... pathClasses) Select objects for the specified hierarchy that have one of the specifiedPathClassclassifications assigned.- Parameters:
hierarchy- the hierarchy containing objects that may be selectedpathClasses- one or more classifications
-
selectObjectsByMeasurement
@Deprecated public static void selectObjectsByMeasurement(qupath.lib.images.ImageData<?> imageData, String command) Deprecated.Select objects based on a specified measurement.- Parameters:
imageData-command-
-
classifySelected
Set the classification of the selected objects in the current hierarchy.- Parameters:
pathClassName-
-
classifySelected
public static void classifySelected(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, String pathClassName) Set the classification of the selected objects.- Parameters:
hierarchy-pathClassName-
-
exportAllObjectsToGeoJson
public static void exportAllObjectsToGeoJson(String path, String option, String... additionalOptions) throws IOException Export all objects (excluding root object) to an output file as GeoJSON.- Parameters:
path-option-additionalOptions-- Throws:
IOException
-
exportAllObjectsToGeoJson
public static void exportAllObjectsToGeoJson(String path, qupath.lib.io.PathIO.GeoJsonExportOptions... options) throws IOException Export all objects (excluding root object) to an output file as GeoJSON.- Parameters:
path-options-- Throws:
IOException
-
exportSelectedObjectsToGeoJson
public static void exportSelectedObjectsToGeoJson(String path, String option, String... additionalOptions) throws IOException Export the selected objects to an output file as GeoJSON.- Parameters:
path-option-additionalOptions-- Throws:
IOException
-
exportSelectedObjectsToGeoJson
public static void exportSelectedObjectsToGeoJson(String path, qupath.lib.io.PathIO.GeoJsonExportOptions... options) throws IOException Export the selected objects to an output file as GeoJSON.- Parameters:
path-options-- Throws:
IOException
-
exportObjectsToGeoJson
public static void exportObjectsToGeoJson(Collection<? extends qupath.lib.objects.PathObject> pathObjects, String path, String option, String... additionalOptions) throws IOException Export specified objects to an output file as GeoJSON.- Parameters:
pathObjects-path-option-additionalOptions-- Throws:
IOException
-
exportObjectsToGeoJson
public static void exportObjectsToGeoJson(Collection<? extends qupath.lib.objects.PathObject> pathObjects, String path, qupath.lib.io.PathIO.GeoJsonExportOptions... options) throws IOException Export specified objects to an output file as GeoJSON.- Parameters:
pathObjects-path-options-- Throws:
IOException
-
importObjectsFromFile
public static boolean importObjectsFromFile(String path) throws FileNotFoundException, IllegalArgumentException, IOException, ClassNotFoundException Import allPathObjects from the given file.IllegalArgumentExceptionis thrown if the file is not compatible.
FileNotFoundExceptionis thrown if the file is not found.
IOExceptionis thrown if an error occurs while reading the file.
ClassNotFoundExceptionshould never occur naturally (except through a change in the code).- Parameters:
path-- Returns:
- success
- Throws:
FileNotFoundExceptionIllegalArgumentExceptionClassNotFoundExceptionIOException
-
deselectAll
public static void deselectAll()Reset the selection for the current hierarchy, so that no objects of any kind are selected. -
deselectAll
public static void deselectAll(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Reset the selection, so that no objects of any kind are selected.- Parameters:
hierarchy-
-
getPathClass
Get a PathClass with the specified name.- Parameters:
name-- Returns:
-
getPathClass
Get a PathClass with the specified name and color. Note that only one instance of any PathClass can exist at any time, therefore any existing PathClass with the same description will always be returned instead of creating a new one. In this case, the color attribute of the existing PathClass will not be changed. Therefore the color only has an effect when a new PathClass is created.- Parameters:
name-rgb-- Returns:
- See Also:
-
getDerivedPathClass
public static qupath.lib.objects.classes.PathClass getDerivedPathClass(qupath.lib.objects.classes.PathClass baseClass, String name) Get a PathClass with the specified name, derived from another PathClass. An example would be a 'positive' class derived from a 'Tumor' class, e.g.getDerivedPathClass(getPathClass("Tumor"), "Positive")- Parameters:
baseClass-name-- Returns:
-
getDerivedPathClass
public static qupath.lib.objects.classes.PathClass getDerivedPathClass(qupath.lib.objects.classes.PathClass baseClass, String name, Integer rgb) Get a PathClass with the specified name, derived from another PathClass. An example would be a 'positive' class derived from a 'Tumor' class, e.g.getDerivedPathClass(getPathClass("Tumor"), "Positive", getColorRGB(255, 0, 0))Note that only one instance of any PathClass can exist at any time, therefore any existing PathClass with the same description will always be returned instead of creating a new one. In this case, the color attribute of the existing PathClass will not be changed. Therefore, the color only has an effect when a new PathClass is created.- Parameters:
baseClass-name-rgb-- Returns:
-
removeMeasurements
public static void removeMeasurements(Class<? extends qupath.lib.objects.PathObject> cls, String... measurementNames) Remove measurements from objects of a specific class for the current image data.- Parameters:
cls- The type of object.measurementNames- The measurement names to remove.
-
removeMeasurements
public static void removeMeasurements(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, Class<? extends qupath.lib.objects.PathObject> cls, String... measurementNames) Remove measurements from objects of a specific class for the specified hierarchy.- Parameters:
hierarchy- The relevant hierarchy.cls- The type of object.measurementNames- The measurement names to remove.
-
clearMeasurements
@Deprecated(since="0.6.0") public static void clearMeasurements(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, qupath.lib.objects.PathObject... pathObjects) Deprecated.For consistency in naming; use #removeMeasurements instead.Clear the measurement lists for specified objects within a hierarchy.- Parameters:
hierarchy- used to fire a hierarchy update, if specified (may be null if no update should be fired)pathObjects- collection of objects that should have their measurement lists cleared
-
removeMeasurements
public static void removeMeasurements(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, qupath.lib.objects.PathObject... pathObjects) Remove the measurements from specified objects within a hierarchy.- Parameters:
hierarchy- used to fire a hierarchy update, if specified (may be null if no update should be fired)pathObjects- collection of objects that should have their measurements removed.
-
clearMeasurements
@Deprecated(since="0.6.0") public static void clearMeasurements(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, Collection<? extends qupath.lib.objects.PathObject> pathObjects) Deprecated.For consistency in naming; use #removeMeasurements instead.Clear the measurement lists for specified objects within a hierarchy.- Parameters:
hierarchy- used to fire a hierarchy update, if specified (may be null if no update should be fired)pathObjects- collection of objects that should have their measurement lists cleared
-
removeMeasurements
public static void removeMeasurements(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, Collection<? extends qupath.lib.objects.PathObject> pathObjects) Remove the measurements from specified objects within a hierarchy.- Parameters:
hierarchy- used to fire a hierarchy update, if specified (can be null if no update should be fired)pathObjects- collection of objects that should have their measurements removed.
-
clearAnnotationMeasurements
@Deprecated(since="0.6.0") public static void clearAnnotationMeasurements(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Deprecated.For consistency in naming; use #removeMeasurements instead.Clear the measurement lists for all annotations in a hierarchy.- Parameters:
hierarchy- The relevant hierarchy.
-
removeAnnotationMeasurements
public static void removeAnnotationMeasurements(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Remove the measurements from all annotations in a hierarchy.- Parameters:
hierarchy- The relevant hierarchy.
-
clearAnnotationMeasurements
Deprecated.For consistency in naming; use #removeAnnotationMeasurements instead.Clear the measurement lists for all annotations in the current hierarchy. -
removeAnnotationMeasurements
public static void removeAnnotationMeasurements()Remove the measurements from all annotations in the current hierarchy. -
clearDetectionMeasurements
@Deprecated(since="0.6.0") public static void clearDetectionMeasurements(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Deprecated.For consistency in naming; use #removeDetectionMeasurements instead.Clear the measurement lists for all detections in a hierarchy (including sub-classes of detections).- Parameters:
hierarchy- The relevant hierarchy.
-
removeDetectionMeasurements
public static void removeDetectionMeasurements(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Remove the measurements from all detections in a hierarchy (including sub-classes of detections).- Parameters:
hierarchy- The relevant hierarchy.
-
clearDetectionMeasurements
Deprecated.For consistency in naming; use #removeDetectionMeasurements instead.Clear the measurement lists for all detections in the current hierarchy. -
removeDetectionMeasurements
public static void removeDetectionMeasurements()Remove the measurements from all detections in the current hierarchy. -
clearTMACoreMeasurements
@Deprecated(since="0.6.0") public static void clearTMACoreMeasurements(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Deprecated.For consistency in naming; use #removeTMACoreMeasurements instead.Clear the measurement lists for all TMA core objects in a hierarchy.- Parameters:
hierarchy- The relevant hierarchy.
-
removeTMACoreMeasurements
public static void removeTMACoreMeasurements(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Remove the measurements from all TMA core objects in a hierarchy.- Parameters:
hierarchy- The relevant hierarchy.
-
clearTMACoreMeasurements
Deprecated.For consistency in naming; use #removeTMACoreMeasurements instead.Clear the measurement lists for all TMA core objects in the current hierarchy. -
removeTMACoreMeasurements
public static void removeTMACoreMeasurements()Remove the measurements from all TMA core objects in the current hierarchy. -
clearMeasurements
@Deprecated(since="0.6.0") public static void clearMeasurements(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, Class<? extends qupath.lib.objects.PathObject> cls) Deprecated.For consistency in naming; use #removeMeasurements instead.Clear the measurement lists for objects of a specific class in a hierarchy (subclasses are not included!).- Parameters:
hierarchy- The relevant hierarchy.cls- The type of object.
-
removeMeasurements
public static void removeMeasurements(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, Class<? extends qupath.lib.objects.PathObject> cls) Remove the measurements from objects of a specific class in a hierarchy (subclasses are not included!).- Parameters:
hierarchy- The relevant hierarchy.cls- The type of object.
-
clearMeasurements
@Deprecated(since="0.6.0") public static void clearMeasurements(Class<? extends qupath.lib.objects.PathObject> cls) Deprecated.For consistency in naming; use #removeMeasurements instead.Clear the measurement lists for objects of a specific class in the current hierarchy (subclasses are not included!).- Parameters:
cls- The type of object.
-
removeMeasurements
Remove the measurements from objects of a specific class in the current hierarchy (subclasses are not included!).- Parameters:
cls- The type of object.
-
clearMeasurements
Deprecated.For consistency in naming; use #removeMeasurements instead.Clear the measurement lists for all detections in the current hierarchy. -
removeMeasurements
public static void removeMeasurements()Remove the measurements from all detections in the current hierarchy. -
clearCellMeasurements
@Deprecated(since="0.6.0") public static void clearCellMeasurements(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Deprecated.For consistency in naming; use #removeCellMeasurements instead.Clear the measurement lists for all cells in a hierarchy.- Parameters:
hierarchy- The relevant hierarchy
-
removeCellMeasurements
public static void removeCellMeasurements(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Remove the measurements from all cells in a hierarchy.- Parameters:
hierarchy- The relevant hierarchy
-
clearCellMeasurements
Deprecated.For consistency in naming; use #removeCellMeasurements instead.Clear the measurement lists for all cells in the current hierarchy. -
removeCellMeasurements
public static void removeCellMeasurements()Remove the measurements from all cells in the current hierarchy. -
removeTileMeasurements
public static void removeTileMeasurements(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Remove the measurements from all tiles in a hierarchy.- Parameters:
hierarchy- The relevant hierarchy.
-
clearTileMeasurements
@Deprecated(since="0.6.0") public static void clearTileMeasurements(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Deprecated.For consistency in naming; use #removeTileMeasurements instead.Clear the measurement lists for all tiles in a hierarchy.- Parameters:
hierarchy- The relevant hierarchy.
-
clearTileMeasurements
Deprecated.For consistency in naming; use #removeTileMeasurements instead.Clear the measurements lists for all tiles in the current hierarchy. -
removeTileMeasurements
public static void removeTileMeasurements()Remove the measurements from all tiles in the current hierarchy. -
clearRootMeasurements
@Deprecated(since="0.6.0") public static void clearRootMeasurements(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Deprecated.For consistency in naming; use #removeRootMeasurements instead.Clear the measurement lists for the root object.- Parameters:
hierarchy- The relevant hierarchy.
-
removeRootMeasurements
public static void removeRootMeasurements(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Remove the measurements from the root object.- Parameters:
hierarchy- The relevant hierarchy.
-
clearRootMeasurements
Deprecated.For consistency in naming; use #removeRootMeasurements instead.Clear the measurement lists for the root object of the current hierarchy. -
removeRootMeasurements
public static void removeRootMeasurements()Remove measurements from the root object of the current hierarchy. -
getBasePathClass
public static qupath.lib.objects.classes.PathClass getBasePathClass(qupath.lib.objects.PathObject pathObject) Get a base class - which is either a valid PathClass which is *not* an intensity class, or else null. This will be null ifpathObject.getPathClass() == null. Otherwise, it will bepathObject.getPathClass().getBaseClass()assuming the result isn't an intensity class - or null otherwise.- Parameters:
pathObject- The relevant PathObject.- Returns:
- The base class of the PathObject.
-
getNonIntensityAncestorPathClass
public static qupath.lib.objects.classes.PathClass getNonIntensityAncestorPathClass(qupath.lib.objects.PathObject pathObject) Get the first ancestor class of pathObject.getPathClass() that is not an intensity class (i.e. not negative, positive, 1+, 2+ or 3+).* This will return null if pathClass is null, or if no non-intensity classes are found.- Parameters:
pathObject- The relevant PathObject.- Returns:
- The first non-intensity ancestor class.
-
setIntensityClassifications
public static void setIntensityClassifications(Collection<? extends qupath.lib.objects.PathObject> pathObjects, String measurementName, double... thresholds) Set the intensity classifications for the specified objects.- Parameters:
pathObjects- The specified objects.measurementName- measurement to thresholdthresholds- either 1 or 3 thresholds, depending upon whether objects should be classified as Positive/Negative or Negative/1+/2+/3+
-
setIntensityClassificationsForSelected
public static void setIntensityClassificationsForSelected(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, String measurementName, double... thresholds) Set intensity classifications for all selected (detection) objects in the specified hierarchy.- Parameters:
hierarchy- The relevant hierarchy.measurementName- measurement to thresholdthresholds- either 1 or 3 thresholds, depending upon whether objects should be classified as Positive/Negative or Negative/1+/2+/3+
-
setIntensityClassifications
public static void setIntensityClassifications(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, Class<? extends qupath.lib.objects.PathObject> cls, String measurementName, double... thresholds) Set the intensity classifications for objects of the specified class in the specified hierarchy.- Parameters:
hierarchy-cls-measurementName- measurement to thresholdthresholds- either 1 or 3 thresholds, depending upon whether objects should be classified as Positive/Negative or Negative/1+/2+/3+
-
setIntensityClassifications
public static void setIntensityClassifications(Class<? extends qupath.lib.objects.PathObject> cls, String measurementName, double... thresholds) Set the intensity classifications for objects of the specified class in the current hierarchy.- Parameters:
cls-measurementName- measurement to thresholdthresholds- either 1 or 3 thresholds, depending upon whether objects should be classified as Positive/Negative or Negative/1+/2+/3+
-
setDetectionIntensityClassifications
public static void setDetectionIntensityClassifications(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, String measurementName, double... thresholds) Set the intensity classifications for detections in the specified hierarchy.- Parameters:
hierarchy-measurementName- measurement to thresholdthresholds- either 1 or 3 thresholds, depending upon whether objects should be classified as Positive/Negative or Negative/1+/2+/3+
-
setDetectionIntensityClassifications
public static void setDetectionIntensityClassifications(String measurementName, double... thresholds) Set the intensity classifications for detections in the current hierarchy.- Parameters:
measurementName- measurement to thresholdthresholds- either 1 or 3 thresholds, depending upon whether objects should be classified as Positive/Negative or Negative/1+/2+/3+
-
setCellIntensityClassifications
Set the intensity classifications for cells in the current hierarchy.- Parameters:
measurementName- measurement to thresholdthresholds- either 1 or 3 thresholds, depending upon whether objects should be classified as Positive/Negative or Negative/1+/2+/3+
-
setCellIntensityClassifications
public static void setCellIntensityClassifications(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, String measurementName, double... thresholds) Set the intensity classifications for cells in the specified hierarchy.- Parameters:
hierarchy- the hierarchy containing cellsmeasurementName- measurement to thresholdthresholds- either 1 or 3 thresholds, depending upon whether objects should be classified as Positive/Negative or Negative/1+/2+/3+
-
resetIntensityClassifications
public static void resetIntensityClassifications(Collection<qupath.lib.objects.PathObject> pathObjects) Reset the intensity classifications for all specified objects. This means setting the classification to the result ofgetNonIntensityAncestorPathClass(pathObject)- Parameters:
pathObjects-
-
resetIntensityClassifications
public static void resetIntensityClassifications(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Reset the intensity classifications for all detections in the specified hierarchy. This means setting the classification to the result ofgetNonIntensityAncestorPathClass(pathObject)- Parameters:
hierarchy-
-
resetIntensityClassifications
public static void resetIntensityClassifications()Reset the intensity classifications for all detections in the current hierarchy. This means setting the classification to the result ofgetNonIntensityAncestorPathClass(pathObject) -
writeImageRegion
public static void writeImageRegion(qupath.lib.images.servers.ImageServer<BufferedImage> server, qupath.lib.regions.RegionRequest request, String path) throws IOException Write an image region image to the specified path. The writer will be determined based on the file extension.- Parameters:
server-request-path-- Throws:
IOException
-
writePredictionImage
public static void writePredictionImage(qupath.lib.images.ImageData<BufferedImage> imageData, qupath.lib.classifiers.pixel.PixelClassifier classifier, String path) throws IOException Write the output of applying a pixel classifier to an image. The writer will be determined based on the file extension.- Parameters:
imageData- image to which the classifier should be appliedclassifier- pixel classifierpath- output file path- Throws:
IOException
-
writePredictionImage
Write the output of applying a pixel classifier to the current image image.- Parameters:
classifierName- name of the classifier, seeloadPixelClassifier(String)path- output file path- Throws:
IOException
-
writeDensityMapImage
public static void writeDensityMapImage(qupath.lib.images.ImageData<BufferedImage> imageData, DensityMaps.DensityMapBuilder densityMap, String path) throws IOException Write the output of applying a density map to an image. The writer will be determined based on the file extension.- Parameters:
imageData- image to which the classifier should be applieddensityMap- the density mappath- output file path- Throws:
IOException
-
writeDensityMapImage
Write the output of applying a density map to the current image image.- Parameters:
densityMapName- name of the density map, seeloadDensityMap(String)path- output file path- Throws:
IOException
-
writeImage
public static void writeImage(qupath.lib.images.servers.ImageServer<BufferedImage> server, String path) throws IOException Write a full image to the specified path. The writer will be determined based on the file extension.- Parameters:
server-path-- Throws:
IOException
-
writeImage
Write an image to the specified path. The writer will be determined based on the file extension.- Parameters:
img-path-- Throws:
IOException
-
detectionCentroidDistances
public static void detectionCentroidDistances(qupath.lib.images.ImageData<?> imageData, boolean splitClassNames) Compute the distance for all detection object centroids to the closest detection with each valid, not-ignored classification and add the result to the detection measurement list.- Parameters:
imageData-splitClassNames-- See Also:
-
detectionCentroidDistances
Deprecated.retained only for compatibility of v0.2.0 milestone releases; use instead #detectionCentroidDistances(boolean)Compute the distance for all detection object centroids to the closest detection with each valid, not-ignored classification and add the result to the detection measurement list for the current ImageData - without splitting class names.- See Also:
-
detectionCentroidDistances
public static void detectionCentroidDistances(boolean splitClassNames) Compute the distance for all detection object centroids to the closest detection with each valid, not-ignored classification and add the result to the detection measurement list for the current ImageData.- Parameters:
splitClassNames-- See Also:
-
detectionToAnnotationDistances
public static void detectionToAnnotationDistances(qupath.lib.images.ImageData<?> imageData, boolean splitClassNames) Compute the distance for all detection object centroids to the closest annotation with each valid, not-ignored classification and add the result to the detection measurement list. If the centroid falls inside an annotation, the distance is zero.- Parameters:
imageData-splitClassNames-- See Also:
-
detectionToAnnotationDistances
Deprecated.retained only for compatibility of v0.2.0 milestone releases; use instead #detectionToAnnotationDistances(boolean)Compute the distance for all detection object centroids to the closest annotation with each valid, not-ignored classification and add the result to the detection measurement list for the current ImageData - without splitting class names. -
detectionToAnnotationDistances
public static void detectionToAnnotationDistances(boolean splitClassNames) Compute the distance for all detection object centroids to the closest annotation with each valid, not-ignored classification and add the result to the detection measurement list for the current ImageData. If the centroid falls inside an annotation, the distance is zero.- Parameters:
splitClassNames-- See Also:
-
detectionToAnnotationDistancesSigned
public static void detectionToAnnotationDistancesSigned(qupath.lib.images.ImageData<?> imageData, boolean splitClassNames) Compute the signed distance for all detection object centroids to the closest annotation with each valid, not-ignored classification and add the result to the detection measurement list. If the centroid falls inside an annotation, the negative distance to the annotation boundary is used.- Parameters:
imageData-splitClassNames-- Since:
- v0.4.0
- See Also:
-
detectionToAnnotationDistancesSigned
public static void detectionToAnnotationDistancesSigned(boolean splitClassNames) Compute the signed distance for all detection object centroids to the closest annotation with each valid, not-ignored classification and add the result to the detection measurement list for the current ImageData. If the centroid falls inside an annotation, the negative distance to the annotation boundary is used.- Parameters:
splitClassNames-- Since:
- v0.4.0
- See Also:
-
setPixelSizeMicrons
public static boolean setPixelSizeMicrons(qupath.lib.images.ImageData<?> imageData, Number pixelWidthMicrons, Number pixelHeightMicrons, Number zSpacingMicrons) Set the metadata for an ImageServer to have the required pixel sizes and z-spacing.Returns true if changes were made, false otherwise.
- Parameters:
imageData-pixelWidthMicrons-pixelHeightMicrons-zSpacingMicrons-- Returns:
- true if the size was set, false otherwise
-
setPixelSizeMicrons
public static boolean setPixelSizeMicrons(Number pixelWidthMicrons, Number pixelHeightMicrons, Number zSpacingMicrons) Set the metadata for the current ImageData to have the required pixel sizes and z-spacing.Returns true if changes were made, false otherwise.
- Parameters:
pixelWidthMicrons-pixelHeightMicrons-zSpacingMicrons-- Returns:
- true if the size was set, false otherwise
-
setPixelSizeMicrons
Set the metadata for the current ImageData to have the required pixel sizes.Returns true if changes were made, false otherwise.
- Parameters:
pixelWidthMicrons-pixelHeightMicrons-- Returns:
- true if the size was set, false otherwise
-
replaceClassification
Apply a new classification to all objects in the current hierarchy with a specified classification.- Parameters:
originalClassName- name of the original classificationnewClassName- name of the new classification
-
replaceClassification
public static void replaceClassification(qupath.lib.objects.classes.PathClass originalClass, qupath.lib.objects.classes.PathClass newClass) Apply a new classification to all objects in the current hierarchy with a specified original classification.- Parameters:
originalClass- the original classificationnewClass- the new classification
-
replaceClassification
public static void replaceClassification(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, qupath.lib.objects.classes.PathClass originalClass, qupath.lib.objects.classes.PathClass newClass) Apply a new classification to all objects with a specified original classification in the provided hierarchy.- Parameters:
hierarchy- the hierarchy containing the objectsoriginalClass- the original classificationnewClass- the new classification
-
replaceClassification
public static void replaceClassification(Collection<qupath.lib.objects.PathObject> pathObjects, qupath.lib.objects.classes.PathClass originalClass, qupath.lib.objects.classes.PathClass newClass) Apply a new classification to all objects with a specified original classification in an object collection.- Parameters:
pathObjects-originalClass-newClass-
-
resolveHierarchy
public static void resolveHierarchy()Resolve the location of annotations in the current hierarchy by setting parent/child relationships. -
resolveHierarchy
public static void resolveHierarchy(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Resolve the location of annotations in the specified hierarchy by setting parent/child relationships.- Parameters:
hierarchy-
-
insertObjects
Insert objects into the hierarchy, resolving their location and setting parent/child relationships.- Parameters:
pathObjects-
-
insertObjects
public static void insertObjects(qupath.lib.objects.PathObject pathObject) Insert object into the hierarchy, resolving its location and setting parent/child relationships.- Parameters:
pathObject-
-
mergePointsForAllClasses
public static boolean mergePointsForAllClasses()Merge point annotations sharing the samePathClassandImagePlaneas the selected annotations of the current hierarchy, creating multi-point annotations for all matching points and removing the (previously-separated) annotations.- Returns:
- true if changes are made to the hierarchy, false otherwise
-
mergePointsForSelectedObjectClasses
public static boolean mergePointsForSelectedObjectClasses()Merge point annotations sharing the samePathClassandImagePlanefor the current hierarchy, creating multi-point annotations for all matching points and removing the (previously-separated) annotations.- Returns:
- true if changes are made to the hierarchy, false otherwise
-
splitAllAnnotationAreasByLines
public static boolean splitAllAnnotationAreasByLines()Split annotation objects with area ROIs using dividing lines extracted from annotations objects with line ROIs, then remove the lines from the object hierarchy.The new objects will be added to the hierarchy, not inserted. It may therefore be necessary to fall
resolveHierarchy(PathObjectHierarchy)afterwards.- Returns:
- true if changes were made, false otherwise
- Since:
- v0.5.0
- See Also:
-
splitAllAnnotationAreasByLines
public static boolean splitAllAnnotationAreasByLines(double thickness, boolean removeLines) Split annotation objects with area ROIs using dividing lines extracted from annotations objects with line ROIs, with an optional line thickness and optionally removing the dividing lines.The new objects will be added to the hierarchy, not inserted. It may therefore be necessary to fall
resolveHierarchy(PathObjectHierarchy)afterwards.- Parameters:
thickness- the thickness of the line; if greater than zero, the line will be buffered with a radius of half this valueremoveLines- optionally remove the lines after performing the splitting- Returns:
- true if changes were made, false otherwise
- Since:
- v0.5.0
- See Also:
-
splitAllAnnotationAreasByLines
public static boolean splitAllAnnotationAreasByLines(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Split annotation objects with area ROIs using dividing lines extracted from annotations objects with line ROIs, then remove the lines from the object hierarchy.The new objects will be added to the hierarchy, not inserted. It may therefore be necessary to fall
resolveHierarchy(PathObjectHierarchy)afterwards.- Parameters:
hierarchy- the object hierarchy to use- Returns:
- true if changes were made, false otherwise
- Since:
- v0.5.0
- See Also:
-
splitAllAnnotationAreasByLines
public static boolean splitAllAnnotationAreasByLines(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, double thickness, boolean removeLines) Split annotation objects with area ROIs using dividing lines extracted from annotations objects with line ROIs, with an optional line thickness and optionally removing the dividing lines.The new objects will be added to the hierarchy, not inserted. It may therefore be necessary to fall
resolveHierarchy(PathObjectHierarchy)afterwards.- Parameters:
hierarchy- the object hierarchy to usethickness- the thickness of the line; if greater than zero, the line will be buffered with a radius of half this valueremoveLines- optionally remove the lines after performing the splitting- Returns:
- true if changes were made, false otherwise
- Since:
- v0.5.0
- See Also:
-
splitSelectedAnnotationAreasByLines
public static boolean splitSelectedAnnotationAreasByLines()Split selected annotation objects with area ROIs using dividing lines extracted from annotations objects with line ROIs, then remove the lines from the object hierarchy.The new objects will be added to the hierarchy, not inserted. It may therefore be necessary to fall
resolveHierarchy(PathObjectHierarchy)afterwards.- Returns:
- true if changes were made, false otherwise
- Since:
- v0.5.0
- See Also:
-
splitSelectedAnnotationAreasByLines
public static boolean splitSelectedAnnotationAreasByLines(double thickness, boolean removeLines) Split selected annotation objects with area ROIs using dividing lines extracted from annotations objects with line ROIs, with an optional line thickness and optionally removing the dividing lines.The new objects will be added to the hierarchy, not inserted. It may therefore be necessary to fall
resolveHierarchy(PathObjectHierarchy)afterwards.- Parameters:
thickness- the thickness of the line; if greater than zero, the line will be buffered with a radius of half this valueremoveLines- optionally remove the lines after performing the splitting- Returns:
- true if changes were made, false otherwise
- Since:
- v0.5.0
- See Also:
-
splitSelectedAnnotationAreasByLines
public static boolean splitSelectedAnnotationAreasByLines(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Split selected annotation objects with area ROIs using dividing lines extracted from annotations objects with line ROIs, then remove the lines from the object hierarchy.The new objects will be added to the hierarchy, not inserted. It may therefore be necessary to fall
resolveHierarchy(PathObjectHierarchy)afterwards.- Parameters:
hierarchy- the object hierarchy to use- Returns:
- true if changes were made, false otherwise
- Since:
- v0.5.0
- See Also:
-
splitSelectedAnnotationAreasByLines
public static boolean splitSelectedAnnotationAreasByLines(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, double thickness, boolean removeLines) Split selected annotation objects with area ROIs using dividing lines extracted from annotations objects with line ROIs, with an optional line thickness and optionally removing the dividing lines.The new objects will be added to the hierarchy, not inserted. It may therefore be necessary to fall
resolveHierarchy(PathObjectHierarchy)afterwards.- Parameters:
hierarchy- the object hierarchy to usethickness- the thickness of the line; if greater than zero, the line will be buffered with a radius of half this valueremoveLines- optionally remove the lines after performing the splitting- Returns:
- true if changes were made, false otherwise
- Since:
- v0.5.0
- See Also:
-
splitSpecifiedAreasByLines
public static boolean splitSpecifiedAreasByLines(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, Collection<? extends qupath.lib.objects.PathObject> pathObjects, double thickness, boolean removeLines) Split the specified objects with area ROIs using dividing lines extracted from specified objects with line ROIs, with an optional line thickness and optionally removing the dividing lines.The new objects will be added to the hierarchy, not inserted. It may therefore be necessary to fall
resolveHierarchy(PathObjectHierarchy)afterwards.- Parameters:
hierarchy- the object hierarchy to usepathObjects- the objects to split; usually annotations, but they may be any object except for TMA coresthickness- the thickness of the line; if greater than zero, the line will be buffered with a radius of half this valueremoveLines- optionally remove the lines after performing the splitting- Returns:
- true if changes were made, false otherwise
- Since:
- v0.5.0
- See Also:
-
duplicateSelectedAnnotations
public static boolean duplicateSelectedAnnotations()Duplicate the selected annotations in the current hierarchy.- Returns:
- true if changes are made to the hierarchy, false otherwise
-
duplicateSelectedAnnotations
public static boolean duplicateSelectedAnnotations(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Duplicate the selected annotations in the specified hierarchy.- Parameters:
hierarchy-- Returns:
- true if changes are made to the hierarchy, false otherwise
- Since:
- v0.4.0
-
copySelectedObjectsToPlane
public static boolean copySelectedObjectsToPlane(int z, int t) Copy the selected objects in the current hierarchy to the specified z-slice and timepoint. This copies only the objects themselves, discarding any parent/child relationships. The copied objects will become the new selection.- Parameters:
z- z-slice (0-based index)t- timepoint (0-based index)- Returns:
- true if changes are made to the hierarchy, false otherwise
- Since:
- v0.4.0
- See Also:
-
copySelectedObjectsToPlane
public static boolean copySelectedObjectsToPlane(qupath.lib.regions.ImagePlane plane) Copy the selected objects in the current hierarchy to the specified image plane. This copies only the objects themselves, discarding any parent/child relationships. The copied objects will become the new selection.- Parameters:
plane-- Returns:
- true if changes are made to the hierarchy, false otherwise
- Since:
- v0.4.0
- See Also:
-
copySelectedObjectsToPlane
public static boolean copySelectedObjectsToPlane(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, qupath.lib.regions.ImagePlane plane) Copy the selected objects in the specified hierarchy to the specified image plane. This copies only the objects themselves, discarding any parent/child relationships. The copied objects will become the new selection.- Parameters:
hierarchy-plane-- Returns:
- true if changes are made to the hierarchy, false otherwise
- Since:
- v0.4.0
-
copySelectedAnnotationsToPlane
public static boolean copySelectedAnnotationsToPlane(int z, int t) Copy the selected annotations in the current hierarchy to the specified z-slice and timepoint. This copies only the objects themselves, discarding any parent/child relationships. The copied objects will become the new selection.- Parameters:
z- z-slice (0-based index)t- timepoint (0-based index)- Returns:
- true if changes are made to the hierarchy, false otherwise
- Since:
- v0.4.0
- See Also:
-
copySelectedAnnotationsToPlane
public static boolean copySelectedAnnotationsToPlane(qupath.lib.regions.ImagePlane plane) Copy the selected annotations in the current hierarchy to the specified image plane. This copies only the objects themselves, discarding any parent/child relationships. The copied objects will become the new selection.- Parameters:
plane-- Returns:
- true if changes are made to the hierarchy, false otherwise
- Since:
- v0.4.0
- See Also:
-
copySelectedAnnotationsToPlane
public static boolean copySelectedAnnotationsToPlane(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, qupath.lib.regions.ImagePlane plane) Copy the selected annotations in the specified hierarchy to the specified image plane. This copies only the objects themselves, discarding any parent/child relationships. The copied objects will become the new selection.- Parameters:
hierarchy-plane-- Returns:
- true if changes are made to the hierarchy, false otherwise
- Since:
- v0.4.0
-
mergeAnnotations
Merge annotations for the current hierarchy.- Parameters:
annotations- the annotations to merge- Returns:
- true if changes were made the hierarchy, false otherwise
-
mergeSelectedAnnotations
public static boolean mergeSelectedAnnotations()Merge the currently-selected annotations of the current hierarchy to create a new annotation containing the union of their ROIs.Note:
- The existing annotations will be removed from the hierarchy if possible, therefore should be duplicated first if this is not desired.
- The new object will be set to be the selected object in the hierarchy (which can be used to retrieve it if needed).
- Returns:
- true if changes are made to the hierarchy, false otherwise
-
mergeAnnotations
public static boolean mergeAnnotations(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, Collection<qupath.lib.objects.PathObject> annotations) Merge the specified annotations to create a new annotation containing the union of their ROIs.Note:
- The existing annotations will be removed from the hierarchy if possible, therefore should be duplicated first if this is not desired.
- The new object will be set to be the selected object in the hierarchy (which can be used to retrieve it if needed).
- Parameters:
hierarchy-annotations-- Returns:
- true if changes are made to the hierarchy, false otherwise
-
mergeSelectedAnnotations
public static boolean mergeSelectedAnnotations(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy) Merge the currently-selected annotations to create a new annotation containing the union of their ROIs.Note:
- The existing annotations will be removed from the hierarchy if possible, therefore should be duplicated first if this is not desired.
- The new object will be set to be the selected object in the hierarchy (which can be used to retrieve it if needed).
- Parameters:
hierarchy-- Returns:
-
makeInverseAnnotation
public static boolean makeInverseAnnotation(qupath.lib.objects.PathObject pathObject) Make an annotation for the currentImageData, for which the ROI is obtained by subtracting the existing ROI from the ROI of its parent object (or entire image if no suitable parent object is available).- Parameters:
pathObject- the existing object defining the ROI to invert- Returns:
- true if an inverted annotation is added to the hierarchy, false otherwise
-
makeInverseAnnotation
public static boolean makeInverseAnnotation(qupath.lib.images.ImageData<?> imageData, qupath.lib.objects.PathObject pathObject) Make an annotation for the specifiedImageData, for which the ROI is obtained by subtracting the existing ROI from the ROI of its parent object (or entire image if no suitable parent object is available).- Parameters:
imageData- the imageData for which an inverted annotation should be createdpathObject- the existing object defining the ROI to invert- Returns:
- true if an inverted annotation is added to the hierarchy, false otherwise
-
makeInverseAnnotation
public static boolean makeInverseAnnotation()Make an inverse annotation using the currentImageDataand its current selected objects.- Returns:
- true if an inverted annotation is added to the hierarchy, false otherwise
-
makeInverseAnnotation
public static boolean makeInverseAnnotation(qupath.lib.images.ImageData<?> imageData) Make an inverse annotation using the specifiedImageDataand current selected objects.- Parameters:
imageData- the imageData for which an inverted annotation should be created- Returns:
- true if an inverted annotation is added to the hierarchy, false otherwise
-
makeInverseAnnotation
public static boolean makeInverseAnnotation(qupath.lib.images.ImageData<?> imageData, Collection<qupath.lib.objects.PathObject> pathObjects) Make an annotation, for which the ROI is obtained by subtracting the ROIs of the specified objects from the closest common ancestor ROI (or entire image if the closest ancestor is the root).In an inverted annotation can be created, it is added to the hierarchy and set as selected.
- Parameters:
imageData- the image containing the annotationpathObjects- the annotation to invert- Returns:
- true if an inverted annotation is added to the hierarchy, false otherwise.
-
runObjectClassifier
Apply an object classifier to the currentImageData. This method throws anIllegalArgumentExceptionif the classifier cannot be found.- Parameters:
names- the name of the classifier within the current project, or file path to a classifier to load from disk. If more than one name is provided, a composite classifier is created.- Throws:
IllegalArgumentException- if the classifier cannot be found
-
runObjectClassifier
public static void runObjectClassifier(qupath.lib.images.ImageData imageData, String... names) throws IllegalArgumentException Apply an object classifier to the specifiedImageData. This method throws anIllegalArgumentExceptionif the classifier cannot be found.- Parameters:
imageData-names- the name of the classifier within the current project, or file path to a classifier to load from disk. If more than one name is provided, a composite classifier is created.- Throws:
IllegalArgumentException- if the classifier cannot be found
-
loadObjectClassifier
public static qupath.lib.classifiers.object.ObjectClassifier<BufferedImage> loadObjectClassifier(String... names) throws IllegalArgumentException Load an object classifier for a project or file path.- Parameters:
names- the names of the classifier within the current project, or file paths to a classifier to load from disk. If more than one name is provided, a composite classifier is created (applying each classifier in sequence).- Returns:
- the requested
ObjectClassifier - Throws:
IllegalArgumentException- if the classifier cannot be found
-
loadDensityMap
public static DensityMaps.DensityMapBuilder loadDensityMap(String name) throws IllegalArgumentException Load a density map for a project or file path.- Parameters:
name- the name of the density map within the current project, or file path to a density map to load from disk.- Returns:
- the requested
DensityMaps.DensityMapBuilder - Throws:
IllegalArgumentException- if the density map cannot be found
-
locateFile
Locate a specified file based upon its name or path, with a search depth of 4. This first checks if the provided path is to a file that already exists. If it is not, then it searches recursively within the current project (if available) up to a fixed search depth for a file with the same name.- Parameters:
nameOrPath- the original name or path- Returns:
- the identified file path, or the original file path if no update was found or required
- Throws:
IOException- See Also:
-
locateFile
Locate a specified file based upon its name or path. This first checks if the provided path is to a file that already exists. If it is not, then it searches recursively within the current project (if available) up to a specified search depth for a file with the same name.- Parameters:
nameOrPath- the original name or pathsearchDepth- how deep to search subdirectories recursively- Returns:
- the identified file path, or the original file path if no update was found or required
- Throws:
IOException- See Also:
-
findDensityMapHotspots
public static void findDensityMapHotspots(String densityMapName, int channel, int numHotspots, double minCounts, boolean deleteExisting, boolean peaksOnly) throws IOException Find hotspots in a density map for the current image.- Parameters:
densityMapName- name of the density map builder, seeloadDensityMap(String)channel- channel number (usually 0)numHotspots- the maximum number of hotspots to generate within each selected objectminCounts- the minimum value in the 'counts' channel; this is used to avoid generating hotspots in areas with few objectsdeleteExisting- if true, similar annotations will be deleted from the imagepeaksOnly- if true, hotspots will only be generated at intensity peaks in the density map- Throws:
IOException
-
findDensityMapHotspots
public static void findDensityMapHotspots(qupath.lib.images.ImageData<BufferedImage> imageData, String densityMapName, int channel, int numHotspots, double minCounts, boolean deleteExisting, boolean peaksOnly) throws IOException Find hotspots in a density map.- Parameters:
imageData- the image datadensityMapName- name of the density map builder, seeloadDensityMap(String)channel- channel number (usually 0)numHotspots- the maximum number of hotspots to generate within each selected objectminCounts- the minimum value in the 'counts' channel; this is used to avoid generating hotspots in areas with few objectsdeleteExisting- if true, similar annotations will be deleted from the imagepeaksOnly- if true, hotspots will only be generated at intensity peaks in the density map- Throws:
IOException
-
findDensityMapHotspots
public static void findDensityMapHotspots(qupath.lib.images.ImageData<BufferedImage> imageData, DensityMaps.DensityMapBuilder densityMap, int channel, int numHotspots, double minCounts, boolean deleteExisting, boolean peaksOnly) throws IOException Find hotspots in a density map.- Parameters:
imageData- the image datadensityMap- builder to generate a density mapchannel- channel number (usually 0)numHotspots- the maximum number of hotspots to generate within each selected objectminCounts- the minimum value in the 'counts' channel; this is used to avoid generating hotspots in areas with few objectsdeleteExisting- if true, similar annotations will be deleted from the imagepeaksOnly- if true, hotspots will only be generated at intensity peaks in the density map- Throws:
IOException
-
createAnnotationsFromDensityMap
public static void createAnnotationsFromDensityMap(String densityMapName, Map<Integer, ? extends Number> thresholds, String pathClassName, String... options) throws IOExceptionCreate annotations from a density map for the current image.- Parameters:
densityMapName- the name of the density map within the current project, or file path to a density map to load from diskthresholds- map between channels to threshold (zero-based index) and thresholds to applypathClassName- name of the classification for the annotations that will be createdoptions- additional options when creating the annotations- Throws:
IOException- See Also:
-
createAnnotationsFromDensityMap
public static void createAnnotationsFromDensityMap(qupath.lib.images.ImageData<BufferedImage> imageData, String densityMapName, Map<Integer, ? extends Number> thresholds, String pathClassName, String... options) throws IOExceptionCreate annotations from a density map for the specified image.- Parameters:
imageData- image for which the density map should be generateddensityMapName- the name of the density map within the current project, or file path to a density map to load from diskthresholds- map between channels to threshold (zero-based index) and thresholds to applypathClassName- name of the classification for the annotations that will be createdoptions- additional options when creating the annotations- Throws:
IOException- See Also:
-
createAnnotationsFromDensityMap
public static void createAnnotationsFromDensityMap(qupath.lib.images.ImageData<BufferedImage> imageData, DensityMaps.DensityMapBuilder densityMap, Map<Integer, ? extends Number> thresholds, String pathClassName, PixelClassifierTools.CreateObjectOptions... options) throws IOExceptionCreate annotations from a density map for the specified image.- Parameters:
imageData- image to which the density map correspondsdensityMap- the density map to usethresholds- map between channels to threshold (zero-based index) and thresholds to applypathClassName- name of the classification for the annotations that will be createdoptions- additional options when creating the annotations- Throws:
IOException- See Also:
-
getLogger
public static org.slf4j.Logger getLogger()Get the logger associated with this class.- Returns:
- the logger
-
getLogger
Get a logger with a specified name.- Parameters:
name- the name of the logger- Returns:
- the logger
- Since:
- v0.6.0
-
getLogger
Get a logger associated with a specified class.- Parameters:
cls- the class used to determine the logger name- Returns:
- the logger
- Since:
- v0.6.0
-
loadPixelClassifier
public static qupath.lib.classifiers.pixel.PixelClassifier loadPixelClassifier(String name) throws IllegalArgumentException Load a pixel classifier for a project or file path.- Parameters:
name- the name of the classifier within the current project, or file path to a classifier to load from disk.- Returns:
- the requested
PixelClassifier - Throws:
IllegalArgumentException- if the classifier cannot be found
-
addPixelClassifierMeasurements
Add measurements from pixel classification to the selected objects.- Parameters:
classifierName- the pixel classifier namemeasurementID-- See Also:
-
addPixelClassifierMeasurements
public static void addPixelClassifierMeasurements(qupath.lib.classifiers.pixel.PixelClassifier classifier, String measurementID) Add measurements from pixel classification to the selected objects.- Parameters:
classifier- the pixel classifiermeasurementID-
-
createDetectionsFromPixelClassifier
public static void createDetectionsFromPixelClassifier(String classifierName, double minArea, double minHoleArea, String... options) throws IllegalArgumentException, IOException Create detection objects based upon the output of a pixel classifier, applied to selected objects. If no objects are selected, objects are created across the entire image.- Parameters:
classifierName- the name of the pixel classifierminArea- the minimum area of connected regions to retainminHoleArea- the minimum area of connected 'hole' regions to retainoptions- additional options to control how objects are created- Throws:
IOExceptionIllegalArgumentException- See Also:
-
createDetectionsFromPixelClassifier
public static void createDetectionsFromPixelClassifier(qupath.lib.classifiers.pixel.PixelClassifier classifier, double minArea, double minHoleArea, String... options) throws IOException Create detection objects based upon the output of a pixel classifier, applied to selected objects. If no objects are selected, objects are created across the entire image.- Parameters:
classifier- the pixel classifierminArea- the minimum area of connected regions to retainminHoleArea- the minimum area of connected 'hole' regions to retainoptions- additional options to control how objects are created- Throws:
IOException
-
createAnnotationsFromPixelClassifier
public static void createAnnotationsFromPixelClassifier(String classifierName, double minArea, double minHoleArea, String... options) throws IllegalArgumentException, IOException Create annotation objects based upon the output of a pixel classifier, applied to selected objects. If no objects are selected, objects are created across the entire image.- Parameters:
classifierName- the name of the pixel classifierminArea- the minimum area of connected regions to retainminHoleArea- the minimum area of connected 'hole' regions to retainoptions- additional options to control how objects are created- Throws:
IOExceptionIllegalArgumentException- See Also:
-
createAnnotationsFromPixelClassifier
public static void createAnnotationsFromPixelClassifier(qupath.lib.classifiers.pixel.PixelClassifier classifier, double minArea, double minHoleArea, String... options) throws IOException Create annotation objects based upon the output of a pixel classifier, applied to selected objects. If no objects are selected, objects are created across the entire image.- Parameters:
classifier- the pixel classifierminArea- the minimum area of connected regions to retainminHoleArea- the minimum area of connected 'hole' regions to retainoptions- additional options to control how objects are created- Throws:
IOException
-
classifyDetectionsByCentroid
public static void classifyDetectionsByCentroid(qupath.lib.classifiers.pixel.PixelClassifier classifier) Classify detections according to the prediction of the pixel corresponding to the detection centroid using aPixelClassifier. If the detections are cells, the nucleus ROI is used where possible.- Parameters:
classifier- the pixel classifier
-
classifyDetectionsByCentroid
Classify detections according to the prediction of the pixel corresponding to the detection centroid using aPixelClassifier. If the detections are cells, the nucleus ROI is used where possible.- Parameters:
classifierName- name of the pixel classifier
-
checkMinVersion
Check whether the current QuPath version is ≥ the specified version. This can be added at the beginning of a script to prevent the script running if it is known to be incompatible.It throws an exception if the test is failed so that it can be added in a single line, with the script stopping if the criterion is not met.
Using this successfully depends upon
VERSIONbeing available. To avoid an exception if it is not, useif (VERSION != null) checkMinVersion("0.4.0");- Parameters:
version- last known compatible version (inclusive)- Throws:
UnsupportedOperationException- if the version test is not passed, of version information is unavailable- Since:
- v0.4.0
- See Also:
-
checkVersionRange
public static void checkVersionRange(String minVersion, String maxVersion) throws UnsupportedOperationException Check whether the current QuPath version is ≥ the specified minimum version, and < the specified maximum. This can be added at the beginning of a script to prevent the script running if it is known to be incompatible.The minimum is inclusive and maximum is exclusive so that the maximum can be given as the first version known to introduce a breaking change.
Using this successfully depends upon
VERSIONbeing available. To avoid an exception if it is not, useif (VERSION != null) checkVersionRange("0.4.0", "0.5.0");- Parameters:
minVersion- last known compatible version (inclusive)maxVersion- next known incompatible version- Throws:
UnsupportedOperationException- if the version test is not passed, of version information is unavailable- Since:
- v0.4.0
- See Also:
-
removeObjectsOutsideImage
public static boolean removeObjectsOutsideImage()Remove objects that are entirely outside the current image.- Returns:
- true if objects were removed, false otherwise
- Since:
- v0.4.0
- See Also:
-
removeObjectsOutsideImage
public static boolean removeObjectsOutsideImage(boolean ignoreIntersecting) Remove objects that are entirely or partially outside the current image.- Parameters:
ignoreIntersecting- if true, ignore objects that are intersecting the image bounds; if false, remove these intersecting objects too- Returns:
- true if objects were removed, false otherwise
- Since:
- v0.4.0
- See Also:
-
removeObjectsOutsideImage
public static boolean removeObjectsOutsideImage(qupath.lib.images.ImageData<?> imageData) Remove objects that are entirely or outside the specified image.- Parameters:
imageData- the image data, including a hierarchy and server to use- Returns:
- true if objects were removed, false otherwise
- Since:
- v0.4.0
- See Also:
-
removeObjectsOutsideImage
public static boolean removeObjectsOutsideImage(qupath.lib.images.ImageData<?> imageData, boolean ignoreIntersecting) Remove objects that are entirely or partially outside the specified image.- Parameters:
imageData- the image data, including a hierarchy and server to useignoreIntersecting- if true, ignore objects that are intersecting the image bounds; if false, remove these intersecting objects too- Returns:
- true if objects were removed, false otherwise
- Since:
- v0.4.0
- See Also:
- Implementation Note
- TMA cores outside the image can't be removed, because doing so would potentially mess up the TMA grid.
-
removeOrClipObjectsOutsideImage
public static boolean removeOrClipObjectsOutsideImage()Remove objects occurring outside the current image bounds, clipping annotations where possible to retain the part that is inside the image.- Returns:
- true if changes were made, false otherwise
- Since:
- v0.4.0
- See Also:
-
removeOrClipObjectsOutsideImage
public static boolean removeOrClipObjectsOutsideImage(qupath.lib.images.ImageData<?> imageData) Remove objects occurring outside the specified image bounds, clipping annotations where possible to retain the part that is inside the image.- Parameters:
imageData-- Returns:
- true if changes were made, false otherwise
- Since:
- v0.4.0
- See Also:
-
removeObjectsTouchingImageBounds
public static boolean removeObjectsTouchingImageBounds()Remove all objects that touch the boundary of the current image.- Returns:
- true if objects were removed, false otherwise
- Since:
- v0.6.0
-
removeObjectsTouchingImageBounds
public static boolean removeObjectsTouchingImageBounds(Predicate<qupath.lib.objects.PathObject> filter) Remove all objects that touch the boundary of the current image.- Parameters:
filter- optional filter to identify which objects can be removed (e.g. only detections, only annotations)- Returns:
- true if objects were removed, false otherwise
- Since:
- v0.6.0
-
removeObjectsTouchingImageBounds
public static boolean removeObjectsTouchingImageBounds(qupath.lib.images.ImageData<?> imageData, Predicate<qupath.lib.objects.PathObject> filter) Remove objects that touch the boundary of the specified image.- Parameters:
imageData- the image to processfilter- optional filter to restrict which objects can be removed (e.g. only detections, only annotations)- Returns:
- true if objects were removed, false otherwise
- Since:
- v0.6.0
-
removeObjectsTouchingSelectedBounds
public static boolean removeObjectsTouchingSelectedBounds()Remove all objects that touch or overlap the bounds of the selected objects in the current image.- Returns:
- true if objects were removed, false otherwise
- Since:
- v0.6.0
-
removeObjectsTouchingSelectedBounds
public static boolean removeObjectsTouchingSelectedBounds(Predicate<qupath.lib.objects.PathObject> filter) Remove objects that touch or overlap the bounds of the selected objects in the current image.- Parameters:
filter- optional filter to restrict which objects can be removed (e.g. only detections, only annotations)- Returns:
- true if objects were removed, false otherwise
- Since:
- v0.6.0
-
removeObjectsTouchingSelectedBounds
public static boolean removeObjectsTouchingSelectedBounds(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, Predicate<qupath.lib.objects.PathObject> filter) Remove objects that touch or overlap the bounds of the selected objects in the specified object hierarchy.- Parameters:
hierarchy- the object hierarchy to usefilter- optional filter to restrict which objects can be removed (e.g. only detections, only annotations)- Returns:
- true if objects were removed, false otherwise
- Since:
- v0.6.0
-
removeChildObjectsTouchingSelectedBounds
public static boolean removeChildObjectsTouchingSelectedBounds()Remove all objects that touch or overlap the bounds of the selected objects in the current image, and are direct children of the selected objects.- Returns:
- true if objects were removed, false otherwise
- Since:
- v0.6.0
-
removeChildObjectsTouchingSelectedBounds
public static boolean removeChildObjectsTouchingSelectedBounds(Predicate<qupath.lib.objects.PathObject> filter) Remove objects that touch or overlap the bounds of the selected objects in the current image, and are direct children of the selected objects.- Parameters:
filter- optional filter to restrict which objects can be removed (e.g. only detections, only annotations)- Returns:
- true if objects were removed, false otherwise
- Since:
- v0.6.0
-
removeChildObjectsTouchingSelectedBounds
public static boolean removeChildObjectsTouchingSelectedBounds(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, Predicate<qupath.lib.objects.PathObject> filter) Remove objects that touch or overlap the bounds of the selected objects in the specified image, and are direct children of the selected objects.- Parameters:
hierarchy- the object hierarchy to usefilter- optional filter to restrict which objects can be removed (e.g. only detections, only annotations)- Returns:
- true if objects were removed, false otherwise
- Since:
- v0.6.0
-
simplifyAllAnnotations
public static void simplifyAllAnnotations(double altitudeThreshold) Simplify all annotations to a given threshold- Parameters:
altitudeThreshold- altitude value for simplification- See Also:
-
simplifySelectedAnnotations
public static void simplifySelectedAnnotations(double altitudeThreshold) Simplify the currently selected annotations to a given threshold- Parameters:
altitudeThreshold- altitude value for simplification- See Also:
-
simplifySpecifiedAnnotations
public static void simplifySpecifiedAnnotations(Collection<? extends qupath.lib.objects.PathObject> pathObjects, double altitudeThreshold) Simplify a set of pathObjects to a given threshold.- Parameters:
pathObjects- the path objectsaltitudeThreshold- altitude value for simplification- See Also:
-
convertSelectedObjectsToPoints
public static void convertSelectedObjectsToPoints()Convert the selected objects to points, based on the object centroids. Cells are converted based on the nucleus ROI.
The original objects are not removed; seeremoveObjects(Collection pathObjects).- See Also:
-
convertDetectionsToPoints
public static void convertDetectionsToPoints()Convert all detection objects to points, based on the object centroids. Cells are converted based on the nucleus ROI.
The original objects are not removed; seeremoveObjects(Collection pathObjects).- See Also:
-
convertSpecifiedObjectsToPoints
public static void convertSpecifiedObjectsToPoints(qupath.lib.objects.hierarchy.PathObjectHierarchy hierarchy, Collection<? extends qupath.lib.objects.PathObject> pathObjects) Convert the selected objects to points, based on the object centroids. Cells are converted based on the nucleus ROI.
The original objects are not removed; seeremoveObjects(Collection pathObjects).- Parameters:
hierarchy- the hierarchy that the objects are contained inpathObjects- the objects to be converted to points (these will be removed from the object hierarchy).- See Also:
-
BufferedImageis the class, usebuildServer(String, String...)instead because it handles default args.