Colon biopsy IHC analysis

Hello!

I am new to image analysis and discovered this great forum, but I need some extrahelp please!

I am trying to count the number of IHC positive cells/crypt in colon biopsies using QuPath. I manually assigned separate areas for each crypt and was able to identify the positive cells/area, which I can see on the left side panel. I cannot find a way to export this data in an excel spreadsheet for statistical analysis. Could you please helps me out?

Many thanks in advance!

Hi there

Please look in the menu Measure > Show detection measurements

There are buttons at the bottom of the table to either copy the data to the clipboard or save a CSV file.

Best

Oli

Thank you so much!

As there are hundreds of such areas, can I introduce this into a script?

It will save ALL your detections directly. If you want them per area (and I assume that what you call “Area” is an Annotation, correct?) You can use Measure > Show annotation measurements

To save all this in a script you can use something like this

//Get full image name
def image_name = new File( getCurrentImageData().getServer().getPath()).getName()

// Remove colons that might cause issues, if you have subimages
def clean_image_name = image_name.replace(":", "-")

// Build the folder to save the results
def outputPath = buildFilePath(PROJECT_BASE_DIR, 'export')
mkdirs(outputPath )

// Name the results file after the current image
def detections_file = new File ( outputPath, clean_image_name+"_detections.csv" )

// Save the detections
saveDetectionMeasurements( detections_file .getAbsolutePath() )

// Name the results file after the current image
def annotations_file = new File ( outputPath, clean_image_name+"_annotations.csv" )

// Save the annotations
saveAnnotationMeasurements( annotations_file.getAbsolutePath() )

// Show we are done
println( "Detections saved in "+  detections_file.getAbsolutePath() )
println( "Annotations saved in "+  annotations_file.getAbsolutePath() )

Thank you so much! This is great help!

A few additional resources, though what works may depend on your version of QuPath, which I did not see included in your post.
Exporting each image’s data in a project


and merging many images data for a project into a single tab delimited file (which can be dragged into an Excel window).

Note that each of these methods, and the script above, require having created a project.

In case it helps, more general intro information here in a guide and here in the wiki.

Thank you very much! I will check these out and come back again, hopefully successful!

1 Like

I use QuPath version 0.2.0-m4.

I went through the links @Research_Associate kindly suggested. Indeed, what I needed to put in a spreadsheet for statistics is dynamic measurements.

I saved the annotations measurements and then merged the results. unfortunatelly, the combined table is a bit of a mess, probably because I played with measurements and saved different things just trying to figure out how it works. I will start my project again from scratch and hopefully it will come out right!

Thank you both so much! @oburri @Research_Associate

1 Like

In case it ever matters, you can also remove extra measurements using the Measurement Manager in the Measurement menu.

Yes, I saw the manager and will use it as I only need a few of the measurements. Thank you!