This is a rough outline, and I plan on filling it in as I have time. From the Gitter page:
1. Generate your annotations, usually by Simple tissue detection, probably with a threshold in the 230-250 range. I tend to choose a very small "Max fill area" because we are generally looking at tissue specifically and avoid including large empty blood vessel cross sections in the cells/mm^2 measurements.
2. Use the SLIC superpixel segmentation to select regions. I usually like a more regular (higher regularization value) when I am merging the SLICs for cell generation, or a very low one if I am identifying areas for MTC or other types of stains that identify oddly shaped regions.
3. Add measurements and classify! I don't have much guidance here, just make sure you have enough of the right kind of measurements, I tend to have a lot of luck with either Harlick on OD if I am looking at larger patterns in cells, or just mean values on color vectors when I am looking for regions of a particular stain ("blue" for MTC again).
4. Convert the SLICs to Annotations:
At this point you have a couple of options. I usually handle this step by first deleting all of the original Annotations, or classifying the original Annotation as something that I am never going to use in my classifier, so that I can differentiate between the SLICs-as-annotations and the original full tissue annotations. You end goal here is to not merge the original Annotation in with the others, or it will overwrite/wipe out all of your SLIC data, and could cause problems down the line (or not, if you are really careful).
Next, use the script in Automate->Open Sample Scripts-> Create annotation from ROI. It is fairly generic and works on all "selected objects," so in this case you probably want to pick one type of classified detection to run this on at a time.
One line of code should do that for you:
selectObjects { p -> p.getPathClass() == getPathClass("Stroma") }
for example will select all of the SLICs you have classified as Stroma, or whatever you change the text of Stroma to.
5. At this point, it is probably important to mention that you now have a complete set of both detection SLICs and annotation SLICs, and you may want to selectDetections() and clearSelectedObjects(). Alternatively, you may want to selectAnnotations(), and assuming you already deleted your first, outer annotation, you can simply right click on one and set the class for the whole set. This would let you go back and select a different type of SLIC detection class, and perform the same steps. Another way to select the new annotations would be to use the same script above for selecting objects, except use == null, as everything else should have a classification at this point.
6. The slow part! Select all of your annotations that are of a given class, and mergeSelectedAnnotations() (many of these commands are available through the Objects menu as well, you don't have to script them all). This can take forrrrevvvvvver. If you SLICs are large enough not to interfere with cell generation, you may want to just select those annotations, and then run your Cell Detection on them, and sum the results outside of QuPath (export function).
Hope this helps. It can be scripted such that all of these steps are done with the click of a button, and can be applied across all of the slides in a project, but that requires a bit of tinkering, plus making sure your original annotations are correct and don't include artifacts!