Analyzing Masson Trichrome images

Sample image and/or code

I have hundreds of MT-stained slides, where blue-colored material represents collagen. The more collagen fibers are deposited, the darker blue color gets. I graded the degree of collagen deposition from 1+ to 3+ in the image. Is it possible to write a script that classifies pixels in a ROI into 0 (not blue at all), 1+, 2+ and 3+? I want to put all the images I have into a project, designate ROIs for each image, and run the script for project. I’m familiar with writing scripts but not familiar with the pixel classification functionality… so i don’t know where to start. any kind of hints or reference documents would be appreciated!

  • Upload an original image file here directly or share via a link to a file-sharing site (such as Dropbox) – (make sure however that you are allowed to share the image data publicly under the conditions of this forum).
  • Share a minimal working example of your macro code.


  • What is the image about? Provide some background and/or a description of the image. Try to avoid field-specific “jargon”.

Analysis goals

  • What information are you interested in getting from this image?


  • What stops you from proceeding?
  • What have you tried already?
  • Have you found any related forum topics? If so, cross-link them.
  • What software packages and/or plugins have you tried?

Others may have cleaner ideas, but my first thought is:

Based on how strong your general blue staining is outside of collagen regions, and edge artifacts with the staining on the right, I would recommend a four step approach.

1 Pixel classifier to determine which areas you want to measure, and which are normal tissue or background/empty. The end result of this step is an “everything collagen I want to measure” annotation.
2. Three sets of thresholders on the measurable area, starting with 1+, then 2+, then 3+. Each is run, in order on the annotation created in the previous step.

For the final data, your 1+ area would be 1±2+ areas, 2+ would be 2±3+ areas, and 3+ would just be the 3+ area. The thresholders would all be run on the blue stain from the trichrome, so you will need to get your color vectors right. Usually that is done using single color stains, and if you have hundreds of slides, it might be worth using single color staining to get the right color vectors for your samples. Otherwise, best of luck with guesstimating.