Hi Cyril,Thanks so much for your help! The image was simply the default results table that is generated. I use both summary data (number of clusters per image and % are) and I use the areas of individual clusters.This is where I inserted the text you provided. Is this the correct place in the macro? I ran it and it gave an error "Else without if in line 82".macro "mac agg" {dir = getDirectory("Choose Source Directory");list = getFileList(dir);for (i=0; i<list.length; i++) {open(dir+list[i]);run("8-bit");setAutoThreshold("Default");run("Threshold...");waitForUser("Adjust threshold, then click 'OK' ");run("Analyze Particles...", "size=50-Infinity display exclude include summarize");close ();}if (nResults != 0){for (i=0; i<nResults; i++){resLabel = getResultLabel(i);if (indexOf(resLabel, ".tif") > 0) {resLabel = substring (resLabel, 0, lastIndexOf(resLabel,".tif")); // remove the ".tif" in the text stringn = lengthOf(resLabel); // number of characters in the text stringLBL = substring (resLabel, 0, n-2); // remove the last 2 characters to get the labelsection = substring (resLabel, n-1, n); // remove all text in label except last charactersetResult("Label", i, LBL); // set the text string for new labelsetResult("Section", i, section); // set the text string for section}} else {showMessage("No Result found in result table");}selectWindow("Results");saveAs("Measurements", "C:\\Documents and Settings\\mmatsche\\Desktop\\test.xls");close();close();close();};Mark Matsche, MSFish and Wildlife HealthMaryland Dept. Natural ResourcesCooperative Oxford Lab904 S. Morris StreetOxford, MD 21654<a href="tel:410-226-5421%20x129" value="+14102265421" target="_blank">410-226-5421 x129 (Ph)<a href="tel:410-226-0120" value="+14102260120" target="_blank">410-226-0120 (Fax)On Fri, Feb 6, 2015 at 11:25 AM, Cyril Turiès [via ImageJ] <[hidden email]> wrote:Hi Mark,
I will try to answer but the picture of your result table is not displayed on the website.
Do you only use the summary of results per image or do you need to have the complete detail of clusters?
I don't think you can edit the "Label" heading of the column but you can modify the text content:
if (nResults != 0){
for (i=0; i<nResults; i++){
resLabel = getResultLabel(i);
if (indexOf(resLabel, ".tif") > 0) {
resLabel = substring (resLabel, 0, lastIndexOf(resLabel,".tif")); // remove the ".tif" in the text string
n = lengthOf(resLabel); // number of characters in the text string
LBL = substring (resLabel, 0, n-2); // remove the last 2 characters to get the label
section = substring (resLabel, n-1, n); // remove all text in label except last character
setResult("Label", i, LBL); // set the text string for new label
setResult("Section", i, section); // set the text string for section
}
} else {
showMessage("No Result found in result table");
}
This code block will search for ".tif" in each line of result label and truncate it. Then keep the last digit as the section and update each line with label and section.
You can use:
setResult("Label", i, "Fish"+LBL);
to display the fish information.
I hope this is what you needed.
Cyril
If you reply to this email, your message will be added to the discussion below:http://imagej.1557.x6.nabble.com/Modify-or-create-results-table-tp5011481p5011487.html
Free forum by Nabble | Disable Popup Ads | Edit this page |