Hi,
When calling getHistogram() on an active selection drawn with polyline (or by using the wand) the function returns the pixel count inside the bounding box of the selection, not inside the selection. Oddly if ImageJ histogram is first called from the menu on the same selection then the result of the macro is correct.
This is demonstrated by this simple macro. It should be run a 16-bit image holding, for instance, two overlapping filled rectangles (with different gray values) and an active selection obtained by wand selecting the rectangle in the back.
rename("Image");
print("Call 1");
getHistogram(values, counts, 65536);
for(j=1;j<65536;j++)if(counts[j]>0)print(j);
run("Histogram");
selectImage("Image");
print("Call 2");
getHistogram(values, counts, 65536);
for(j=1;j<65536;j++)if(counts[j]>0)print(j);
Any explanation?
Best,
Sébastien
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html