Hi Philippe,
here is my guess for why the Results Table disappears with the first
Measurement:
A ResultsTable created by a "Measure" command has predefined columns
with predefined names and column numbers. E.g. "Area" is column number
0, "Mean" is column number 1, ... "Angle" is column number 17, ...
This is done by ResultsTable.setDefaultHeadings.
If you create a ResultsTable column with a label that does not stem from
a "Measure" command, the ResultsTable will not use the column numbers of
the "Measure" command. This is what happens with your first "setResult"
command.
Thus, even if the the table created initially with "setResult"
statements and that created by "Measure" happen to have the same column
names, internally they are different and may be incompatible.
As far as I can tell, there is no macro command for
ResultsTable.setDefaultHeadings, so I think you can't create a
"Measure-type" Results Table from the macro language without doing a
measurement.
In a hack, one could resort to JavaScript with a macro eval statement:
rt=ResultsTable.getResultsTable();
rt.setDefaultHeadings();
Best,
Michael
________________________________________________________________
On 20.02.24 17:34, CARL Philippe (LBP) wrote:
Dear all,
Please consider the following small macro:
run("Set Measurements...", "area display redirect=None decimal=4");
run("Blobs (25K)");
makeRectangle(28, 10, 56, 67);
roiManager("Add");
makeRectangle(139, 12, 56, 67);
roiManager("Add");
setResult("Label", nResults, "Before1");
setResult("Area", nResults - 1, 15);
setResult("Label", nResults, "Before2");
setResult("Area", nResults - 1, 25);
updateResults();
waitForUser("Measure before");
roiManager("measure");
waitForUser("Measure after");
setResult("Label", nResults, "After1");
setResult("Area", nResults - 1, 35);
setResult("Label", nResults, "After2");
setResult("Area" , nResults - 1, 45);
updateResults();
roiManager("measure");
Is this an expected behavior or a bug (i.e. that the results window content
gets resetted upon the first measurement made)?
Kindest regards,
Philippe
Philippe CARL
Laboratoire de Bioimagerie et Pathologies
UMR 7021 CNRS - Université de Strasbourg
Faculté de Pharmacie
74 route du Rhin
67401 ILLKIRCH
Tel : +33(0)3 68 85 41 41
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html