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
/** | |
* Example QuPath startup script to open the brightness/contrast dialog & channel viewer, | |
* optionally setting their location. | |
* | |
* Originally posted at https://forum.image.sc/t/saving-window-layout/103763/3 | |
* | |
* Written for QuPath v0.5.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
/** | |
* Quick Groovy script to get the location of a window in a JavaFX application. | |
* Originally posted at https://forum.image.sc/t/saving-window-layout/103763/3 | |
* Written for QuPath v0.5.x | |
*/ | |
import javafx.stage.Window | |
String title = "Brightness & contrast" |
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 help convert one or more images to PNG or JPEG, | |
* while also reducing the dimensions and file size. | |
* | |
* The purpose is to help convert images for websites in a way that balances file size with quality. | |
* | |
* Given an image file or directory containing multiple files (usually screenshots), this will: | |
* - Strip away any unnecessary alpha channel | |
* - Resize so that the width and height are <= a specified maximum dimension | |
* - Iteratively try to convert the image to PNG and/or JPEG by |
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 copy images into a project. | |
* This is used to help make the project directory self-contained. | |
* | |
* By default, local files are copied into an 'images' subdirectory of the project. | |
* | |
* Limitation: This only handles local files that are currently outside the project directory, | |
* and excludes images that are known to have 'multipart' files (e.g. dicom, mrxs, vsi & zarr). | |
* | |
* Warning: This has not been very extensively tested! |
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 create concentric rings around an annotation. | |
*/ | |
// Number of rings to create | |
int nRings = 5 | |
// Define distance in µm, then convert (or just go straight to defining in pixels) | |
double distanceMicrons = 100 | |
double distancePixels = distanceMicrons / getCurrentServer().getPixelCalibration().getAveragedPixelSizeMicrons() |
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
/** | |
* 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. | |
* |
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 export images corresponding to all the annotation bounding boxes in an image. | |
* Written for QuPath v0.4.3. | |
*/ | |
// Export at full resolution (or change this value) | |
double downsample = 1.0 | |
// Export to a subdirectory of the current project | |
def dir = buildPathInProject("export") |
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 a convex or concave hull annotation from the selected objects. | |
* | |
* The calculations are performed using Java Topology Suite's 'ConcaveHullOfPolygons' class - | |
* see https://locationtech.github.io/jts/javadoc/org/locationtech/jts/algorithm/hull/ConcaveHullOfPolygons.html | |
* | |
* This was written for QuPath v0.4.3. | |
* If it's useful enough, a similar feature might be added to QuPath directly in the future. | |
* | |
* @author Pete Bankhead |
NewerOlder