Login  Register

How to save a Histogram files to excel or txt using a macro? [help]

Posted by Even Sckart on Aug 22, 2013; 12:14pm
URL: http://imagej.273.s1.nabble.com/How-to-save-a-Histogram-files-to-excel-or-txt-using-a-macro-help-tp5004531.html

Hiho, first sorry for my poor english.
i try have this image and want to write a little makro which should help me to figur out how much pixels are black and how much of them are white in a little recancle.
This should happen with a histogram, i tryed to do this by the recorder. My problem is that the recorder didnt write down if i push the copy button on the historgam and then try to copy it to a txt or an excel file. When Imagej saved it the little rectangle should move on and on until the hole picture is svaed in datas from the histogramms, so i can go on in excel or so.


 This is the code i already have.

selectWindow("Bruchbild 1.jpg");
run("Make Binary");
run("Invert");
//setTool("rectangle");
n=0;
m=0;
x=1;
y=1;
do
{if (x<7)
                {makeRectangle(n, m, 120, 120);
                run("Histogram");
                n=(n+120);
                x=(x+1);}
               
else
                {selectWindow("Bruchbild 1.jpg");
                m=m+120;
                n=0;
                makeRectangle(n, m, 120, 120);
                run("Histogram");
                n=(n+120);
                x=(x+1);
                y=(y+1);}}
while (y>(10))
       

and this is the picture.





would be so great if someone can help me with this :) Thanks a lot