This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Sum the area of detections with a specified classification. | |
| * Written for QuPath v0.3.2. | |
| * | |
| * @author Pete Bankhead | |
| */ | |
| // Define name of the class of detection objects | |
| def className = 'Positive' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Rotate all objects in an image by 180 degrees, translating them so they | |
| * remain within the image. | |
| * | |
| * Written for QuPath v0.3.2 | |
| * | |
| * See https://forum.image.sc/t/overlaying-h-e-and-tissue-annotations-in-qupath/71861/3 | |
| * | |
| * @author Pete Bankhead | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Export images of individual cell nuclei, with corresponding binary masks. | |
| * Written for QuPath v0.3.2. | |
| * | |
| * See https://forum.image.sc/t/generate-bounding-box-images-and-their-corresponding-xml-json-files-with-each-separate-annotation/68119/ | |
| * | |
| * @author Pete Bankhead | |
| */ | |
| import qupath.lib.images.servers.LabeledImageServer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Simple script for QuPath v0.3.2 that loops through all available channels, | |
| * displaying them in turn for 1 second. | |
| * | |
| * Written for https://forum.image.sc/t/how-do-i-script-qupath-to-change-the-displayed-channel/67216 | |
| * | |
| * @author Pete Bankhead | |
| */ | |
| def viewer = getCurrentViewer() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Export QuPath annotations in GeoJSON using calibrated pixel sizes | |
| * (rather than pixel units). | |
| * | |
| * Written for QuPath v0.3.2 | |
| * | |
| * @author Pete Bankhead | |
| */ | |
| // Define export directory (or null if we don't want to export, but just print the GeoJSON) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Script to add density map values to *some* detection centroids in QuPath v0.3, | |
| * limited to only use a subset of the detections on the image. | |
| * | |
| * It does this by copying the relevant objects and adding them to a temporary ImageData. | |
| * | |
| * Note that this hasn't been tested very much... and assumes a 2D image. | |
| * At the very least, you should use 'Measure -> Show measurement maps' as a sanity check. | |
| * | |
| * Written for https://forum.image.sc/t/qupath-number-of-detections-per-tile/64603/14 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Script to add density map values to detection centroids in QuPath v0.3. | |
| * | |
| * Note that this hasn't been tested very much... and assumes a 2D image. | |
| * At the very least, you should use 'Measure -> Show measurement maps' as a sanity check. | |
| * | |
| * Written for https://forum.image.sc/t/qupath-number-of-detections-per-tile/64603/10 | |
| * | |
| * @author Pete Bankhead | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Export annotations representing instance labels from an image. | |
| * | |
| * This supports exporting regions of an image (rather than the whole thing) | |
| * defined using the annotation shape (i.e. rectangle) or classification. | |
| * | |
| * See the comments for more information, and parameters to adjust. | |
| * | |
| * Note that the instance labels are applied globalled, so if multiple distinct | |
| * regions are export, the labels are not guaranteed to start from 1 or be consecutive |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def server = getCurrentServer() | |
| def manager = server.getManager() | |
| def annotations = [] | |
| for (def region in manager.getRegions()) { | |
| def roi = ROIs.createRectangleROI(region) | |
| def server2 = manager.getServer(region, 1) | |
| def name = server2.getMetadata().getName() | |
| def pathObject = PathObjects.createAnnotationObject(roi) | |
| pathObject.setName(name) | |
| annotations << pathObject |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Script to set the name of a cell to include the classifications of | |
| * all annotations that contain it, sorted by area. | |
| * The purpose of this is to include information about all the annotations | |
| * containing the cell in a measurement table, rather than only the immediate parent. | |
| * | |
| * Written for QuPath v0.3. | |
| */ | |
| // Get the current hierarchy and all cells |