Format Exported Excel Results File with Macro in Imagej
I have created a macro that generates many different data points in the
results window. For each image, a angle, lengths, etc. is generated. Is
there a way I can format the column headers in the exported excel results
file? For example, I have many different lengths generated in the macro,
but they import into the excel file on individual rows with repeating
image names. I would like each length in a different column corresponding
to the same image name.
This is what I get:
Label X Y Angle Length
1 IMG_1227.JPG 285 882 -48.406 714.025
2 IMG_1227.JPG 0 0 0 1003.544
3 IMG_1227.JPG 0 0 0 532
4 IMG_1227.JPG 0 0 0 5623
This is what I want:
Label X Y Angle Length1 LengthN LengthTot LengthSeg
1 IMG_1227.JPG 285 882 -48.406 714.025 1003.544 532 5632
It would be ideal to modify the macro I have to do this.
dir=getDirectory("image");
name = "Results";
index = lastIndexOf(name, "\\");
if (index!=-1) name = substring(name, 0, index);
name = name + ".xls"; ///can change xls to csv, txt, etc.
saveAs("Measurements", dir+name);
close();
}
run("Clear Results");
No comments:
Post a Comment