Class QP
- Direct Known Subclasses:
- QPEx
 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 SummaryFieldsModifier and TypeFieldDescriptionstatic final ImageData.ImageTypeBrightfield image type with hematoxylin and DAB stainingstatic final ImageData.ImageTypeBrightfield image type with hematoxylin and eosin stainingstatic final ImageData.ImageTypeBrightfield image typestatic final ImageData.ImageTypeFluorescence image typestatic final 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 VersionThe current QuPath version, parsed according to semantic versioning.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic voidaddObject(PathObject pathObject) Add the specified object to the currentPathObjectHierarchy.static voidaddObjects(Collection<PathObject> pathObjects) Add the specified collection of objects to the currentPathObjectHierarchy.static voidaddObjects(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(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(ImageData<?> imageData, Collection<? extends PathObject> pathObjects, String feature, String... additionalFeatures) Add shape measurements to the specified objects.static voidaddShapeMeasurements(ImageData<?> imageData, Collection<? extends 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> ImageServer<T> buildServer(String path, Class<T> cls, String... args) Deprecated.static ImageServer<BufferedImage> buildServer(String path, String... args) Build anImageServerwith the classBufferedImage.static 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(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(PathObjectHierarchy hierarchy, String pathClassName) Set the classification of the selected objects.static voidDeprecated.For naming consistency; use #removeAllObjects instead.static voidclearAllObjects(Class<? extends PathObject> cls) Deprecated.For naming consistency; use #removeAllObjects instead.static voidDeprecated.For consistency in naming; use #removeAnnotationMeasurements instead.static voidclearAnnotationMeasurements(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(PathObjectHierarchy hierarchy) Deprecated.For consistency in naming; use #removeCellMeasurements instead.static voidDeprecated.For consistency in naming; use #removeDetectionMeasurements instead.static voidclearDetectionMeasurements(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 PathObject> cls) Deprecated.For consistency in naming; use #removeMeasurements instead.static voidclearMeasurements(PathObjectHierarchy hierarchy, Class<? extends PathObject> cls) Deprecated.For consistency in naming; use #removeMeasurements instead.static voidclearMeasurements(PathObjectHierarchy hierarchy, Collection<? extends PathObject> pathObjects) Deprecated.For consistency in naming; use #removeMeasurements instead.static voidclearMeasurements(PathObjectHierarchy hierarchy, PathObject... pathObjects) Deprecated.For consistency in naming; use #removeMeasurements instead.static voidDeprecated.For consistency in naming; use #removeRootMeasurements instead.static voidclearRootMeasurements(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(PathObjectHierarchy hierarchy) Deprecated.For consistency in naming; use #removeTileMeasurements instead.static voidDeprecated.For consistency in naming; use #removeTMACoreMeasurements instead.static voidclearTMACoreMeasurements(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(PathObjectHierarchy hierarchy, Collection<? extends 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(PathObjectHierarchy hierarchy, ImagePlane plane) Copy the selected annotations in the specified hierarchy to the specified image plane.static booleanCopy 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(PathObjectHierarchy hierarchy, ImagePlane plane) Copy the selected objects in the specified hierarchy to the specified image plane.static booleanCopy the selected objects in the current hierarchy to the specified image plane.static List<PathObject> createAllFullImageAnnotations(boolean setSelected) Create annotation around the full image for the current image, on all z-slices and timepoints.static List<PathObject> createAllFullImageAnnotations(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(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(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(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(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 PathObjectcreateFullImageAnnotation(boolean setSelected) Create an annotation around the full image for the current image, on the default (first) z-slice and timepoint.static 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 PathObjectcreateFullImageAnnotation(ImageData<?> imageData, boolean setSelected) Create an annotation around the full image for the specified image, on the default (first) z-slice and timepoint.static PathObjectcreateFullImageAnnotation(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(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(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(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(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(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(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, PathIO.GeoJsonExportOptions... options) Export all objects (excluding root object) to an output file as GeoJSON.static voidexportObjectsToGeoJson(Collection<? extends PathObject> pathObjects, String path, String option, String... additionalOptions) Export specified objects to an output file as GeoJSON.static voidexportObjectsToGeoJson(Collection<? extends PathObject> pathObjects, String path, 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, 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(ImageData<BufferedImage> imageData, String densityMapName, int channel, int numHotspots, double minCounts, boolean deleteExisting, boolean peaksOnly) Find hotspots in a density map.static voidfindDensityMapHotspots(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(PathObjectHierarchy hierarchy) Trigger an update for the specified hierarchy.static Collection<PathObject> Get all objects in the current hierarchy, including the root object (which represents the entire image).static Collection<PathObject> getAllObjects(boolean includeRootObject) Get all objects in the current hierarchy.static Collection<PathObject> Get all objects in the current hierarchy, excluding the root object (which represents the entire image).static Collection<PathObject> Get a list of the current annotation objects.static PathClassgetBasePathClass(PathObject pathObject) Get a base class - which is either a valid PathClass which is *not* an intensity class, or else null.static Collection<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 PathObjectHierarchyGet thePathObjectHierarchyof the currentImageData.static 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 ImageServer<?> Get theImageServerof the currentImageData.static StringGet the path to theImageServerof the currentImageData.static PathClassgetDerivedPathClass(PathClass baseClass, String name) Get a PathClass with the specified name, derived from another PathClass.static PathClassgetDerivedPathClass(PathClass baseClass, String name, Integer rgb) Get a PathClass with the specified name, derived from another PathClass.static Collection<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 PathClassgetNonIntensityAncestorPathClass(PathObject pathObject) Get the first ancestor class of pathObject.getPathClass() that is not an intensity class (i.e.static List<PathObject> getObjects(Predicate<PathObject> predicate) Get a list of all objects in the current hierarchy according to a specified predicate.static List<PathObject> getObjects(PathObjectHierarchy hierarchy, Predicate<PathObject> predicate) Get a list of all objects in the specified hierarchy according to a specified predicate.static PathClassgetPathClass(String name) Get a PathClass with the specified name.static PathClassgetPathClass(String name, Integer rgb) Get a PathClass with the specified name and color.static Project<BufferedImage> Get the current project.static 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 PathObjectGet the primary selected object within the currentPathObjectHierarchy.static Collection<PathObject> Get the selected objects within the currentPathObjectHierarchy.static ROIGet theROIfor the primary selected object within the currentPathObjectHierarchy.static Collection<PathObject> Get a list of the current tile objects.static List<TMACoreObject> Get the list of TMA core objects for the current hierarchy.static booleanhasMeasurement(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 PathObject> pathObjects) Insert objects into the hierarchy, resolving their location and setting parent/child relationships.static voidinsertObjects(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 ImageData<BufferedImage> loadImageData(String path, boolean setBatchData) Deprecated.static ObjectClassifier<BufferedImage> loadObjectClassifier(String... names) Load an object classifier for a project or file path.static 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(ImageData<?> imageData) Make an inverse annotation using the specifiedImageDataand current selected objects.static booleanmakeInverseAnnotation(ImageData<?> imageData, Collection<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(ImageData<?> imageData, 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(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(PathObject pathObject, String measurementName) Extract the specified measurement from a PathObject.static booleanmergeAnnotations(Collection<PathObject> annotations) Merge annotations for the current hierarchy.static booleanmergeAnnotations(PathObjectHierarchy hierarchy, Collection<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(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(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(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(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 PathObject> cls) Remove all the objects of a specified Java class.static voidRemove the measurements from all annotations in the current hierarchy.static voidremoveAnnotationMeasurements(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(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 booleanRemove 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(PathObjectHierarchy hierarchy, Predicate<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(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 PathObject> cls) Remove the measurements from objects of a specific class in the current hierarchy (subclasses are not included!).static voidremoveMeasurements(Class<? extends PathObject> cls, String... measurementNames) Remove measurements from objects of a specific class for the current image data.static voidremoveMeasurements(PathObjectHierarchy hierarchy, Class<? extends PathObject> cls) Remove the measurements from objects of a specific class in a hierarchy (subclasses are not included!).static voidremoveMeasurements(PathObjectHierarchy hierarchy, Class<? extends PathObject> cls, String... measurementNames) Remove measurements from objects of a specific class for the specified hierarchy.static voidremoveMeasurements(PathObjectHierarchy hierarchy, Collection<? extends PathObject> pathObjects) Remove the measurements from specified objects within a hierarchy.static voidremoveMeasurements(PathObjectHierarchy hierarchy, PathObject... pathObjects) Remove the measurements from specified objects within a hierarchy.static voidremoveObject(PathObject pathObject) Remove the specified object from the currentPathObjectHierarchy, keeping any descendant objects.static voidremoveObject(PathObject pathObject, boolean keepChildren) Deprecated.static voidremoveObjectAndDescendants(PathObject pathObject) Remove the specified object and any descendant objects from the currentPathObjectHierarchy.static voidremoveObjects(Collection<? extends PathObject> pathObjects) Remove the specified collection of objects from the currentPathObjectHierarchy.static voidremoveObjects(Collection<? extends PathObject> pathObjects, boolean keepChildren) Deprecated.UseremoveObjects(Collection)orremoveObjectsAndDescendants(Collection)instead.static voidremoveObjects(PathObject... pathObjects) Remove the specified array of objects from the currentPathObjectHierarchy.static voidremoveObjects(PathObject[] pathObjects, boolean keepChildren) Deprecated.UseremoveObjects(PathObject[])orremoveObjectsAndDescendants(PathObject[])instead.static voidremoveObjectsAndDescendants(Collection<? extends PathObject> pathObjects) Remove the specified collection of objects from the currentPathObjectHierarchy, and all their descendants.static voidremoveObjectsAndDescendants(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(ImageData<?> imageData) Remove objects that are entirely or outside the specified image.static booleanremoveObjectsOutsideImage(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 booleanRemove all objects that touch the boundary of the current image.static booleanremoveObjectsTouchingImageBounds(ImageData<?> imageData, Predicate<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 booleanRemove objects that touch or overlap the bounds of the selected objects in the current image.static booleanremoveObjectsTouchingSelectedBounds(PathObjectHierarchy hierarchy, Predicate<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(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(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(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(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<PathObject> pathObjects, PathClass originalClass, PathClass newClass) Apply a new classification to all objects with a specified original classification in an object collection.static voidreplaceClassification(PathClass originalClass, PathClass newClass) Apply a new classification to all objects in the current hierarchy with a specified original classification.static voidreplaceClassification(PathObjectHierarchy hierarchy, PathClass originalClass, PathClass newClass) Apply a new classification to all objects with a specified original classification in the provided hierarchy.static voidstatic voidresetClassifications(Class<? extends PathObject> cls) Reset the PathClass for all objects of the specified type in the current hierarchy.static voidresetClassifications(PathObjectHierarchy hierarchy, Class<? extends 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<PathObject> pathObjects) Reset the intensity classifications for all specified objects.static voidresetIntensityClassifications(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(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(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(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(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(PathObjectHierarchy hierarchy) Select all objects in the specified hierarchy, excluding the root object.static voidselectAllObjects(PathObjectHierarchy hierarchy, boolean includeRootObject) Set selected objects to contain all objects.static voidSelect all annotation objects in the current hierarchy.static voidselectAnnotations(PathObjectHierarchy hierarchy) Select all annotation objects in the specified hierarchy.static voidSelect all cell objects in the current hierarchy.static voidselectCells(PathObjectHierarchy hierarchy) Select all cell objects in the specified hierarchy.static voidSelect all detection objects in the current hierarchy.static voidselectDetections(PathObjectHierarchy hierarchy) Select all detection objects in the specified hierarchy.static voidselectObjects(Collection<? extends PathObject> pathObjects) Set all objects in a collection to be selected, without any being chosen as the main object.static voidselectObjects(Collection<? extends PathObject> pathObjects, PathObject mainSelection) Set all objects in a collection to be selected, including a specified main selected object.static voidselectObjects(Predicate<PathObject> predicate) Set selected objects to contain (only) all objects in the current hierarchy according to a specified predicate.static voidselectObjects(PathObjectHierarchy hierarchy, Predicate<PathObject> predicate) Set selected objects to contain (only) all objects in the specified hierarchy according to a specified predicate.static voidselectObjects(PathObjectHierarchy hierarchy, PathObject... pathObjects) Set one or more objects to be selected within the specified hierarchy.static voidselectObjects(PathObject... pathObjects) Set one or more objects to be selected within the current hierarchy.static voidselectObjectsByClass(Class<? extends PathObject> cls) Set objects that are a subclass of a specified class.static voidselectObjectsByClass(PathObjectHierarchy hierarchy, Class<? extends 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(PathObjectHierarchy hierarchy, String... pathClassNames) Select objects for the specified hierarchy that have one of the specified classifications.static voidselectObjectsByMeasurement(ImageData<?> imageData, String command) Deprecated.static voidselectObjectsByPathClass(PathClass... pathClasses) Select objects for the current hierarchy that have one of the specifiedPathClassclassifications assigned.static voidselectObjectsByPathClass(PathObjectHierarchy hierarchy, 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(PathObjectHierarchy hierarchy, ImagePlane plane) Selected objects in the specified hierarchy occurring on the specified plane (z-slice and timepoint).static voidselectObjectsByPlane(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(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(PathObjectHierarchy hierarchy) Select all TMA core objects in the specified hierarchy, excluding missing cores.static voidselectTMACores(PathObjectHierarchy hierarchy, boolean includeMissing) Select all TMA core objects in the specified hierarchy, optionally including missing cores.static voidsetBatchProjectAndImage(Project<BufferedImage> project, ImageData<BufferedImage> imageData) static voidsetCellIntensityClassifications(String measurementName, double... thresholds) Set the intensity classifications for cells in the current hierarchy.static voidsetCellIntensityClassifications(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(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(ImageData<?> imageData, String... names) Set the channel names for the specified ImageData.static voidsetChannels(ImageData<?> imageData, ImageChannel... channels) Set the channels for the specified ImageData.static voidsetChannels(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(ImageData<BufferedImage> imageData) Set the default image data, which will be returned bygetCurrentImageData()if it would otherwise return null (i.e.static voidsetDefaultProject(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(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 booleanSet the image type for the current image datastatic voidsetIntensityClassifications(Class<? extends PathObject> cls, String measurementName, double... thresholds) Set the intensity classifications for objects of the specified class in the current hierarchy.static voidsetIntensityClassifications(Collection<? extends PathObject> pathObjects, String measurementName, double... thresholds) Set the intensity classifications for the specified objects.static voidsetIntensityClassifications(PathObjectHierarchy hierarchy, Class<? extends PathObject> cls, String measurementName, double... thresholds) Set the intensity classifications for objects of the specified class in the specified hierarchy.static voidsetIntensityClassificationsForSelected(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(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(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 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 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(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 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(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(PathObjectHierarchy hierarchy, Collection<? extends 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(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(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(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(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(ImageServer<BufferedImage> server, String path) Write a full image to the specified path.static voidwriteImageRegion(ImageServer<BufferedImage> server, 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(ImageData<BufferedImage> imageData, PixelClassifier classifier, String path) Write the output of applying a pixel classifier to an image.
- 
Field Details- 
BRIGHTFIELD_H_DABBrightfield image type with hematoxylin and DAB staining
- 
BRIGHTFIELD_H_EBrightfield image type with hematoxylin and eosin staining
- 
BRIGHTFIELD_OTHERBrightfield image type
- 
FLUORESCENCEFluorescence image type
- 
OTHERAny other image type (neither brightfield nor fluorescence)
- 
PROJECT_BASE_DIRPlaceholder for the path to the current project. May be used as follows:var path = buildFilePath(PROJECT_BASE_DIR, 'subdir', 'name.txt')- See Also:
 
- 
USER_HOMEThe 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")
- 
VERSIONThe current QuPath version, parsed according to semantic versioning. May be null if the version is not known.
 
- 
- 
Constructor Details- 
QPpublic QP()
 
- 
- 
Method Details- 
describeList the fields and methods of a specified object.- Parameters:
- o-
- Returns:
 
- 
describeList the fields and methods of a specified class.- Parameters:
- cls-
- Returns:
 
- 
getCoreClassesGet 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:
 
- 
setDefaultProjectSet 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-
 
- 
setDefaultImageDataSet 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-
 
- 
setBatchProjectAndImagepublic static void setBatchProjectAndImage(Project<BufferedImage> project, ImageData<BufferedImage> imageData) - Parameters:
- project-
- imageData-
 
- 
resetBatchProjectAndImagepublic static void resetBatchProjectAndImage()
- 
loadImageData@Deprecated public static 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, the- setBatchImageData(ImageData)will be called if the loading is successful.
- Returns:
- Throws:
- IOException
- See Also:
 
- 
fireHierarchyUpdatepublic 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). 
- 
fireHierarchyUpdateTrigger 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-
 
- 
getColorRGBDeprecated.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:
 
- 
makeRGBMake 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:
 
- 
makeARGBMake 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:
 
- 
getCurrentServerPathGet the path to theImageServerof the currentImageData.- Returns:
- See Also:
 
- 
getCurrentImageDataGet 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:
 
- 
getProjectGet the current project.This returns getBatchProject()if it is not null; otherwise, it returns the default project last set throughsetDefaultProject(Project).- Returns:
- See Also:
 
- 
resolvePathResolve a path, replacing any placeholders. Currently, this means onlyPROJECT_BASE_DIR.- Parameters:
- path-
- Returns:
- Throws:
- IllegalArgumentException- if- PROJECT_BASE_DIRis used but no project is available
 
- 
buildFilePathBuild 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 path
- more- additional path components to append
- Returns:
- Throws:
- IllegalArgumentException- if- PROJECT_BASE_DIRis used but no project is available
- See Also:
 
- 
buildPathInProjectBuild 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:
 
- 
createDirectoryBuild 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 path
- more- additional path components to append
- Returns:
- a path to the directory, ending with a suitable separator
- Since:
- v0.6.0
- See Also:
 
- 
createDirectoryInProjectBuild 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:
 
- 
makePathInProjectDeprecated.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:
 
- 
makeFileInProjectBuild 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:
 
- 
mkdirsEnsure directories exist for the specified path, callingfile.mkdirs()if not.- Parameters:
- path- the directory path
- Returns:
- true if a directory was created, false otherwise
 
- 
fileExistsQuery if a file exists.- Parameters:
- path- full file path
- Returns:
- true if the file exists, false otherwise
 
- 
isDirectoryQuery 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
 
- 
getProjectEntryGet the project entry for the currently-open image within the current project, or null if no project/image is open.- Returns:
 
- 
getProjectEntryMetadataValueGet 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:
 
- 
getCurrentHierarchyGet thePathObjectHierarchyof the currentImageData.- Returns:
- See Also:
 
- 
getCurrentServerGet theImageServerof the currentImageData.- Returns:
- See Also:
 
- 
getCurrentImageNameGet 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:
 
- 
getCurrentImageNameWithoutExtensionGet the name of the current image, removing any file extension. Equivalent tovar name = GeneralTools.getNameWithoutExtension(getCurrentName());- Returns:
- Since:
- v0.4.0
- See Also:
 
- 
getSelectedObjectsGet the selected objects within the currentPathObjectHierarchy.Note: this implementation returns the selected objects directly. The returned collection may not be modifiable. - Returns:
- See Also:
 
- 
getSelectedObjectGet the primary selected object within the currentPathObjectHierarchy.- Returns:
- See Also:
 
- 
getSelectedROIGet 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:
 
- 
resetSelectionpublic static void resetSelection()Unselect the selected objects for the currentPathObjectHierarchy.
- 
setSelectedObjectSet the selected object for the currentPathObjectHierarchy.- Parameters:
- pathObject- the object to select.
- Returns:
- See Also:
 
- 
addObjectAdd the specified object to the currentPathObjectHierarchy.This will trigger a hierarchy changed event. - Parameters:
- pathObject-
 
- 
addObjectsAdd the specified array of objects to the currentPathObjectHierarchy.This will trigger a hierarchy changed event. - Parameters:
- pathObjects-
 
- 
addObjectsAdd 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(PathObject pathObject, boolean keepChildren) Deprecated.Remove the specified object from the currentPathObjectHierarchy, optionally keeping or removing descendant objects.- Parameters:
- pathObject-
- keepChildren-
 
- 
removeObjectRemove the specified object from the currentPathObjectHierarchy, keeping any descendant objects.- Parameters:
- pathObject-
- Since:
- v0.6.0
 
- 
removeObjectAndDescendantsRemove 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(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-
 
- 
nObjectspublic 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 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-
 
- 
removeObjectsRemove the specified array of objects from the currentPathObjectHierarchy. Descendant objects are kept.- Parameters:
- pathObjects- the objects to remove
- Since:
- v0.6.0
 
- 
removeObjectsAndDescendantsRemove the specified array of objects from the currentPathObjectHierarchy, and all their descendants.- Parameters:
- pathObjects- the objects to remove
- Since:
- v0.6.0
 
- 
removeObjectsRemove the specified collection of objects from the currentPathObjectHierarchy. Descendant objects are kept.- Parameters:
- pathObjects- the objects to remove
- Since:
- v0.6.0
 
- 
removeObjectsAndDescendantsRemove the specified collection of objects from the currentPathObjectHierarchy, and all their descendants.- Parameters:
- pathObjects- the objects to remove
- Since:
- v0.6.0
 
- 
isTMADearrayedpublic static boolean isTMADearrayed()Returnstrueif TMA cores are available.- Returns:
 
- 
clearAllObjectsDeprecated.For naming consistency; use #removeAllObjects instead.Remove all the objects in the currentPathObjectHierarchy, and clear the selection.- See Also:
 
- 
removeAllObjectspublic static void removeAllObjects()Remove all the objects in the currentPathObjectHierarchy, and reset the selection.- See Also:
 
- 
clearAllObjectsDeprecated.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, or- nullif all objects should be removed.
- See Also:
 
- 
removeAllObjectsRemove all the objects of a specified Java class.- Parameters:
- cls- the class, e.g.- PathAnnotationObject.class,- PathDetectionObject.class, or- nullif all objects should be removed.
- See Also:
 
- 
clearAnnotationsDeprecated.For naming consistency; use #removeAnnotations instead.Remove all the annotation objects from the currentPathObjectHierarchy.- See Also:
 
- 
removeAnnotationspublic static void removeAnnotations()Remove all the annotation objects from the currentPathObjectHierarchy.- See Also:
 
- 
clearDetectionsDeprecated.For naming consistency; use #removeDetections instead.Remove all the detection objects from the currentPathObjectHierarchy.- See Also:
 
- 
removeDetectionspublic static void removeDetections()Remove all the detection objects from the currentPathObjectHierarchy.- See Also:
 
- 
clearTMAGridDeprecated.For naming consistency; use #removeTMAGrid instead.Remove the TMA grid from the currentPathObjectHierarchy.- See Also:
 
- 
removeTMAGridpublic static void removeTMAGrid()Remove the TMA grid from the currentPathObjectHierarchy.- See Also:
 
- 
addShapeMeasurementsAdd the specified shape measurements to the current selected objects of the current image. If no features are specified, all will be added.- Parameters:
- features-
 
- 
addShapeMeasurementspublic static void addShapeMeasurements(ImageData<?> imageData, Collection<? extends 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 measured
- feature- first feature to add
- additionalFeatures- optional array of Strings specifying the features to add
 
- 
addShapeMeasurementspublic static void addShapeMeasurements(ImageData<?> imageData, Collection<? extends 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 measured
- features- the specific features to add. If none are specified, all available features will be added.
 
- 
setChannelNamesSet the channel names for the current ImageData.- Parameters:
- names-
- See Also:
 
- 
setChannelNamesSet 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-
 
- 
setChannelColorsSet the channel colors for the current ImageData.- Parameters:
- colors-
- See Also:
 
- 
setChannelColorsSet 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:
 
- 
setChannelsSet the channels for the current ImageData.- Parameters:
- channels-
- See Also:
 
- 
setChannelsSet 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:
 
- 
runPluginRun the specified plugin on the currentImageData.- Parameters:
- className- the full Java class name for the plugin
- args- any arguments required by the plugin (usually a JSON-encoded map)
- Returns:
- Throws:
- InterruptedException
- See Also:
 
- 
runPluginpublic static boolean runPlugin(String className, ImageData<?> imageData, String args) throws InterruptedException Run the specified plugin on the specifiedImageData.- Parameters:
- className- the full Java class name for the plugin
- imageData- the ImageData to which the plugin should be applied
- args- any arguments required by the plugin (usually a JSON-encoded map)
- Returns:
- Throws:
- InterruptedException
 
- 
runPluginRun the specified plugin on the currentImageData, using a map for arguments.- Parameters:
- className- the full Java class name for the plugin
- args- 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)
 
- 
runPluginpublic static boolean runPlugin(String className, 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 plugin
- imageData- the ImageData to which the plugin should be applied
- args- 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)
 
- 
runPluginRun 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 arguments
- className- the full Java class name for the plugin
- Returns:
- Throws:
- InterruptedException
- Since:
- v0.4.0
- Implementation Note
- this calls runPlugin(String, Map)
 
- 
runPluginpublic static boolean runPlugin(Map<String, ?> args, String className, 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 arguments
- className- the full Java class name for the plugin
- imageData-
- Returns:
- Throws:
- InterruptedException
- Since:
- v0.4.0
- Implementation Note
- this calls runPlugin(String, ImageData, Map)
 
- 
getTMACoreListGet 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:
 
- 
getAnnotationObjectsGet a list of the current annotation objects.- Returns:
- See Also:
 
- 
getDetectionObjectsGet a list of the current detection objects.- Returns:
- See Also:
 
- 
getTileObjectsGet a list of the current tile objects.- Returns:
- Since:
- v0.4.0
- See Also:
 
- 
getCellObjectsGet a list of the current cell objects.- Returns:
- See Also:
 
- 
getAllObjectsGet all objects in the current hierarchy.- Parameters:
- includeRootObject-
- Returns:
- See Also:
 
- 
getAllObjectsWithoutRootGet all objects in the current hierarchy, excluding the root object (which represents the entire image).- Returns:
- Since:
- v0.6.0
- See Also:
 
- 
getAllObjectsGet all objects in the current hierarchy, including the root object (which represents the entire image).- Returns:
- See Also:
 
- 
setImageTypeSet the image type for the current image data, using a String to represent the enumImageData.ImageType- Parameters:
- typeName-
- Returns:
 
- 
setImageTypeSet the image type for the current image data- Parameters:
- type-
- Returns:
 
- 
setColorDeconvolutionStainsSet the color deconvolution stains for hte current image data using a (JSON) String representation- Parameters:
- arg-
- Returns:
 
- 
setColorDeconvolutionStainsSet 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 by- ColorDeconvolutionStains.BACKGROUND_KEY. A stain with the name defined by- ColorDeconvolutionStains.RESIDUAL_KEYwill be set as- residual, 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 data
- IllegalArgumentException- if the provided stains do not contain a stain with the name defined by- ColorDeconvolutionStains.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 values
- NullPointerException- if one of the parameter is null
 
- 
createSelectAllObjectDeprecated.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
 
- 
createSelectAllObjectDeprecated.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 hierarchy
- z- z-slice index for the annotation
- t- timepoint index for the annotation
 
- 
createAllFullImageAnnotationsCreate 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:
 
- 
createAllFullImageAnnotationspublic static List<PathObject> createAllFullImageAnnotations(ImageData<?> imageData, boolean setSelected) Create annotation around the full image for the specified image, on all z-slices and timepoints.- Parameters:
- imageData- the image data
- 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
 
- 
createFullImageAnnotationCreate 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:
 
- 
createFullImageAnnotationCreate 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 created
- z- 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:
 
- 
createFullImageAnnotationCreate 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 added
- 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
 
- 
createFullImageAnnotationpublic static PathObject createFullImageAnnotation(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 added
- setSelected- if true, set the annotation to be selected when it is created
- z- 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> 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:
 
- 
buildServerpublic static 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.
 
- 
buildServerBuild anImageServerwith the classBufferedImage.- Parameters:
- uri- image URI
- args- 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:
 
- 
transformSelectedObjectsApply 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.
 
- 
transformSelectedObjectspublic static void transformSelectedObjects(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.
 
- 
scaleAllObjectspublic 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:
 
- 
scaleAllObjectsResize the ROIs of all objects in the specified object hierarchy.- Parameters:
- hierarchy- the object hierarchy
- scaleFactor- scale factor
- Since:
- v0.4.0
- See Also:
 
- 
translateAllObjectspublic 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:
 
- 
translateAllObjectsTranslate (move) the ROIs of all objects in the specified object hierarchy.- Parameters:
- hierarchy- the object hierarchy
- dx- amount to translate horizontally (in pixels)
- dy- amount to translate vertically (in pixels)
- Since:
- v0.4.0
- See Also:
 
- 
transformAllObjectsApply 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.
 
- 
transformAllObjectsApply 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.
 
- 
resetTMAMetadatapublic static void resetTMAMetadata(boolean includeMeasurements) Remove all TMA metadata from the current TMA grid.- Parameters:
- includeMeasurements- remove measurements in addition to textual metadata
 
- 
resetTMAMetadataRemove all TMA metadata from the TMA grid of the specified hierarchy.- Parameters:
- hierarchy-
- includeMeasurements- remove measurements in addition to textual metadata
 
- 
relabelTMAGridpublic static boolean relabelTMAGrid(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.
 
- 
relabelTMAGridpublic static boolean relabelTMAGrid(String labelsHorizontal, String labelsVertical, boolean rowFirst) Relabel the current TMA grid. SeerelabelTMAGrid(PathObjectHierarchy, String, String, boolean)- Parameters:
- labelsHorizontal-
- labelsVertical-
- rowFirst-
- Returns:
 
- 
createTMAGridpublic static void createTMAGrid(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 labels
- vLabels- a String representing vertical labels
- rowFirst- true if the horizontal label should be added before the vertical label, false otherwise
- diameterCalibrated- the diameter of each core, in calibrated units
- See Also:
 
- 
createTMAGridpublic 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 labels
- vLabels- a String representing vertical labels
- rowFirst- true if the horizontal label should be added before the vertical label, false otherwise
- diameterCalibrated- the diameter of each core, in calibrated units
- See Also:
 
- 
resetClassificationsReset the PathClass for all objects of the specified type in the current hierarchy.- Parameters:
- cls-
 
- 
refreshIDspublic static void refreshIDs()Refresh all object IDs for the current hierarchy.- Since:
- v0.4.0
 
- 
refreshDuplicateIDspublic 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
 
- 
refreshIDsRefresh all object IDs for the current hierarchy.- Parameters:
- hierarchy- the object hierarchy
- Since:
- v0.4.0
 
- 
refreshDuplicateIDsRefresh 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
 
- 
resetClassificationspublic static void resetClassifications(PathObjectHierarchy hierarchy, Class<? extends PathObject> cls) Reset the PathClass for all objects of the specified type in the specified hierarchy.- Parameters:
- hierarchy-
- cls-
 
- 
resetDetectionClassificationspublic static void resetDetectionClassifications()Reset the PathClass for all detection objects in the current hierarchy.
- 
hasMeasurementTest whether a PathObject has a specified measurement in its measurement list.- Parameters:
- pathObject-
- measurementName-
- Returns:
 
- 
measurementExtract the specified measurement from a PathObject.- Parameters:
- pathObject-
- measurementName-
- Returns:
 
- 
clearSelectedObjectsDeprecated.For consistency in naming; use #removeSelectedObjects instead.Clear selected objects, but keep child (descendant) objects.
- 
removeSelectedObjectspublic static void removeSelectedObjects()Remove selected objects, but keep child (descendant) objects.
- 
clearSelectedObjectsDeprecated.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.
 
- 
removeSelectedObjectsAndDescendantspublic static void removeSelectedObjectsAndDescendants()Delete the selected objects from the current hierarchy, including all the child and descendant objects.
- 
getObjectsGet a list of all objects in the current hierarchy according to a specified predicate.- Parameters:
- predicate-
- Returns:
 
- 
selectAllObjectsSet selected objects to contain all objects.- Parameters:
- hierarchy-
- includeRootObject-
 
- 
selectAllObjectsSelect all objects in the specified hierarchy, excluding the root object.- Parameters:
- hierarchy-
- Since:
- v0.4.0
 
- 
selectAllObjectspublic static void selectAllObjects()Select all objects in the current hierarchy, excluding the root object.- Since:
- v0.4.0
 
- 
selectObjectsByPlanepublic 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:
 
- 
selectObjectsByPlaneSelected objects in the current hierarchy occurring on the specified plane (z-slice and timepoint).- Parameters:
- plane-
- Since:
- v0.4.0
- See Also:
 
- 
selectObjectsByPlaneSelected objects in the specified hierarchy occurring on the specified plane (z-slice and timepoint).- Parameters:
- hierarchy-
- plane-
- Since:
- v0.4.0
 
- 
selectObjectsSet selected objects to contain (only) all objects in the current hierarchy according to a specified predicate.- Parameters:
- predicate-
 
- 
selectObjectsSet all objects in a collection to be selected, without any being chosen as the main object.- Parameters:
- pathObjects-
 
- 
selectObjectspublic static void selectObjects(Collection<? extends PathObject> pathObjects, PathObject mainSelection) Set all objects in a collection to be selected, including a specified main selected object.- Parameters:
- pathObjects-
- mainSelection-
 
- 
selectObjectsSet one or more objects to be selected within the specified hierarchy.- Parameters:
- hierarchy-
- pathObjects-
 
- 
selectObjectsSet one or more objects to be selected within the current hierarchy.- Parameters:
- pathObjects-
 
- 
getObjectspublic static List<PathObject> getObjects(PathObjectHierarchy hierarchy, Predicate<PathObject> predicate) Get a list of all objects in the specified hierarchy according to a specified predicate.- Parameters:
- hierarchy-
- predicate-
- Returns:
 
- 
selectObjectsSet selected objects to contain (only) all objects in the specified hierarchy according to a specified predicate.- Parameters:
- hierarchy-
- predicate-
 
- 
selectObjectsByClassSet objects that are a subclass of a specified class. Not to be confused withselectObjectsByPathClass(PathClass...)andselectObjectsByClassification(String...).- Parameters:
- cls-
 
- 
selectObjectsByClasspublic static void selectObjectsByClass(PathObjectHierarchy hierarchy, Class<? extends 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-
 
- 
selectAnnotationsSelect all annotation objects in the specified hierarchy.- Parameters:
- hierarchy-
 
- 
selectTMACoresSelect all TMA core objects in the specified hierarchy, excluding missing cores.- Parameters:
- hierarchy-
 
- 
selectTMACoresSelect all TMA core objects in the specified hierarchy, optionally including missing cores.- Parameters:
- hierarchy-
- includeMissing-
 
- 
selectDetectionsSelect all detection objects in the specified hierarchy.- Parameters:
- hierarchy-
 
- 
selectCellsSelect all cell objects in the specified hierarchy.- Parameters:
- hierarchy-
 
- 
selectAnnotationspublic static void selectAnnotations()Select all annotation objects in the current hierarchy.
- 
selectTMACorespublic static void selectTMACores()Select all TMA core objects in the current hierarchy, excluding missing cores.
- 
selectTMACorespublic static void selectTMACores(boolean includeMissing) Select all TMA core objects in the current hierarchy, optionally including missing cores.- Parameters:
- includeMissing-
 
- 
selectDetectionspublic static void selectDetections()Select all detection objects in the current hierarchy.
- 
selectCellspublic static void selectCells()Select all cell objects in the current hierarchy.
- 
selectTilesSelect all tile objects in the specified hierarchy.- Parameters:
- hierarchy-
 
- 
selectTilespublic static void selectTiles()Select all tile objects in the current hierarchy.
- 
selectObjectsByClassificationSelect objects for the current hierarchy that have one of the specified classifications.- Parameters:
- pathClassNames- one or more classification names, which may be converted to a- PathClasswith- getPathClass(String)
 
- 
selectObjectsByPathClassSelect objects for the current hierarchy that have one of the specifiedPathClassclassifications assigned.- Parameters:
- pathClasses- one or more classifications
- See Also:
 
- 
selectObjectsByClassificationpublic static void selectObjectsByClassification(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 selected
- pathClassNames- one or more classification names, which may be converted to a- PathClasswith- getPathClass(String)
- See Also:
 
- 
selectObjectsByPathClasspublic static void selectObjectsByPathClass(PathObjectHierarchy hierarchy, PathClass... pathClasses) Select objects for the specified hierarchy that have one of the specifiedPathClassclassifications assigned.- Parameters:
- hierarchy- the hierarchy containing objects that may be selected
- pathClasses- one or more classifications
 
- 
selectObjectsByMeasurementDeprecated.Select objects based on a specified measurement.- Parameters:
- imageData-
- command-
 
- 
classifySelectedSet the classification of the selected objects in the current hierarchy.- Parameters:
- pathClassName-
 
- 
classifySelectedSet the classification of the selected objects.- Parameters:
- hierarchy-
- pathClassName-
 
- 
exportAllObjectsToGeoJsonpublic 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
 
- 
exportAllObjectsToGeoJsonpublic static void exportAllObjectsToGeoJson(String path, PathIO.GeoJsonExportOptions... options) throws IOException Export all objects (excluding root object) to an output file as GeoJSON.- Parameters:
- path-
- options-
- Throws:
- IOException
 
- 
exportSelectedObjectsToGeoJsonpublic 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
 
- 
exportSelectedObjectsToGeoJsonpublic static void exportSelectedObjectsToGeoJson(String path, PathIO.GeoJsonExportOptions... options) throws IOException Export the selected objects to an output file as GeoJSON.- Parameters:
- path-
- options-
- Throws:
- IOException
 
- 
exportObjectsToGeoJsonpublic static void exportObjectsToGeoJson(Collection<? extends 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
 
- 
exportObjectsToGeoJsonpublic static void exportObjectsToGeoJson(Collection<? extends PathObject> pathObjects, String path, PathIO.GeoJsonExportOptions... options) throws IOException Export specified objects to an output file as GeoJSON.- Parameters:
- pathObjects-
- path-
- options-
- Throws:
- IOException
 
- 
importObjectsFromFilepublic 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:
- FileNotFoundException
- IllegalArgumentException
- ClassNotFoundException
- IOException
 
- 
deselectAllpublic static void deselectAll()Reset the selection for the current hierarchy, so that no objects of any kind are selected.
- 
deselectAllReset the selection, so that no objects of any kind are selected.- Parameters:
- hierarchy-
 
- 
getPathClassGet a PathClass with the specified name.- Parameters:
- name-
- Returns:
 
- 
getPathClassGet 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:
 
- 
getDerivedPathClassGet 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:
 
- 
getDerivedPathClassGet 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:
 
- 
removeMeasurementsRemove measurements from objects of a specific class for the current image data.- Parameters:
- cls- The type of object.
- measurementNames- The measurement names to remove.
 
- 
removeMeasurementspublic static void removeMeasurements(PathObjectHierarchy hierarchy, Class<? extends 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(PathObjectHierarchy hierarchy, 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
 
- 
removeMeasurementsRemove 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(PathObjectHierarchy hierarchy, Collection<? extends 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
 
- 
removeMeasurementspublic static void removeMeasurements(PathObjectHierarchy hierarchy, Collection<? extends 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(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.
 
- 
removeAnnotationMeasurementsRemove the measurements from all annotations in a hierarchy.- Parameters:
- hierarchy- The relevant hierarchy.
 
- 
clearAnnotationMeasurementsDeprecated.For consistency in naming; use #removeAnnotationMeasurements instead.Clear the measurement lists for all annotations in the current hierarchy.
- 
removeAnnotationMeasurementspublic static void removeAnnotationMeasurements()Remove the measurements from all annotations in the current hierarchy.
- 
clearDetectionMeasurements@Deprecated(since="0.6.0") public static void clearDetectionMeasurements(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.
 
- 
removeDetectionMeasurementsRemove the measurements from all detections in a hierarchy (including sub-classes of detections).- Parameters:
- hierarchy- The relevant hierarchy.
 
- 
clearDetectionMeasurementsDeprecated.For consistency in naming; use #removeDetectionMeasurements instead.Clear the measurement lists for all detections in the current hierarchy.
- 
removeDetectionMeasurementspublic static void removeDetectionMeasurements()Remove the measurements from all detections in the current hierarchy.
- 
clearTMACoreMeasurements@Deprecated(since="0.6.0") public static void clearTMACoreMeasurements(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.
 
- 
removeTMACoreMeasurementsRemove the measurements from all TMA core objects in a hierarchy.- Parameters:
- hierarchy- The relevant hierarchy.
 
- 
clearTMACoreMeasurementsDeprecated.For consistency in naming; use #removeTMACoreMeasurements instead.Clear the measurement lists for all TMA core objects in the current hierarchy.
- 
removeTMACoreMeasurementspublic 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(PathObjectHierarchy hierarchy, Class<? extends 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.
 
- 
removeMeasurementspublic static void removeMeasurements(PathObjectHierarchy hierarchy, Class<? extends 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.
 
- 
clearMeasurementsDeprecated.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.
 
- 
removeMeasurementsRemove the measurements from objects of a specific class in the current hierarchy (subclasses are not included!).- Parameters:
- cls- The type of object.
 
- 
clearMeasurementsDeprecated.For consistency in naming; use #removeMeasurements instead.Clear the measurement lists for all detections in the current hierarchy.
- 
removeMeasurementspublic static void removeMeasurements()Remove the measurements from all detections in the current hierarchy.
- 
clearCellMeasurementsDeprecated.For consistency in naming; use #removeCellMeasurements instead.Clear the measurement lists for all cells in a hierarchy.- Parameters:
- hierarchy- The relevant hierarchy
 
- 
removeCellMeasurementsRemove the measurements from all cells in a hierarchy.- Parameters:
- hierarchy- The relevant hierarchy
 
- 
clearCellMeasurementsDeprecated.For consistency in naming; use #removeCellMeasurements instead.Clear the measurement lists for all cells in the current hierarchy.
- 
removeCellMeasurementspublic static void removeCellMeasurements()Remove the measurements from all cells in the current hierarchy.
- 
removeTileMeasurementsRemove the measurements from all tiles in a hierarchy.- Parameters:
- hierarchy- The relevant hierarchy.
 
- 
clearTileMeasurementsDeprecated.For consistency in naming; use #removeTileMeasurements instead.Clear the measurement lists for all tiles in a hierarchy.- Parameters:
- hierarchy- The relevant hierarchy.
 
- 
clearTileMeasurementsDeprecated.For consistency in naming; use #removeTileMeasurements instead.Clear the measurements lists for all tiles in the current hierarchy.
- 
removeTileMeasurementspublic static void removeTileMeasurements()Remove the measurements from all tiles in the current hierarchy.
- 
clearRootMeasurementsDeprecated.For consistency in naming; use #removeRootMeasurements instead.Clear the measurement lists for the root object.- Parameters:
- hierarchy- The relevant hierarchy.
 
- 
removeRootMeasurementsRemove the measurements from the root object.- Parameters:
- hierarchy- The relevant hierarchy.
 
- 
clearRootMeasurementsDeprecated.For consistency in naming; use #removeRootMeasurements instead.Clear the measurement lists for the root object of the current hierarchy.
- 
removeRootMeasurementspublic static void removeRootMeasurements()Remove measurements from the root object of the current hierarchy.
- 
getBasePathClassGet 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.
 
- 
getNonIntensityAncestorPathClassGet 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.
 
- 
setIntensityClassificationspublic static void setIntensityClassifications(Collection<? extends PathObject> pathObjects, String measurementName, double... thresholds) Set the intensity classifications for the specified objects.- Parameters:
- pathObjects- The specified objects.
- measurementName- measurement to threshold
- thresholds- either 1 or 3 thresholds, depending upon whether objects should be classified as Positive/Negative or Negative/1+/2+/3+
 
- 
setIntensityClassificationsForSelectedpublic static void setIntensityClassificationsForSelected(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 threshold
- thresholds- either 1 or 3 thresholds, depending upon whether objects should be classified as Positive/Negative or Negative/1+/2+/3+
 
- 
setIntensityClassificationspublic static void setIntensityClassifications(PathObjectHierarchy hierarchy, Class<? extends 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 threshold
- thresholds- either 1 or 3 thresholds, depending upon whether objects should be classified as Positive/Negative or Negative/1+/2+/3+
 
- 
setIntensityClassificationspublic static void setIntensityClassifications(Class<? extends 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 threshold
- thresholds- either 1 or 3 thresholds, depending upon whether objects should be classified as Positive/Negative or Negative/1+/2+/3+
 
- 
setDetectionIntensityClassificationspublic static void setDetectionIntensityClassifications(PathObjectHierarchy hierarchy, String measurementName, double... thresholds) Set the intensity classifications for detections in the specified hierarchy.- Parameters:
- hierarchy-
- measurementName- measurement to threshold
- thresholds- either 1 or 3 thresholds, depending upon whether objects should be classified as Positive/Negative or Negative/1+/2+/3+
 
- 
setDetectionIntensityClassificationspublic static void setDetectionIntensityClassifications(String measurementName, double... thresholds) Set the intensity classifications for detections in the current hierarchy.- Parameters:
- measurementName- measurement to threshold
- thresholds- either 1 or 3 thresholds, depending upon whether objects should be classified as Positive/Negative or Negative/1+/2+/3+
 
- 
setCellIntensityClassificationsSet the intensity classifications for cells in the current hierarchy.- Parameters:
- measurementName- measurement to threshold
- thresholds- either 1 or 3 thresholds, depending upon whether objects should be classified as Positive/Negative or Negative/1+/2+/3+
 
- 
setCellIntensityClassificationspublic static void setCellIntensityClassifications(PathObjectHierarchy hierarchy, String measurementName, double... thresholds) Set the intensity classifications for cells in the specified hierarchy.- Parameters:
- hierarchy- the hierarchy containing cells
- measurementName- measurement to threshold
- thresholds- either 1 or 3 thresholds, depending upon whether objects should be classified as Positive/Negative or Negative/1+/2+/3+
 
- 
resetIntensityClassificationsReset the intensity classifications for all specified objects. This means setting the classification to the result ofgetNonIntensityAncestorPathClass(pathObject)- Parameters:
- pathObjects-
 
- 
resetIntensityClassificationsReset the intensity classifications for all detections in the specified hierarchy. This means setting the classification to the result ofgetNonIntensityAncestorPathClass(pathObject)- Parameters:
- hierarchy-
 
- 
resetIntensityClassificationspublic static void resetIntensityClassifications()Reset the intensity classifications for all detections in the current hierarchy. This means setting the classification to the result ofgetNonIntensityAncestorPathClass(pathObject)
- 
writeImageRegionpublic static void writeImageRegion(ImageServer<BufferedImage> server, 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
 
- 
writePredictionImagepublic static void writePredictionImage(ImageData<BufferedImage> imageData, 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 applied
- classifier- pixel classifier
- path- output file path
- Throws:
- IOException
 
- 
writePredictionImageWrite the output of applying a pixel classifier to the current image image.- Parameters:
- classifierName- name of the classifier, see- loadPixelClassifier(String)
- path- output file path
- Throws:
- IOException
 
- 
writeDensityMapImagepublic static void writeDensityMapImage(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 applied
- densityMap- the density map
- path- output file path
- Throws:
- IOException
 
- 
writeDensityMapImageWrite the output of applying a density map to the current image image.- Parameters:
- densityMapName- name of the density map, see- loadDensityMap(String)
- path- output file path
- Throws:
- IOException
 
- 
writeImageWrite a full image to the specified path. The writer will be determined based on the file extension.- Parameters:
- server-
- path-
- Throws:
- IOException
 
- 
writeImageWrite an image to the specified path. The writer will be determined based on the file extension.- Parameters:
- img-
- path-
- Throws:
- IOException
 
- 
detectionCentroidDistancesCompute 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:
 
- 
detectionCentroidDistancesDeprecated.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:
 
- 
detectionCentroidDistancespublic 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:
 
- 
detectionToAnnotationDistancesCompute 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:
 
- 
detectionToAnnotationDistancesDeprecated.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.
- 
detectionToAnnotationDistancespublic 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:
 
- 
detectionToAnnotationDistancesSignedpublic static void detectionToAnnotationDistancesSigned(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:
 
- 
detectionToAnnotationDistancesSignedpublic 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:
 
- 
setPixelSizeMicronspublic static boolean setPixelSizeMicrons(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
 
- 
setPixelSizeMicronspublic 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
 
- 
setPixelSizeMicronsSet 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
 
- 
replaceClassificationApply a new classification to all objects in the current hierarchy with a specified classification.- Parameters:
- originalClassName- name of the original classification
- newClassName- name of the new classification
 
- 
replaceClassificationApply a new classification to all objects in the current hierarchy with a specified original classification.- Parameters:
- originalClass- the original classification
- newClass- the new classification
 
- 
replaceClassificationpublic static void replaceClassification(PathObjectHierarchy hierarchy, PathClass originalClass, PathClass newClass) Apply a new classification to all objects with a specified original classification in the provided hierarchy.- Parameters:
- hierarchy- the hierarchy containing the objects
- originalClass- the original classification
- newClass- the new classification
 
- 
replaceClassificationpublic static void replaceClassification(Collection<PathObject> pathObjects, PathClass originalClass, PathClass newClass) Apply a new classification to all objects with a specified original classification in an object collection.- Parameters:
- pathObjects-
- originalClass-
- newClass-
 
- 
resolveHierarchypublic static void resolveHierarchy()Resolve the location of annotations in the current hierarchy by setting parent/child relationships.
- 
resolveHierarchyResolve the location of annotations in the specified hierarchy by setting parent/child relationships.- Parameters:
- hierarchy-
 
- 
insertObjectsInsert objects into the hierarchy, resolving their location and setting parent/child relationships.- Parameters:
- pathObjects-
 
- 
insertObjectsInsert object into the hierarchy, resolving its location and setting parent/child relationships.- Parameters:
- pathObject-
 
- 
mergePointsForAllClassespublic 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
 
- 
mergePointsForSelectedObjectClassespublic 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
 
- 
splitAllAnnotationAreasByLinespublic 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:
 
- 
splitAllAnnotationAreasByLinespublic 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 value
- removeLines- optionally remove the lines after performing the splitting
- Returns:
- true if changes were made, false otherwise
- Since:
- v0.5.0
- See Also:
 
- 
splitAllAnnotationAreasByLinesSplit 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:
 
- 
splitAllAnnotationAreasByLinespublic static boolean splitAllAnnotationAreasByLines(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 use
- thickness- the thickness of the line; if greater than zero, the line will be buffered with a radius of half this value
- removeLines- optionally remove the lines after performing the splitting
- Returns:
- true if changes were made, false otherwise
- Since:
- v0.5.0
- See Also:
 
- 
splitSelectedAnnotationAreasByLinespublic 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:
 
- 
splitSelectedAnnotationAreasByLinespublic 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 value
- removeLines- optionally remove the lines after performing the splitting
- Returns:
- true if changes were made, false otherwise
- Since:
- v0.5.0
- See Also:
 
- 
splitSelectedAnnotationAreasByLinesSplit 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:
 
- 
splitSelectedAnnotationAreasByLinespublic static boolean splitSelectedAnnotationAreasByLines(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 use
- thickness- the thickness of the line; if greater than zero, the line will be buffered with a radius of half this value
- removeLines- optionally remove the lines after performing the splitting
- Returns:
- true if changes were made, false otherwise
- Since:
- v0.5.0
- See Also:
 
- 
splitSpecifiedAreasByLinespublic static boolean splitSpecifiedAreasByLines(PathObjectHierarchy hierarchy, Collection<? extends 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 use
- pathObjects- the objects to split; usually annotations, but they may be any object except for TMA cores
- thickness- the thickness of the line; if greater than zero, the line will be buffered with a radius of half this value
- removeLines- optionally remove the lines after performing the splitting
- Returns:
- true if changes were made, false otherwise
- Since:
- v0.5.0
- See Also:
 
- 
duplicateSelectedAnnotationspublic static boolean duplicateSelectedAnnotations()Duplicate the selected annotations in the current hierarchy.- Returns:
- true if changes are made to the hierarchy, false otherwise
 
- 
duplicateSelectedAnnotationsDuplicate the selected annotations in the specified hierarchy.- Parameters:
- hierarchy-
- Returns:
- true if changes are made to the hierarchy, false otherwise
- Since:
- v0.4.0
 
- 
copySelectedObjectsToPlanepublic 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:
 
- 
copySelectedObjectsToPlaneCopy 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:
 
- 
copySelectedObjectsToPlaneCopy 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
 
- 
copySelectedAnnotationsToPlanepublic 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:
 
- 
copySelectedAnnotationsToPlaneCopy 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:
 
- 
copySelectedAnnotationsToPlanepublic static boolean copySelectedAnnotationsToPlane(PathObjectHierarchy hierarchy, 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
 
- 
mergeAnnotationsMerge annotations for the current hierarchy.- Parameters:
- annotations- the annotations to merge
- Returns:
- true if changes were made the hierarchy, false otherwise
 
- 
mergeSelectedAnnotationspublic 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
 
- 
mergeAnnotationspublic static boolean mergeAnnotations(PathObjectHierarchy hierarchy, Collection<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
 
- 
mergeSelectedAnnotationsMerge 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:
 
- 
makeInverseAnnotationMake 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
 
- 
makeInverseAnnotationMake 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 created
- pathObject- the existing object defining the ROI to invert
- Returns:
- true if an inverted annotation is added to the hierarchy, false otherwise
 
- 
makeInverseAnnotationpublic 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
 
- 
makeInverseAnnotationMake 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
 
- 
makeInverseAnnotationpublic static boolean makeInverseAnnotation(ImageData<?> imageData, Collection<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 annotation
- pathObjects- the annotation to invert
- Returns:
- true if an inverted annotation is added to the hierarchy, false otherwise.
 
- 
runObjectClassifierApply 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
 
- 
runObjectClassifierpublic static void runObjectClassifier(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
 
- 
loadObjectClassifierpublic static 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
 
- 
loadDensityMappublic 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
 
- 
locateFileLocate 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:
 
- 
locateFileLocate 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 path
- searchDepth- 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:
 
- 
findDensityMapHotspotspublic 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, see- loadDensityMap(String)
- channel- channel number (usually 0)
- numHotspots- the maximum number of hotspots to generate within each selected object
- minCounts- the minimum value in the 'counts' channel; this is used to avoid generating hotspots in areas with few objects
- deleteExisting- if true, similar annotations will be deleted from the image
- peaksOnly- if true, hotspots will only be generated at intensity peaks in the density map
- Throws:
- IOException
 
- 
findDensityMapHotspotspublic static void findDensityMapHotspots(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 data
- densityMapName- name of the density map builder, see- loadDensityMap(String)
- channel- channel number (usually 0)
- numHotspots- the maximum number of hotspots to generate within each selected object
- minCounts- the minimum value in the 'counts' channel; this is used to avoid generating hotspots in areas with few objects
- deleteExisting- if true, similar annotations will be deleted from the image
- peaksOnly- if true, hotspots will only be generated at intensity peaks in the density map
- Throws:
- IOException
 
- 
findDensityMapHotspotspublic static void findDensityMapHotspots(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 data
- densityMap- builder to generate a density map
- channel- channel number (usually 0)
- numHotspots- the maximum number of hotspots to generate within each selected object
- minCounts- the minimum value in the 'counts' channel; this is used to avoid generating hotspots in areas with few objects
- deleteExisting- if true, similar annotations will be deleted from the image
- peaksOnly- if true, hotspots will only be generated at intensity peaks in the density map
- Throws:
- IOException
 
- 
createAnnotationsFromDensityMappublic 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 disk
- thresholds- map between channels to threshold (zero-based index) and thresholds to apply
- pathClassName- name of the classification for the annotations that will be created
- options- additional options when creating the annotations
- Throws:
- IOException
- See Also:
 
- 
createAnnotationsFromDensityMappublic static void createAnnotationsFromDensityMap(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 generated
- densityMapName- the name of the density map within the current project, or file path to a density map to load from disk
- thresholds- map between channels to threshold (zero-based index) and thresholds to apply
- pathClassName- name of the classification for the annotations that will be created
- options- additional options when creating the annotations
- Throws:
- IOException
- See Also:
 
- 
createAnnotationsFromDensityMappublic static void createAnnotationsFromDensityMap(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 corresponds
- densityMap- the density map to use
- thresholds- map between channels to threshold (zero-based index) and thresholds to apply
- pathClassName- name of the classification for the annotations that will be created
- options- additional options when creating the annotations
- Throws:
- IOException
- See Also:
 
- 
getLoggerpublic static org.slf4j.Logger getLogger()Get the logger associated with this class.- Returns:
- the logger
 
- 
getLoggerGet a logger with a specified name.- Parameters:
- name- the name of the logger
- Returns:
- the logger
- Since:
- v0.6.0
 
- 
getLoggerGet a logger associated with a specified class.- Parameters:
- cls- the class used to determine the logger name
- Returns:
- the logger
- Since:
- v0.6.0
 
- 
loadPixelClassifierLoad 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
 
- 
addPixelClassifierMeasurementsAdd measurements from pixel classification to the selected objects.- Parameters:
- classifierName- the pixel classifier name
- measurementID-
- See Also:
 
- 
addPixelClassifierMeasurementsAdd measurements from pixel classification to the selected objects.- Parameters:
- classifier- the pixel classifier
- measurementID-
 
- 
createDetectionsFromPixelClassifierpublic 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 classifier
- minArea- the minimum area of connected regions to retain
- minHoleArea- the minimum area of connected 'hole' regions to retain
- options- additional options to control how objects are created
- Throws:
- IOException
- IllegalArgumentException
- See Also:
 
- 
createDetectionsFromPixelClassifierpublic static void createDetectionsFromPixelClassifier(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 classifier
- minArea- the minimum area of connected regions to retain
- minHoleArea- the minimum area of connected 'hole' regions to retain
- options- additional options to control how objects are created
- Throws:
- IOException
 
- 
createAnnotationsFromPixelClassifierpublic 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 classifier
- minArea- the minimum area of connected regions to retain
- minHoleArea- the minimum area of connected 'hole' regions to retain
- options- additional options to control how objects are created
- Throws:
- IOException
- IllegalArgumentException
- See Also:
 
- 
createAnnotationsFromPixelClassifierpublic static void createAnnotationsFromPixelClassifier(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 classifier
- minArea- the minimum area of connected regions to retain
- minHoleArea- the minimum area of connected 'hole' regions to retain
- options- additional options to control how objects are created
- Throws:
- IOException
 
- 
classifyDetectionsByCentroidClassify 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
 
- 
classifyDetectionsByCentroidClassify 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
 
- 
checkMinVersionCheck 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:
 
- 
checkVersionRangepublic 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:
 
- 
removeObjectsOutsideImagepublic 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:
 
- 
removeObjectsOutsideImagepublic 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:
 
- 
removeObjectsOutsideImageRemove 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:
 
- 
removeObjectsOutsideImageRemove objects that are entirely or partially outside the specified image.- Parameters:
- imageData- the image data, including a hierarchy and server to use
- 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:
- Implementation Note
- TMA cores outside the image can't be removed, because doing so would potentially mess up the TMA grid.
 
- 
removeOrClipObjectsOutsideImagepublic 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:
 
- 
removeOrClipObjectsOutsideImageRemove 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:
 
- 
removeObjectsTouchingImageBoundspublic 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
 
- 
removeObjectsTouchingImageBoundsRemove 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
 
- 
removeObjectsTouchingImageBoundspublic static boolean removeObjectsTouchingImageBounds(ImageData<?> imageData, Predicate<PathObject> filter) Remove objects that touch the boundary of the specified image.- Parameters:
- imageData- the image to process
- 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
 
- 
removeObjectsTouchingSelectedBoundspublic 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
 
- 
removeObjectsTouchingSelectedBoundsRemove 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
 
- 
removeObjectsTouchingSelectedBoundspublic static boolean removeObjectsTouchingSelectedBounds(PathObjectHierarchy hierarchy, Predicate<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 use
- 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
 
- 
removeChildObjectsTouchingSelectedBoundspublic 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
 
- 
removeChildObjectsTouchingSelectedBoundsRemove 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
 
- 
removeChildObjectsTouchingSelectedBoundspublic static boolean removeChildObjectsTouchingSelectedBounds(PathObjectHierarchy hierarchy, Predicate<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 use
- 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
 
- 
simplifyAllAnnotationspublic static void simplifyAllAnnotations(double altitudeThreshold) Simplify all annotations to a given threshold- Parameters:
- altitudeThreshold- altitude value for simplification
- See Also:
 
- 
simplifySelectedAnnotationspublic static void simplifySelectedAnnotations(double altitudeThreshold) Simplify the currently selected annotations to a given threshold- Parameters:
- altitudeThreshold- altitude value for simplification
- See Also:
 
- 
simplifySpecifiedAnnotationspublic static void simplifySpecifiedAnnotations(Collection<? extends PathObject> pathObjects, double altitudeThreshold) Simplify a set of pathObjects to a given threshold.- Parameters:
- pathObjects- the path objects
- altitudeThreshold- altitude value for simplification
- See Also:
 
- 
convertSelectedObjectsToPointspublic 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:
 
- 
convertDetectionsToPointspublic 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:
 
- 
convertSpecifiedObjectsToPointspublic static void convertSpecifiedObjectsToPoints(PathObjectHierarchy hierarchy, Collection<? extends 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 in
- pathObjects- 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.