How to Add a Calculation Column in the Results Table

I have over 100 images which contain particles which I am trying to determine the size etc. I am in the process of writing a macro to automatically process the data.

The results file gives me a the X Y co-ordinates of each particle which is great. I am struggling to work out how to add a column which is a calculation. For example I want a column which is X + a input value from a dialog box, the calculation should be carried out for each row in the results table.

Does anyone know if this is possible, or is this beyond the capabilities of ImageJ?

Thanks in advance.

… it is possible by using macro functions:

However, be aware that ImageJ is for images; it isn’t a spreadsheet program for numeric data manipulations.



1 Like

Hey @R_maclachlan

Herbie is right - you can use the ImageJ macro language… and you should be able to create a customized results table. I just did a quick google search and found a link to an old ImageJ mailing list thread that might have an answer in there for you.

Hope this helps!

eta :slight_smile:

1 Like

I was just working on this and thought it’d be nice to put example code here. The last few lines are the relevant ones.

 * Nuclei intensity measurments
 * Requirements:
 *   - Update site: IJPB-Plugins (MorpholibJ)

run("Close All");
run("Options...", "iterations=1 count=1 black do=Nothing");

// Open the images, change their names, adapt LUT, and make them bigger
run("Set... ", "zoom=400");

run("Set... ", "zoom=400");


// Measure the object intensities
run("Intensity Measurements 2D/3D", "input=intensity labels=labels mean max numberofvoxels");

// Add the sum intensity measurement as a new column
IJ.renameResults("Results"); // otherwise below does not work...
for (row=0; row<nResults; row++) {
	sum = getResult("NumberOfVoxels", row) * getResult("Mean", row);
    setResult("sum", row, sum);
1 Like