Photoshop: Provide image analysis for Microbiology

  • 6
  • Idea
  • Updated 7 years ago
  • Under Consideration
  • (Edited)
I would love to see a count of discreet selections in an image. My main motivation is biology research, where it is often vital to perform cell counts in an image.

It's incredibly easy to create a selection of luminescent cells on a plate via channels or the color range tool, and both methods account for variations in cell shape really well. But there's no way to see how many selections have been made. I really don't want to count to 30,000 by hand, even with the count tool!

Attached: A plate sample! :) Would be great to have an "Add count" option that let me set min and max size or luminosity and then drop the result into the measurements log.
Photo of James Monaco

James Monaco

  • 31 Posts
  • 8 Reply Likes
  • confident

Posted 7 years ago

  • 6
Photo of David Jensen

David Jensen

  • 131 Posts
  • 46 Reply Likes
Threshold the image. (or the selection in Quick Mask mode)
Scale it to 200% using nearest neighbor resampling
Load a channel as a selection.
Convert the selection to a work path using a tolerance of 0.5 pixels

Run this script: (paste the code into notepad/textEdit and save with a .jsx extension)

alert(activeDocument.pathItems[0].subPathItems.length)
Photo of Foster Brereton

Foster Brereton, Programmer

  • 41 Posts
  • 14 Reply Likes
Wow David -- slick!
Photo of Jeffrey Tranberry

Jeffrey Tranberry, Sr. Product Manager, Digital Imaging

  • 13741 Posts
  • 1590 Reply Likes
Indeed. Always awesome to see the scripting junkies swoop in with a great solution! Well done.
Photo of roman weiser

roman weiser

  • 61 Posts
  • 8 Reply Likes
David, this is fantastic!
Photo of James Monaco

James Monaco

  • 31 Posts
  • 8 Reply Likes
David--that's about as ingenious as I've ever seen. What a way to think outside the box!

(I'd still love to see a formalized image analysis tool built-in, but this just about solves it in the meantime!)
Photo of Foster Brereton

Foster Brereton, Programmer

  • 41 Posts
  • 14 Reply Likes
While David's comment is simply brilliant, I'm also interested to hear what other algorithms/utilities/etc would make Photoshop a more robust image analysis tool for you. A prioritized list would be best, but anything you can throw at us wouldn't hurt, either. Thanks!
Photo of Charles Badland

Charles Badland

  • 60 Posts
  • 4 Reply Likes
I was searching to see if there is any way to record count groups and found this thread. I'd like to see an Analysis feature where count groups would be recorded. As it is now, only the total Count Tool count data is listed. I'm working with double labeled tissue and we want to record green cells in one count group, red cells in another and doubled-labeled yellow cells in a third count group and have that data recorded and exported.
Photo of James Monaco

James Monaco

  • 31 Posts
  • 8 Reply Likes
Sure! I can list some of the cell colony counting criteria from the top of my head right now, and I'll also shoot a few emails around and ask for additional suggestions. (I am an Instructional Media Specialist for a university in New England. I work with faculty and students on media aspects of research and class projects across every discipline)

The biology researchers I've worked with are predominantly interested in 2 types of image analysis: population count and viability count (usually in %). They are typically concerned with bacterial cell colonies, which are usually counted by hand.
The attributes they need:

~identify cell by color difference (or inversely, blank area in a field of color).
~identify expected cell attributes of area and roundness
~distinguish cells in cluster-forms (if cells are cluster-form type cells)
~identify cells that overlap
~identify sample cell shape and look for pattern matches
~allow for 2 or more cell-types by color in the same image (viability measurements)

The term I've heard tossed around regarding some of the techniques for identifying overlaps and clusters is "Algebraic Topology"

There are a few proprietary utilities from microscope manufacturers to assist with counting, but Photoshop is often needed to prepare images for analysis.

Attached also, one of the more alarmingly difficult images someone brought to be last Friday, with spindle-shaped cells.

Photo of Zorana Gee

Zorana Gee, Photoshop Product Manager

  • 3 Posts
  • 3 Reply Likes
Are you aware that you can run an auto-count from your selection? If you have Extended, and using PS tools to select out what it is you want selected, got to Analysis > Record Measurements (make sure that you Select that Data Point from the same menu). This will spit out the total count in the Measurements Panel (and you can also export this as csv).
Photo of christoph pfaffenbichler

christoph pfaffenbichler, Champion

  • 1197 Posts
  • 158 Reply Likes
The issue reminds me a bit of a topic concerning archeological photographs that has brought up in the user-to-user Fora; it concerned automating scaling large numbers of images according to a ruler in the photographs.

I think some form of shape recognition that users could run based on a path or a channel might be quite useful to the scientific users – possibly not with the spindly cells above but in other cases maybe.
And I have the somewhat vague suspicion that Photoshop performs such tasks already in bank-note recognition and possibly also in Auto-Aligning.
Photo of James Monaco

James Monaco

  • 31 Posts
  • 8 Reply Likes
Bingo--I agree completely, Christoph. It's funny, when I look at the photos above, it's completely trivial to determine what is a cell and what isn't, even though the cells overlap in some places (incomplete shapes), vary in intensity, and even vary in signal-to-noise. It feels like there's got to be some way to capture that, which would advance selections in general in Photoshop. Selecting by approximate shape and volume would, I suspect, really make a difference.

Adobe folks: There's a free tool called Cell Profiler (http://www.cellprofiler.org/) that is designed to count cells in an image. While I think that having a selection tool that could target shape, area, intensity range, and signal-to-noise would be a universally valuable feature, it may be useful to see what other folks have done already with regards to this problem.

The formulas mentioned in that software are probably a good starting point, although I have to admit, the math is not my area of expertise. Cell Profiler's main limitations, acording to the folks using it:
1) Post-acquisition pre-processing. The software demands images to be prepped to clearly distinguish cells, and provides channel filters and contrast adjustments. These are rarely effective alone due to varying intensities and noise; Photoshop is frequently used to prep images
2) Adaptability. Cell Profiler requires the user to choose a type of cell, which results in a shape-based analysis. Some cell shapes aren't in the menu or aren't identified correctly.
3) The software chokes on large image sizes.

I hope this sort of thing is something you guys would be interested in!

Zorana--I did not know that, and it's magnificent; thank you for your insight!! :)
Photo of PierreE

PierreE

  • 6 Posts
  • 0 Reply Likes
that feature could be usefull for other purposes too!