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
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 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 |
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 detected nuclei to cells and add measurements. | |
* Written for v0.3.x to answer | |
* https://forum.image.sc/t/is-it-possible-to-modify-the-cell-expansion-parameter-after-cells-have-been-detected/61665 | |
* | |
* Because adding intensity measurements is especially awkward, this should be improved in a future version. | |
* | |
* Note that the cell measurements are *not* equivalent to QuPath's built-in cell detection. | |
* They are calculated in a different way and have different names. | |
* |
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 threshold a single channel of an image. | |
* This can also be useful to convert a binary image into QuPath annotations. | |
* | |
* First written for https://forum.image.sc/t/rendering-wsi-as-overlay-on-top-of-another-wsi/52629/24?u=petebankhead | |
* | |
* @author Pete Bankhead | |
*/ | |
int channel = 0 // 0-based index for the channel to threshold |
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
/** | |
* Helper script to extract manually-annotated photos from an image, | |
* e.g. to help with digitising a photo album based upon scanning each page. | |
* | |
* The main thing this will do is to use the annotated polygons and perform | |
* a perspective transform to unwarp the photos. | |
* | |
* It can be applied in batch to many images. | |
* | |
* To use it |
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 group together clusters identified with Delaunay clustering. | |
* This provides several options: | |
* - clusters as classifications | |
* - clusters as object names | |
* - clusters as measurement values | |
* You should comment out the lines you don't want. | |
* | |
* Note that this is *very* rough and not guaranteed to work. | |
* It was written for https://forum.image.sc/t/cell-classification-within-a-segmented-region-in-histology-images/55507/21?u=petebankhead |
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 help track down memory leaks. | |
* Uses JavaCPP, some useful info at https://javadoc.io/static/org.bytedeco/javacpp/1.5.5/org/bytedeco/javacpp/Pointer.html | |
* | |
* @author Pete Bankhead | |
*/ | |
import org.bytedeco.javacpp.Pointer | |
System.gc() |
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
/** | |
* Find the 'brightest' circle in a fluorescence image in QuPath v0.2. | |
* | |
* This could be used for creating ROIs in a TMA image where each core is a separate image. | |
* | |
* @author Pete Bankhead | |
*/ | |
import ij.plugin.filter.RankFilters |
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
/** | |
* Slightly involved script to threshold a fluorescence multi-channel image | |
* in QuPath v0.2 to generate a new region of interest annotation. | |
* | |
* Might be used whenever there is too much variation for a threshold classifier | |
* to work. | |
* | |
* @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
/** | |
* Assign an ID to cells in QuPath using several different methods. | |
* This is useful if you want to export cell data from QuPath, process it elsewhere, | |
* and then bring the results back into QuPath again. | |
* | |
* Note: After checking the advantages/disadvantages, you should only need to use | |
* one of these. If it fits with your uses, my preference would be 3 or 4. | |
*/ | |
// Get the cell objects (all options start here) |