Quantcast

got different histogram results by macro

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

got different histogram results by macro

zhenglili1114
I tried to analysis histogram result of a tif file and save it to txt or xls.


When I do histogram manually, I got a figure as


and list the result as, the value "0" has "102976919" count.


When I run the histogram by macro, the left line of the list became "bin start"


Also if I run the the "histogramlister" macro (https://imagej.nih.gov/ij/macros/HistogramLister.txt), I got different count number. The value "0" has "118589" count.


So how can I just copy the correct number from the list and save it??
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: got different histogram results by macro

Michael Schmid-3
Hi anonymous,

you have a stack. Each image has 344*356 = 122464 pixels, so the value
"118589" is obviously for one image (one stack slice), and "102976919"
is for the full stack.
For a stack, 'Analyze->Histogram' asks whether to include all stack
slices or only the current one.

The HistogramLister macro lists the histogram for only the current
slice. If you want the histogram for the full stack you can use the
StackHistogramLister
   https://imagej.nih.gov/ij/macros/StackHistogramLister.txt

If you are only interested in the value for the '0' bin, of course you
can simplify the macros by removing the loop over all 256 bins and just
use the value for bin 0, i.e., counts[0].

For more info on macro programming, see
   https://imagej.nih.gov/ij/developer/index.html
   https://imagej.nih.gov/ij/developer/macro/functions.html

Michael
________________________________________________________________
On 09/04/2017 18:46, zhenglili1114 wrote:

> I tried to analysis histogram result of a tif file and save it to txt or xls.
> <http://imagej.1557.x6.nabble.com/file/n5018476/tif_photo.jpg>
>
> When I do histogram manually, I got a figure as
> <http://imagej.1557.x6.nabble.com/file/n5018476/histo_manual.jpg>
>
> and list the result as, the value "0" has "*102976919*" count.
> <http://imagej.1557.x6.nabble.com/file/n5018476/list_manual.jpg>
>
> When I run the histogram by macro, the left line of the list became "bin
> start"
> <http://imagej.1557.x6.nabble.com/file/n5018476/list_macro.jpg>
>
> Also if I run the the "histogramlister" macro
> (https://imagej.nih.gov/ij/macros/HistogramLister.txt), I got different
> count number. The value "0" has "*118589*" count.
> <http://imagej.1557.x6.nabble.com/file/n5018476/result_macro.jpg>
>
> So how can I just copy the correct number from the list and save it??

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Loading...