Scripting measurements per channel - mean, median, sddev


I wasn’t sure whether to post this under this thread or else the TMA cell data extraction thread for IF. I have tried some basic scripting using Github sample scripts (Making Measurements in QuPath · GitHub) and have not had luck yet.

I’m new to image analysis and have tried to average one of the detection measurement features in QuPath and then run batch processing for the whole cohort.

My goal is to get the mean, median, and standard deviation for detection measurement features for just three channels:Fcein, Cy3 and Cy5) so that I may compare protein abundance across each case as shown in the snip above. That way I won’t be exporting over 100 columns of information from QuPath.

What would be the best way to go about this? Would I need a script similar to Melvin’s? (Extract cell detection data from segmented areas/annotations in TMA (IF Images) - Qupath - #5 by melvingelbard)

Thank you,

Hi Bobby,
I’m not sure I completely understand what you need. I think you have one (or more?) annotations with some cell detections, each cell has many measurements, and you would like to calculate some basic summary stats about a handful of the measurements? But, you don’t want to have to export all of the (mostly unnecessary) data into excel first?

If so, you don’t need scripting for that. Pete made a new feature in 0.2.3 for easy measurement export. Go to Measurement > Export Measurements. Select all the images in your project that you want data from, change the export type to “Detections”, then click “Populate”. It will give you a dropdown list of all the measurements. You can uncheck anything you don’t care about and only export the things you want. Then, after you’ve exported only the measurements you want, you can calculate the summary stats in excel or prism.


Hello Sara,

I did not realise that In Hwa Um had posted about the same problem in a separate thread with Melvin about the same problem ( Script for averaging Detection measurement data - #2 by melvingelbard ). I think she’s explained the problem much better than I have.

The main problem is that we can see the mean and standard deviation once we look at the histogram from detection measurement and we want to be able to export this information for all cases.

I have now tried your suggestion of going via the drop-down and selecting only what I want. However, for only just one case, the export file was over 85 mb and failed to open. This is due to the vast number of detections in that case.


I think that there was upwards of one million detections in that particular case!

Any help would be greatly appreciated!

Thank you very much,

This looks like it has been solved in the other thread now. Thanks @melvingelbard !