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 import binary masks & create annotations, adding them to the current object hierarchy. | |
| * | |
| * It is assumed that each mask is stored in a PNG file in a project subdirectory called 'masks'. | |
| * Each file name should be of the form: | |
| * [Short original image name]_[Classification name]_([downsample],[x],[y],[width],[height])-mask.png | |
| * | |
| * Note: It's assumed that the classification is a simple name without underscores, i.e. not a 'derived' classification | |
| * (so 'Tumor' is ok, but 'Tumor: Positive' is not) | |
| * |
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 export pixels & annotations for whole slide images. | |
| * | |
| * The image can optionally be tiled during export, so that even large images can be exported at high resolution. | |
| * (Note: In this case 'tiled' means as separate, non-overlapping images... not a single, tiled pyramidal image.) | |
| * | |
| * The downsample value and coordinates are encoded in each image file name. | |
| * | |
| * The annotations are exported as 8-bit labelled images. | |
| * These labels depend upon annotation classifications; a text file giving the key is written for reference. |
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 export pixels & annotations for TMA images. | |
| * | |
| * The downsample value and coordinates are encoded in each image file name. | |
| * | |
| * The annotations are exported as 8-bit labelled images. | |
| * These labels depend upon annotation classifications; a text file giving the key is written for reference. | |
| * | |
| * The labelled image can also optionally use indexed colors to depict the colors of the | |
| * original classifications within QuPath for easier visualization & comparison. |
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
| /** | |
| * Count the annotations for each classification, for all images in a project. | |
| * | |
| * This works by looping through all the images in a project, and checking for the existence of a data file. | |
| * | |
| * If a data file is found, read the hierarchy (no need to open the whole image), and print the number of objects, | |
| * the total number of annotations & the number of annotations split by classification. | |
| * | |
| * @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
| /** | |
| * Update paths within a QuPath project to handle images that have been moved. | |
| * | |
| * This works by first finding image paths that don't point to any existing files, | |
| * and then prompting the user to select a base directory below which the script | |
| * will search for image files with the same names. | |
| * | |
| * The process is a bit cumbersome, partly because there is no easy way to set | |
| * the path for an existing ProjectImageEntry. | |
| * |
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
| /** | |
| * Create a QuPath classifier by scripting, rather than the 'standard' way with annotations. | |
| * | |
| * This selects training regions according to a specified criterion based on staining, | |
| * and then creates a classifier that uses other features. | |
| * | |
| * The main aim is to show the general idea of creating a classifier by scripting. | |
| * | |
| * @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 ROIs made in QuPath as .zip files that can be imported into ImageJ. | |
| * | |
| * This makes several assumptions: | |
| * - the rois apply to the whole image, without offsets or downsampling | |
| * - only the outer ROI for cells is export (rather than the outer ROI + nucleus) | |
| * - the image is 2D (i.e. it doesn't attempt to set z-slice properties) | |
| * | |
| * The ROIs will be put into a 'rois' subdirectory of the QuPath project directory. | |
| * |
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
| /** | |
| * Try to extract the label from an image and show this with enhanced contrast using ImageJ as the viewer. | |
| * | |
| * This is mostly intended for .czi files, where currently the label seems to be 16-bit | |
| * and displays as entirely black in QuPath. | |
| * | |
| * It assumes that the label exists as an 'associated image' within the server. | |
| * | |
| * This has been tested with QuPath v0.2 - it may not work with other versions. | |
| * |
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
| /** | |
| * Replace (selected) annotations with ROIs containing holes with filled-in versions. | |
| * | |
| * @author Pete Bankhead | |
| */ | |
| import qupath.lib.objects.PathAnnotationObject | |
| import qupath.lib.roi.AreaROI | |
| import qupath.lib.roi.PathROIToolsAwt | |
| import qupath.lib.scripting.QPEx |
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
| /** | |
| * Proof-of-concept script showing one whole slide image as an overlay on top | |
| * of another within QuPath. | |
| * | |
| * Note that this script simply overlays the *same* image that is currently open; | |
| * therefore it may not be immediately obvious that anything has happened. | |
| * | |
| * Uncomment the line | |
| * g2d.translate(1000, 1000) | |
| * if you want to convince yourself that something *has* actually happened, |