(In general, questions that are more related to ImageJ internals rather than programming languages should be addressed to the ImageJ mailing list. This will make sure your question will be read by most expert users and developers of ImageJ, not only by a couple of stackoverflow.com enthusiasts.)
You can use the calibration information to calculate back the pixel count from the area:
Pixel count = Total Area / Pixel area
You can use the
ImageStatistics.getStatistics()
method to get itspixelCount
value for the current ROI.Here's how your code looks after the addition of a few lines:
import math row = 0 IJ.run("Set Measurements...", "area centroid perimeter shape feret's area_fraction redirect=None decimal=6") IJ.run("Analyze Particles...") rt = ResultsTable.getResultsTable() imp = IJ.getImage() ip = imp.getProcessor() for roi in RoiManager.getInstance().getRoisAsArray(): a = rt.getValue("Feret", row) b = rt.getValue("MinFeret", row) nu= 1 L = 1 p = 1 sapf = (math.pi/4) * (1/(nu*L)) * math.pow(a, 3) * math.pow(b, 3) / (math.pow(a, 2) + math.pow(a, 2))*p rt.setValue("ROI no.", row, row + 1) rt.setValue("Sapflow", row, sapf) ip.setRoi(roi) stats = ImageStatistics.getStatistics(ip, Measurements.AREA, None) rt.setValue("Pixel count", row, stats.pixelCount) row = row + 1 rt.show("Results")
Hope that helps.