Combining individual annotations with cell detections for analysis

Can someone point me in the right direction. I have 2 cell classes that have been stained with different antibodies. I have performed cell detection on both classes, which worked well but still left out a couple of cells. I selected the missing cells with annotations and put them in the same class as the detected cells they belong to. However the measurement table only displays the detected cells info. How can I include my cells I have selected with individual annotations in the analysis?

Once you have reassigned the class, you need to delete the annotations, if you are talking about the annotations measurement table. There are three different measurement tables, which have different uses. Also, including the version of QuPath you are using might allow for additional options depending on what you want to do. Exporting a list of all detections in an image will include all detections, regardless of which annotation they are within. Later versions of QuPath will include information about their parent annotations (0.1.3 and beyond). A more explicit workflow may help as well. I am not sure if you are overwriting the results of your previous cell detection or are simply classifying a set of cells.

If this was a trained classifier, I would always recommend saving a copy of the project (or data files) that contain the original training data/annotations.

So I performed cell detection in 2 rectangles for 2 different channels:
image
I also manually selected some cells that the detection failed to include with custom annotations. The hand picked cells and one detection rectangle were assigned to GFP class and the other rectangle detections to NeuN:
image
Do I have to just select the data from the annotation measurement table and add it to the detection measurement table?

@Mancunian Just to clarify: there isn’t any way to do this ‘by design’. The cell detection is intended to do everything in one go (detection using a nucleus marker & then measurement), and it isn’t possible to manually add cells later that behave in exactly the same way.

QuPath might support other forms of cell detection in the future, but in the meantime you might use a custom ImageJ macro or another script if you need something other than what the default method can provide.

That said, @Research_Associate often finds some way to work around things…

I see, thanks for the help. I have no problem detecting NeuN labelled cells but I just can’t do it for GFP because some neurons don’t have a strong signal. Even by changing the detection parameters several times I can’t get all of them in one detection.

Some of this you may already know, but…

It would really depend on what your data looks like, what you want to measure, and what your downstream analysis looks like. Annotations can be easily turned into cell objects, as has been posted in a few different places here and on the old forums, but the objects don’t really have a nucleus+cytoplasm, and do not start out with any intensity measurements. Intensity measurements can only be added to whole cell objects in older versions of QuPath, with some of the newer ones allowing Nucleus only measurements.

If all you need are counts, it might be worth looking intousing the points tool to select them, and then converting the points into detections, as that will clearly show where you had to manually add cells.
rant
Drawing things that look like cells without marking them in some way acts against the very reproducibility that makes sharing scripts for projects useful, as no one could repeat your experiment. However, no detection process is perfect, and low probability events can be both important and missed. If the DAPI/Hoechst signal isn’t picking up the cells, you might be looking at projections from a nucleus that is in another plane, and so those cells should be ignored (figuring you have some nuclear channel based on your above image, as there are clearly cells centered on low green areas). If you have no nuclear marker, that might be worth looking into.
/rant

If you are having trouble with the cell detection (which is based on a nuclear channel), CellProfiler has a lot more options and can define much weirder structures, from what I have seen. Or, as Pete recommended, try going through ImageJ where you would have more control.

1 Like