How to avoid the pixels at 0 gray level , in the threhold -histogram template?

3 views (last 30 days)
Dear Image Analyst
I am using your template of sliding threshold bars to threshold the histogram of the dicom image. By default , the histogram plots all the pixels including the pixels at 0 gray level.
What should I do , so that your template will plot the histogram of all gray levels , except the pixels at 0 gray level?
Thank you in advance

Accepted Answer

Image Analyst
Image Analyst on 19 Jan 2016
If you're talking about the interactive thresholding app in the File Exchange, http://www.mathworks.com/matlabcentral/fileexchange/29372-thresholding-an-image there is an input option to suppress certain bins of the histogram. For example you may have a masked image with a huge black surround that would show up a a very tall spike at zero that would make it hard to see all the other bars in the histogram. You can tell it to zero out that bin before displaying the bar chart so now all the other bars can be seen more easily.
binsToSuppress = 1; % Don't show huge spike at zero gray levels (due to mask)
[lowThreshold, highThreshold, lastThresholdedBand]=threshold(83, 255, monoImageArray, binsToSuppress);
  7 Comments
Image Analyst
Image Analyst on 20 Jan 2016
Yes it can, though even though you have 65536 gray levels for a 16 bit image, I think I still bucket those into 256 bins for the histogram display. Right now the binsToSuppress refers to bins, not gray levels, so for example graylevel 65500 would be in bin 255. Perhaps I could have an option grayLevelsToSuppress where you could specify which bins to erase based on the gray level instead of the bin number - that might make it easier for people with images that are uint16 or double. What do you think?
Ruhul Amin
Ruhul Amin on 20 Jan 2016
Dear Image Analyst
Yes you are right. For example , it is easy to understand that bin 1 refers to gray level 0 , but for higher gray levels , it might not be possible to understand easily the bin no. that should be suppressed for a particular gray level. So if you can create an option referring bin no . for the corresponding gray levels , it will be helpful for sure. Thanks again.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!