Created
September 29, 2022 09:01
-
-
Save lacan/e7ee1ca4ace4d84ca79e43639061a8bd to your computer and use it in GitHub Desktop.
[Complex Workflow Demo] A demonstration of how a a QuPath workflow can become a script for complex analysis of multiplex data #QuPath #workflow #demo
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
// This workflow represents the end result that can be obtain by following Dr. Sara McArdle's "Running a complex project in QuPath" tutorial at https://www.youtube.com/watch?v=7AvuzAgHk5o | |
// @author Olivier Burri | |
// Prepare the image type | |
setImageType('FLUORESCENCE') | |
// Clean up the current image data, as we assume we will be starting from scratch | |
clearAllObjects() | |
// Directly create detections from a previously created pixel classifier called "Ck" | |
// This classifier will create two annotations of type "Tumor" and "Region*" | |
createAnnotationsFromPixelClassifier("Ck", 120.0, 120.0, "INCLUDE_IGNORED") | |
// Segment cells in the "Tumor" annotation with one set of cell detection settings | |
selectObjectsByClassification("Tumor") | |
runPlugin('qupath.imagej.detect.cells.WatershedCellDetection', '{"detectionImage": "DAPI", "requestedPixelSizeMicrons": 0.498, "backgroundRadiusMicrons": 20.0, "medianRadiusMicrons": 0.0, "sigmaMicrons": 1.5, "minAreaMicrons": 10.0, "maxAreaMicrons": 400.0, "threshold": 2.0, "watershedPostProcess": true, "cellExpansionMicrons": 5.0, "includeNuclei": true, "smoothBoundaries": true, "makeMeasurements": true}') | |
// Segment cells in the "Region*" annotation with another cell detection setting, as the nuclei morphology is different | |
selectObjectsByClassification("Region*") | |
runPlugin('qupath.imagej.detect.cells.WatershedCellDetection', '{"detectionImage": "DAPI", "requestedPixelSizeMicrons": 0.498, "backgroundRadiusMicrons": 0.0, "medianRadiusMicrons": 1.0, "sigmaMicrons": 1.0, "minAreaMicrons": 10.0, "maxAreaMicrons": 400.0, "threshold": 1.5, "watershedPostProcess": true, "cellExpansionMicrons": 5.0, "includeNuclei": true, "smoothBoundaries": true, "makeMeasurements": true}') | |
// Add Haralick features to the detected cells, needed for the Cd68 cell classifier | |
selectDetections() | |
runPlugin('qupath.lib.algorithms.IntensityFeaturesPlugin', '{"pixelSizeMicrons": 0.498, "region": "ROI", "tileSizeMicrons": 25.0, "channel1": true, "channel2": true, "channel3": true, "channel4": true, "channel5": true, "channel6": false, "channel7": false, "channel8": false, "doMean": false, "doStdDev": false, "doMinMax": false, "doHaralick": true, "haralickMin": 0.0, "haralickMax": 30.0, "haralickDistance": 1, "haralickBins": 32}'); | |
// Add smoothed features to the detected cells, needed for the Cd68 cell classifier | |
runPlugin('qupath.lib.plugins.objects.SmoothFeaturesPlugin', '{"fwhmMicrons": 50.0, "smoothWithinClasses": false}'); | |
// Run the composite classifier on all cells to find all multi-cell types | |
runObjectClassifier("CD8 FoxP3 Cd68 PD1") | |
// Run the Pdl1 classifier on both regions, so as to have the Pd11 area for each | |
selectObjectsByClassification("Tumor", "Region*") | |
createAnnotationsFromPixelClassifier("Pdl1", 2.0, 2.0) | |
// Add the distances to each annotation for all the cells, which can provide useful information | |
selectDetections() | |
detectionToAnnotationDistances(true) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment