Cannot detect centroid distances in 2D when I have multiple planes in my images

Hi There,

I am looking to use QuPath’s “Detect the centroid distances 2D” function to detect the nearest cell of a different type in multi-colour fluorescent images.

A few things about my images: I have taken multi-channel fluorescent images with blue (which is DAPI), green and red (which are two different cell types I am interested in). I have detected the cell nuclei using the DAPI channel, and I have overlaid the green and red channels on to the DAPI channel to find all the green and red cells that have a nuclei. I then want to know the closest green cell to every red cell.

After running cell detection/classification and finding all my green and red cells the “Detect centroid distances 2D” feature works beautifully when I have taken single plane images. However, if I have imaged multi z-stacks (in my case 3 z-planes), the feature does not work on these multi-stack images. Note, I am only drawing annotations and detecting cells within those annotations on a single plane, then trying to detect centroid distances in that single plane. I’m not attempting to find centroid distances across multi z’s, which I know is not yet possible.

In summary, the “Detect centroid distances 2D” function won’t work when I have a multi-plane image, even when only trying to use it on annotations/detected cells in a single plane.

Is there any work around this? I’d dearly love to avoid exporting all of the XY coordinates for every cell (there are thousands of each type) and working this out manually in excel!!

Note: I would separate my planes, but my images are very large files (.vsi files) taken on a slide scanner, so doing this is very difficult in FIJI without reducing the image quality. I also cannot find a way to do this on the program used to take the image. Is there a way to split the planes in QuPath?

1 Like

Hi @Gary1 thanks for the clear description, I can replicate the problem. This should work, so it seems like it’s a bug in QuPath – I’ll investigate in the next few days and get back to you.


Thanks Pete, I really appreciate it!

Hi @Gary1 I’ve logged the bug here and already fixed it in the code – the fix will be in the next QuPath release (hopefully within a few weeks).


Amazing, thanks so much for the quick reply and resolution. This will help immensely with my analysis.

Very Best,


1 Like