Login  Register

Re: Histogram

Posted by Michael Schmid on Dec 05, 2008; 10:42am
URL: http://imagej.273.s1.nabble.com/WaitForUser-problem-tp3694321p3694324.html

Hi Ben,

your approach should work.

Maybe your macro has a bug?
One problem might be wrong addressing of stack slices. They are  
numbered 1...NSlices, not 0...(nSlices-1).

setSlice(0); will cause an error message, but
run("Set Slice...","slice=0"); will be simply ignored.

One problem that might occur with extremely large stacks is an  
integer overflow when adding to bins with more than roughly 2e9 pixels.
Analysis/histogram/<include all images> would suffer from this; the  
macro language uses double arrays and won't have this problem.


Michael
________________________________________________________________

On 4 Dec 2008, at 23:09, Ben G wrote:

> Thanks for the posts.  From what I can tell the getHistogram command
> will not do a stack, so the program requires a slice loop, a total
> counts array, and a sum array, about 10 lines of code.  This is what I
> mean by not elegant for a stack histogram.
>
> I have already implemented this approach.
>
> However, I have found another problem.  I don't get the same values  
> when
> I do the above code and run a stack histogram manually.
>
> The slice loop code sets up an array of new bins and sums the counts
> into them as each histogram is made.  The output is the sum of  
> counts in
> each bin for all slices.  I checked it out on a few slices and the  
> math
> is right.
>
> When I manually run the Analysis/histogram/<include all images>, I get
> different counts in the bins.
>
> Maybe I don't understand what the Histogram Stack command does.
>
>
> Ben
>