Skip to main content
Participant
February 17, 2020
Answered

Pixel count using histogram incorrect even after uncached refresh

  • February 17, 2020
  • 3 replies
  • 2673 views

Hello,

 

I'm hoping to get some help to resolve this issue. I'm using photoshop to calculate the area of some histological slides. The different areas I'm calculating are 1) Total area, 2) Area at risk 3) Necrotic (dead) tissue.  Obviously the total area should be the largest, the area at risk the second largest and the dead tissue the smallest. I only need values as percentage of each other so converting to millimeter or some other unit is unecessary - I just want area at risk as a % of total area and and dead tissue as a % of area at risk. Should be simple, right?

 

I'm doing this by tracing each of the areas in separate layers and coloring them with a single color. Then I select only one layer and open the histogram, do uncached refresh to the get the pixel count. However, I'm getting the same pixel count on every layer even though they are obviously different sizes. If I use the magic wand to do a pixel count with similar colors the data I get back are equally nonsense, with larger areas getting lower pixel counts than smaller ones.

 

Does anyone know how to fix this problem? Thanks in advance!

This topic has been closed for replies.
Correct answer davescm

I just tried and got some strange results here.

 

Try this though

Select the layer to be measured in the layers panel and switch off visibility of all other layers. Use Ctrl+D to clear any existing selection and then use the object selection tool to select the pixels - just draw around the entire image and the tool will select all the pixels on the layer. The histogram should now show an accurate uncached count of that layers pixels.

It seems to work here - even with just a handful of individual pixels marked

 

Dave

3 replies

davescm
Community Expert
Community Expert
February 17, 2020

Change the histogram source to Selected layer

 

Dave

Participant
February 17, 2020

Thanks for your reply. I have already done that.  I'm still getting unreliable data, with different pixel counts each time.

 

These are all from the same cross section:

 

Total SizeAARNecroAAR/TotInf/AAR
68025284561885141,83 %66,25 %
2716371125167348041,42 %65,31 %
45022003151044,49 %75,54 %

 

How can I know which one is accurate?

davescm
Community Expert
davescmCommunity ExpertCorrect answer
Community Expert
February 17, 2020

I just tried and got some strange results here.

 

Try this though

Select the layer to be measured in the layers panel and switch off visibility of all other layers. Use Ctrl+D to clear any existing selection and then use the object selection tool to select the pixels - just draw around the entire image and the tool will select all the pixels on the layer. The histogram should now show an accurate uncached count of that layers pixels.

It seems to work here - even with just a handful of individual pixels marked

 

Dave

c.pfaffenbichler
Community Expert
Community Expert
February 17, 2020

»Then I select only one layer and open the histogram, do uncached refresh to the get the pixel count.«

Do you mean you select the Layer in the Layers Panel or that you laod the Layer’s transparency as a Selection (by cmd-clicking it in the Layers Panel)? 

Participant
February 17, 2020

I select the layer of interest in the Layer-menu on the right and deselect all other layers so only one layer shows up. I'm not sure what you mean with loading the layer's transparency as selection by cmd-clicking in the layer panel (is that a Mac-thing? I'm using PC).

 

Here's a screengrab of what it looks like. Underneath you see an untraced cross section.  The green is is the whole area (blue, red and white stain), the yellow is the area at risk (red and white stain) and the red is the necrotic area (white stain). Each are is its own separate layer as you can see on the right. 

c.pfaffenbichler
Community Expert
Community Expert
February 17, 2020

If you need the Histogram numbers in another application you should probably use a Script to save them all at once as a txt or copy them to the clipboard etc. 

c.pfaffenbichler
Community Expert
Community Expert
February 17, 2020

Please provide a sample file.