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

excluding pxels at 0 gray levelImage Processing Toolbox

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

Best Answer

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);