Hi!
I am using Qupath v2m4 to analyse some whole slide images. I have been able to automate some very basic analysis with the script editor on older version of QuPath: cell detection, load classifier and export annotation and detection results. Now, I wanted to add to the analysis also spot detection. I have no experience with groovy at all, so I am sure there may be something wrong with my script (I feel it may be in the export result part), but I can manage to fix it.
What I am doing is, cell detection first, then I apply the classifier and after that I perform subcellular detection. At the end of the script I export both the annotation and detection results:
setImageType('FLUORESCENCE');
// select annotations
selectAnnotations();
// cell detection
runPlugin('qupath.imagej.detect.cells.WatershedCellDetection', '{"detectionImage": "DAPI 100% - 345/455", "requestedPixelSizeMicrons": 0.5, "backgroundRadiusMicrons": 0.0, "medianRadiusMicrons": 0.5, "sigmaMicrons": 1.2, "minAreaMicrons": 20.0, "maxAreaMicrons": 150.0, "threshold": 1000.0, "watershedPostProcess": true, "cellExpansionMicrons": 1.0, "includeNuclei": true, "smoothBoundaries": true, "makeMeasurements": true}');
// Load and run a trained classifier
def pathClassifier = buildFilePath(PROJECT_BASE_DIR , 'classifiers', '190822_classifier.qpclassifier')
runClassifier(pathClassifier);
// Run the foci detection
runPlugin('qupath.imagej.detect.cells.SubcellularDetection', '{"detection[Channel 1]": -1.0, "detection[Channel 2]": 7000.0, "detection[Channel 3]": -1.0, "doSmoothing": true, "splitByIntensity": true, "splitByShape": false, "spotSizeMicrons": 1.0, "minSpotSizeMicrons": 0.1, "maxSpotSizeMicrons": 2.0, "includeClusters": false}');
// Export the results - Annotations
def name = getProjectEntry().getImageName() + '.txt'
def pathAnnotation = buildFilePath(PROJECT_BASE_DIR, 'annotation results')
mkdirs(pathAnnotation)
pathAnnotation = buildFilePath(pathAnnotation, name)
saveAnnotationMeasurements(pathAnnotation)
print 'Results exported to ' + pathAnnotation
// Export the results - Detections
def pathDetection = buildFilePath(PROJECT_BASE_DIR, 'detection results')
mkdirs(pathDetection)
pathDetection = buildFilePath(pathDetection, name)
saveDetectionMeasurements(pathDetection)
print 'Results exported to ' + pathDetection
The script seemed to work when I ran it. No error popped and it was able to perform the 74 tasks. However, once done, it started 2 more tasks and at this point it freezed. I can get it to work with smaller annotations, but if I try to use annotations that cover the entire tissue it freezes as explained.
Any help with that? I thought there was a memory problem, so I tried on a more powerful computer but it didnāt solve the problem. Am I missing something in the script?
Any help is more that welcome!
Many thanks