Last active
July 20, 2021 17:15
-
-
Save T4mmi/738fe47234c3e93a018789cceaf2af29 to your computer and use it in GitHub Desktop.
Batch export ImageJ markers coordinates from TIFF metadata
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
macro "Batch export XY coordinates" { | |
/* Read images in a chosen directory and export measurements | |
XY coordinates (in pixels) in a .txt file with the same name */ | |
dir = getDirectory("Choose a Directory "); // window to select the input directory | |
list = getFileList(dir); // list files in it | |
setBatchMode(true); // activate batch process | |
for (i=0; i<list.length; i++) { // loop over files | |
showProgress(i, list.length); // update progressbar | |
file_name = list[i]; | |
if (endsWith(file_name, ".tif")) { | |
file_path = dir + file_name; | |
open(file_path); // open the current image | |
name = substring(file_name, 0, lastIndexOf(file_name, ".")); | |
txt_path = dir+name+".txt"; | |
run("Set Scale...", "distance=0 known=0 pixel=1 unit=pixel"); | |
run("XY Coordinates...", "save=["+txt_path+"]"); | |
close(); | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Excellent.