diff --git a/scripts/qupath-utils/tools/deleteByClassification.groovy b/scripts/qupath-utils/tools/deleteByClassification.groovy index 4a3160a..324357d 100644 --- a/scripts/qupath-utils/tools/deleteByClassification.groovy +++ b/scripts/qupath-utils/tools/deleteByClassification.groovy @@ -1,7 +1,7 @@ /** * deleteByClassification.groovy * - * Delete all objects whose class correspondond to the specified one. + * Delete all objects whose class correspond to the specified one. * To delete objects whose class is empty, set an empty string. */ diff --git a/scripts/qupath-utils/tools/notDeleteByName.groovy b/scripts/qupath-utils/tools/notDeleteByName.groovy new file mode 100644 index 0000000..01b172d --- /dev/null +++ b/scripts/qupath-utils/tools/notDeleteByName.groovy @@ -0,0 +1,14 @@ +/** + * notDeleteByName.groovy + * + * Delete all annotations whose Name DO NOT correspond to the specified one. + */ + +// Define what Names to NOT delete +def nameToNotDelete = ["DH", "VH"] + +// Find objects to delete +toRemove = getAnnotationObjects().findAll { !nameToNotDelete.contains(it.getName())} + +// remove selected objects +removeObjects(toRemove, true) \ No newline at end of file