How to avoid the pixels at 0 gray level , in the threhold -histogram template?
3 views (last 30 days)
Show older comments
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
0 Comments
Accepted Answer
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
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?
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!