Digital Chalkley point graticule overlay


I was wondering if there is a way to overlay a Chalkley point graticule for microvessel assessment in either QuPath or ImageJ?
I’ve tried to search online for a plugin but struggling to find one.

Would really appreciate any help! Thanks!

Hi @bk15 QuPath doesn’t have such a feature, and I’m not aware of any extensions. The closest thing is the regular grid (you can change the spacing in the preferences).

It sounds like something that could potentially be added to QuPath, but I don’t know enough about how to design it properly. Do you know of any good references that describe in detail how it should be implemented?

Edit 1: For ImageJ I’ve seen this:
I didn’t look closely enough to see if there is a plugin/macro available for download.

Edit 2: See also How to segment, label and compute features on microvessel density images using ImageJ?

Thanks so much for your reply!
Unfortunately there is no plugin or macro to download from that paper, however I have found a macro that is very close to what I am after:

// This macro draws 25 random dots on the active
// image in the current foreground color.

dotSize = 25;
  width = getWidth();
  height = getHeight();
  for (i=0; i<25; i++) {
      x = random()*width-dotSize/2;
      y = random()*height-dotSize/2;
      makeOval(x, y, dotSize, dotSize);
   run("Select None");

Wondering if you have any ideas how I can implement this as an overlay that can be rotated (if that’s even possible?!) to mimic the Chalkley graticule?

Thanks again!

QuPath screenshot.tif (1.7 MB)

Not sure if it is what you are after, but the Interactive Image Alignment feature can be used to overlay two images. Also @phaub has a variant of this - a nice tool for combining images into a new image.

I suspect it might be easier to add 25 points randomly using the points tool and a script, in QuPath at least. You could create a script that lets you click on a point, and then it generates a circle/square annotations and 25 point objects within it - or something similar. That would also let you do things like find the distance to the nearest spot from any other object quite easily.

Thanks for your reply. I have tried the image alignment feature but unfortunately not had any success.
Your suggestion about the script that generates the circle with 25 point objects in it sounds like it could work (although I would need to be able to rotate the annotation so that the points move with it). Please would you be able to advise me how to create this kind of script? I do not really have any coding experience :confused:

Thanks again!

1 Like

I think that would be a bit more than I can directly handle at the moment - but if anyone does take this up, I think it would work as follows:

  1. Generate the object and the random spots. Store the XY Coordinates in the Name of the object. 1 Script
  2. If the object is moved, calculate the affine transformation between the initial centroids in the name and the current centroids, and apply that to the spots.

Not sure how to handle the angle, since I think rotating most objects changes their type… there might have been another post on this elsewhere.

It does look like this would require coding experience - maybe there is another way to come at the image analysis problem you are trying to solve instead. The method itself sounds kind of outdated - something that is a holdover from manual counting in microscopes. You can sample entire populations now or create random subsets of populations. Alternatively, since you can generate spots randomly, there is no need to keep a single object or set of points and rotate it - that was only necessary when people were limited by the existence of a physical object.

If you really want to use a single “object” the interactive image alignment is your best bet since you can easily move and rotate a second, semi-transparent image on top of your tissue image. You will likely need to resize it to make the process work for your sample, though.

It sounds to me that if Objects → Annotations… → Rotate annotation handled point annotations (sadly, at the moment it doesn’t) then that would be the cleanest solution.

Then it is only really a matter of generating the random points, which can be done in a similar way to the ImageJ macro.

I’ll look into it, but might need a few days.


The other issue might be moving the points if they are a single set of points. If the user clicks and drags a single point, they move only that point. Not the set of points. That’s why I was imagining a container for them - some kind of area annotation. Maybe I missed something though - like the search bar in the project :slight_smile:

Thanks @petebankhead I look forward to your thoughts on whether rotating the point annotations in possible :slight_smile:

Thanks for advising.
I do agree regarding Chalkley count being slightly outdated, given the scope of digital analysis. However, my project involves developing (or at least attempting to!!) a more automated method for vessel counting so I am looking to see if I can compare to Chalkley method, or use Chalkley as a back-up method if mine doesn’t work. Unfortunately I only have access to digitised slides hence my hoping to come up with a digital overlay

1 Like

I’ve written a script to generate random points in QuPath here:

It should be possible to rotate point annotations in v0.3. If you want to build it early for testing, the code is at GitHub - qupath/qupath at dev-0.3 (make sure that the dev-0.3 branch is selected).

As I understand it, only rotation is needed. But, handily, Objects → Annotations… → Rotate annotation support translation as well anyway :slight_smile:


Thanks Pete, this is so very close to what I would be after!!

To mimic the Chalkley the points would need to be able to be merged with the ellipse so that they rotate with the ellipse, as if mimicking the eyepiece graticule.
Whilst I’m not so great with coding, if rotating points is only possible on version 3 I will have to consider building it!

As an alternative, I did test if I could draw ellipses over the points (then delete all points), then merge the inner ellipses with the large outer one, in order to rotate all the annotations together in a sort of overlay - but I end up with this circular polygon ROI when merging… is there a way around this at all?

(Don’t know if what I’m suggesting above is even possible?! Very much a QuPath novice!!)

Thanks everyone for advising so far - really appreciate all the help!

1 Like

Hi @bk15 hopefully v0.3 isn’t far away… I’ll ask folks to start testing it later today, and continue in earnest on Monday.

I’m afraid if you start merging and manipulating ROIs, you quickly enter the world of Java Topology Suite – which doesn’t have ellipses, just polygons. So the end result tends to be something like what you show in your bottom image.


Maybe they could subtract the annotations instead, leaving holes in a single annotation? * Through the GUI or a short script.
Example of doing it manually - the order of selection is important in that the object you are subtracting from has to be last.

1 Like

Thanks for advising! Look forward to v0.3 :slight_smile:

This is great, thanks so much! I’ve tested it out and the whole thing rotates too!
I don’t seem to be able to move the new Geometry ROI around though, it just moves me to another part of my slide when I try to use the move tool…am I missing a trick?? :confused:

1 Like

It might be still Locked - specifically to prevent you from moving it. It is necessary to lock it when making the holes. Subtraction should unlock it, but you may need to manually unlock it. Same steps as locking in the GIF.

Or if you click into one of the holes - that is “outside” of the annotation. You need to click somewhere in the big circle but not in a small hole.

1 Like

Ah thank you! That’s working great now - thanks so much!

1 Like