Spatial Analysis - distance to annotation 2D: Performance in TMAs?

Hi everyone

I’m currently trying to do some kind of spatial analysis on a TMA (Distance to annotation 2D) using the following one-liner.

detectionToAnnotationDistances(false);

However I noticed that things go very slowly and eventually resulting in a “NaN” measurement for the “Distance to annotation Tumor µm” as soon as I process more than about 60 spots in the TMA.

My previously generated tumor annotations were based on a simple thresholder (using “very high” resolution).

Has anyone encountered similar issues? Does anyone have an idea how to get this (awesome!) new feature working in v0.2?

Appreciate your support!

When you say spots, do you mean 60 cores? 60 individual annotations? Are all cells NaN for the distance measurement or just some of the cells?

Does each core have an annotation? More details or images would be helpful.

Yes, I mean I am working with 64 cores right now.
within each of which I performed:

  1. watershed cell detection
  2. Classifying detctions based on DAB-thresholder: tumor (= red cells) vs. stroma (=yellow cells)
  3. creating annotations based on DAB-thresholder (surrounding tumor areas = blue annoations in the picture)

And yes, all cells are NaN for the distance measurement (compare very bottom left in picture) and basically every core has a tumor annotation.

Thanks for your help.

1 Like

Hmm, not sure what is happening. I tried this and didn’t have any problems with a 150 core .mrxs TMA. I even tried drawing annotations that were halfway out of TMAs, had holes in them, polylines, points, and other weird things.

Random thought, does the other distance measurement work? Or is that one broken too (might indicate some issue with the image file (tiling errors or something).

thanks for getting back to me.

Yeah the distance tools work and so does the “Distance to annotation” - measurement if I only dearray 9 TMA cores within the very same image (.mrxs too). That’s why I assumed it might be an issue of performance.

The cores contain about 1000 cells each and the tumor annotations (to which I want to measure the distance) are quite complex ROI (compare image).

@microluke I wasn’t working with TMAs when developing this command, and didn’t really consider the specifics of TMAs. As a result, the command is not very TMA-friendly at all. For example, it will also use annotations found in other cores.

You could try this alternative to see if it works better:


Make sure to read the comments… I have only just written it and only checked it quickly on one image. Please let me know if you find any problems or weirdness.

In general, performance is expected to be fairly terrible if you have a large number of complex annotations with many vertices – since the work involved in computing distances is pretty substantial. However, the script above might work rather a lot faster since it only worries about annotations within each core.

2 Likes

hi Pete,

That’s awesome, it worked perfectly fine and I was able to process the full TMA (300+ cores) within a couple of seconds! This tool is of great potential in my eyes as you can then go on and build classes based on the cell’s neighborhood…

thanks guys.

2 Likes