Counting is a common task in pathology, and in bioimage analysis more generally.
This section describes how QuPath can be used to manually count cells of different types - here, positive (brown) and negative (blue) tumor cells stained for Ki67.
The Ki67 image used in several of the figures below is from the OpenSlide freely-distributable test data (OS-2.ndpi).
The tools described here can be used for all kinds of manual counting tasks. However, we will return to this application in the sections Cell detection and Cell classification to show how more sophisticated tools within QuPath can be used to automate some or all of the specific task of cell counting.
Choosing a region¶
The first task is to find a suitable region in which cells should be counted, using the controls described in Viewing images to browse around the slide.
Having done this, it is optional - but helpful - to overlay a grid on top of the image to assist with counting in a fixed area. This can be done simply by clicking the Show grid toolbar button .
If necessary, the grid spacing can be adjusted under.
To begin counting in earnest, choose the Point tool in the toolbar . This will automatically open up a Counting panel containing a list of separate point annotations. You can then begin to click on the image, and a point will be created for each click.
At this stage, you should only click on cells that are of the same class (e.g. positive).
After you have clicked for a while, you may want to start counting cells of a different class (e.g. ‘negative’). Pressing the Add button in the counting panel will start a new annotation to collect your new set of points, but it’s likely you’ll want to distinguish between points more clearly. You can do this by double-clicking on an entry in the counting panel, and setting a more informative name and color. Whenever you click on the image, you will add points to whichever entry in the list is selected.
Saving & exporting¶
Once you’re finished, you may only need to read off the number of points from the list.
If you save the image data as normal, the points will be included in the
.qpdata file and can be recovered that way if necessary.
This is the preferred method of saving if you want to continue working on the data with QuPath.
However, you can also select the Save points option in the counting panel if you would like to export the coordinates of all your points for import elsewhere. This will save the coordinates in a simple tab-delimited format that may be useful to get the data into another software application.
Manual counting is generally not very pleasurable - although it can be necessary when considerable human expertise is needed. The following tips and hidden features may help (they assume that you have selected the tool).
- If you click on an existing point, within the same collection of points currently selected in the counting panel list, you can drag the point to move it to a new location.
- If you click on an existing point, within the same collection of points currently selected in the counting panel list, while holding down the Alt key, the point will be deleted.
- If you click on an existing point, within the a different collection of points to the one currently selected in the counting panel list, while holding down the Alt key, the collection of points containing the one that was clicked will become selected. This gives a fast way to switch between counting e.g. positive and negative cells, without needing to go back to the list - just Alt + click on the nearest cell belonging to the collection you want to switch to.