Posted by
Rasband, Wayne (NIH/NIMH) [E] on
May 09, 2014; 8:47pm
URL: http://imagej.273.s1.nabble.com/MACRO-Color-Histogram-putting-all-results-tables-in-same-sheet-tp5007643p5007672.html
On May 8, 2014, at 7:16 PM, Hiero wrote:
> Hello guys,
> I started using Color Histogram and I get very excited with the
> possibilities... =D
> I made this macro for a simple application.
>
> makeRectangle(316, 148, 32, 26);
> run("Color Histogram");
> saveAs("Results", "C:\\Users\\Rafael-PC\\Desktop\\Macro\\Results12.xls");
> close();
> makeRectangle(750, 144, 32, 26);
> run("Color Histogram");
> save("Results", "C:\\Users\\Rafael-PC\\Desktop\\Macro\\Results12.xls");
> close();
> makeRectangle(1190, 168, 32, 26);
> run("Color Histogram");
> saveAs("Results", "C:\\Users\\Rafael-PC\\Desktop\\Macro\\Results10.xls");
> close();
>
> [snip]
>
> Is possible I put all this Results tables in one sheet?
> How can I do that?
Use the getStatistics() macro function instead of the Color Histogram plugin, as this example does:
run("Clear Results");
row = 0;
makeRectangle(316, 148, 32, 26);
measure(row++);
makeRectangle(750, 144, 32, 26);
measure(row++);
makeRectangle(1190, 168, 32, 26);
measure(row++);
makeRectangle(1536, 186, 32, 26);
measure(row++);
path = getDirectory("home")+"results.csv";
saveAs("Results", path);
function measure(row) {
getSelectionBounds(x, y, w, h);
setResult("x", row, x);
setResult("y", row, y);
setRGBWeights(1, 0, 0);
getStatistics(area, mean, min, max, std);
setResult("r-mean", row, mean);
setResult("r-std", row, std);
setRGBWeights(0, 1, 0);
getStatistics(area, mean, min, max, std);
setResult("g-mean", row, mean);
setResult("g-std", row, std);
setRGBWeights(0, 0, 1);
getStatistics(area, mean, min, max, std);
setResult("b-mean", row, mean);
setResult("b-std", row, std);
}
-wayne
> --
> View this message in context:
http://imagej.1557.x6.nabble.com/MACRO-Color-Histogram-putting-all-results-tables-in-same-sheet-tp5007643.html> Sent from the ImageJ mailing list archive at Nabble.com.
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html