This file contains 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 convert all polyline annotations to polygons in QuPath. | |
* Written for QuPath v0.5 (may work in other versions). | |
*/ | |
def lineObjects = getAnnotationObjects().findAll {it.getROI().isLine()} | |
def polygonObjects = [] | |
def selectedObjects = getSelectedObjects() as List | |
for (lineObject in lineObjects) { | |
def line = lineObject.getROI() |
This file contains 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
/** | |
* QuPath script to calculate areas (e.g. of tumor) based upon classified cells only. | |
* | |
* It works by using a distance transform applied to binary images generated from the | |
* objects of each class, and then assigns each pixel to the closest object. | |
* | |
* Having done this, new annotations are generated for these regions. | |
* | |
* WARNINGS! | |
* - This will remove *all* previous annotations & replace them with new annotations |
This file contains 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
/** | |
* Convert TIFF fields of view to a pyramidal OME-TIFF. | |
* | |
* Locations are parsed from the baseline TIFF tags, therefore these need to be set. | |
* | |
* One application of this script is to combine spectrally-unmixed images. | |
* Be sure to read the script and see where default settings could be changed, e.g. | |
* - Prompting the user to select files (or using the one currently open the viewer) | |
* - Using lossy or lossless compression | |
* |
This file contains 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
/** | |
* Demonstration of how to use ImageJ + QuPath to detect stained regions in | |
* a brightfield image. | |
* | |
* @author Pete Bankhead | |
*/ | |
import ij.CompositeImage | |
import ij.IJ |
This file contains 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
/** | |
* Add pixel classifier measurements to all cells in an image. | |
* | |
* This is intended to overcome the fact that measurements can be quite slow because they aren't parallelized. | |
* | |
* Written for QuPath v0.3.2. | |
* See https://forum.image.sc/t/qupath-measure-pixel-classifier-area-per-cell-detection-for-wsis/72701 | |
* | |
* Warning! This hasn't been extensively tested - please report any problems on the forum. | |
* |
This file contains 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
/** | |
* Add a 'small' image overlay to the image currently open in the QuPath viewer. | |
* Here, 'small' indicates something that ImageIO can handle, and which isn't pyramidal. | |
* | |
* @author Pete Bankhead | |
* | |
* Updated 1/2023 to be compatible with QuPath v0.4.x | |
*/ | |
This file contains 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 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 fixed-sized square annotations around the points of a selected | |
* point annotation. | |
* | |
* Written for QuPath v0.4 and v0.5. | |
* See https://forum.image.sc/t/is-it-possible-to-create-annotations-on-click/79270 | |
* | |
* Edited 12/2023 to support multiple selected point annotations (not just one). | |
* | |
* @author Pete Bankhead |
This file contains 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
/** | |
* Groovy script to generate a batch script to launch QuPath while setting the PATH | |
* from a conda environment. | |
* | |
* This is useful to add GPU support with Deep Java Library (DJL) without needing to install | |
* CUDA system-wide. | |
* | |
* This script was written for QuPath v0.5. | |
* You should read the top part and change the variables to match what you need. | |
*/ |
This file contains 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
/** | |
* QuPath v0.4.3 script to threshold probability outputs from a pixel classifier. | |
* | |
* By default, converting the pixel classifier output to probabilities will always | |
* apply a softmax operation and take the class with the highest probability. | |
* | |
* This script provides an alternative, whereby you can specify a probability threshold | |
* for one or more channels, and threshold to create objects from that. | |
* Using a higher threshold can then restrict the object creation of more confident predictions. | |
* |
NewerOlder