Posted by
Michael Schmid on
Oct 15, 2013; 12:37pm
URL: http://imagej.273.s1.nabble.com/Summarize-all-pixelvalues-inside-round-ROI-tp5005136p5005182.html
Hi GuPInt,
ok, your original message was not clear to me, I read it as 'get the (total, overall) sum of all pixels inside all the ROIs'. For getting the individual sums:
You will need the Results table for the coordinates, so maybe the easiest solution is saving the results of getRawStatistics in Arrays, e.g. like the following (a rough idea, I have not tried):
run("Find Maxima...", "noise=10 output=List exclude");
roiNPixels = newArray(nResults);
roiSums = newArray(nResults);
for(i=0; i<nResults; i++) {
x=getResult("X", i);
y=getResult("Y", i);
doWand(x,y,0,"8-connected");
getRawStatistics(nPixels, mean);
roiNPixels[i] = nPixels;
roiSums[i] = mean*nPixels;
}
If you want, you can close the Results Table thereafter and populate a new table with the data stored in the array using a loop and setResult.
Alternatively, instead of setting arrays, you can directly write to two new columns of the Result table, e.g. setResult("nPixels", i, nPixels). As far as I know, then you will have to live with the 'X' and 'Y' columns; one can't delete a column of the ResultsTable.
Michael
________________________________________________________________
On Oct 14, 2013, at 17:08, GuPInt wrote:
> Hi Michael,
>
> thank you very much for your advice with the doWand command I'll change
> that.
> I want to measure each region one after the other and save the details of
> the regions like this: Regionnr=numberofregion Pixels=numberofpixels,
> sum=sumofallvalues
> but with your method I'll summarize all regions at once or did I get you
> wrong?
>
> Kind regards
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html