get Imagehistogram with absolute pixel intensities
finn
I want to use the ImageHistogram function to find the maximum in an image histogram. This function automatically searches the maximum intensity and sets it to 65336 (or 256 without the /I flag). Is it possible to get the function to output the original intensity values of the raw image?
My problem is that I have images that do not reach the 65336 margin. Therefore the W_ImageHist wave is somewhat compressed in comparison to the raw image.
I could set one point to 65336 and another to 0 just before running or multiply W_ImageHist by 65336/maxValue but I am sure there must be a better option.
Is there a way to tell the ImageHistogram function to simply count the number of pixels over the range of intensities without any min/max adjustment?
Thanks,
Finn
I suspect you misunderstood the documentation of ImageHistogram. The /i flag only tells the operation to use 65536 bins. It does not affect the minimum and maximum values. Here is an example:
ImageHistogram/i ddd
print dimOffset(W_imageHIst,0) // first bin location
print dimOffset(W_imageHIst,0)+dimsize(W_imageHist,0)*dimDelta(W_imageHist,0) // histogram ends here
The number of "counts" in each bin in W_imageHist corresponds exactly to the number of pixels found in the range covered by the bin.
I hope this helps,
A.G.
WaveMetrics, Inc.
October 2, 2012 at 09:49 am - Permalink
thank you for the reply. The only problem is that I would like to generate an ImageHistogram wave in which the real pixel intensity is directly assigned to the number of pixels. To take your example the final wave should be zero from rows 0 to 700 and from 1300 to 65336 and with non-zero values from 700 to 1300. But the Imagehistogram function automatically produces a scaled wave with delta and offset. Everything below 700 and above 1300 is cut out and stretched over the whole range of 65336 rows. This is what I would like to avoid. In the final wave the number of pixels of pixel intentity 700 should be located in the row 700 and not in row 1. I hope I could make it clear this time.
However if it is not possible to get such a direct correlation I will just continue to use the delta factor and offset to calculate the real pixel values.
Best regards,
Finn
October 4, 2012 at 01:47 am - Permalink
Histogram
operation.Histogram /B={0, 1, 65535} MyDataWave, W_Histogram
I don't understand why you want this. Your original posts states that you want to find the image maximum. Clearly bins containing zero counts do not provide information on the maximum. The only exception I can think of is if you want to extract the maximum via fitting of the histogram or something similar, and you want to make sure the baseline of zero is present (but then I'd fix the y0 factor at zero instead).
Also, because this often causes confusion: pixels with intensity 700 will contribute to the row with a point scale (x-value) of 700, but this will be the 701st row of the wave (because the first row is associated with zero intensity).
October 4, 2012 at 02:24 am - Permalink
thank you very much. This is what I was looking for. For me it is just simpler like this because then the wavemax function returns directly the real pixel intensity and I do not have to backcalculate it using the scale factor and offset.
I hope these simple questions do not bother too much...
Cheers,
Finn
October 4, 2012 at 04:59 am - Permalink
It's easier if you use WaveStats instead of WaveMax. In that case you can use the following:
variable theMaxLoc = V_minloc // V_minloc is automatically created by WaveStats
October 4, 2012 at 08:26 am - Permalink