Snippets

Dave Mason Recovering XY points from a tab delimited text file Image.sc forum (https://forum.image.sc/t/fiji-multi-point-tool-load-points-via-xy-coordinates/29674)

Created by Dave Mason last modified
//-- open the file outputted by File>Save>XY Coordinates
file=File.openAsString("C:/Users/dave/Desktop/Untitled.txt");
//-- Split the file by newlines
lines=split(file,"\n");
//-- Debug only
//Array.print(lines);

//-- Clear the ROI manager
roiManager("reset");
//-- loop through the file
for (lineNum=0;lineNum<lines.length;lineNum++){
//-- Debug Only
//print(lines[lineNum]);
//-- extract the coordinates by splitting on tab
pointCoord=split(lines[lineNum],"\t");
//-- Draw the point
makePoint(pointCoord[0], pointCoord[1], "small yellow hybrid");
//-- add it to the ROI manager
roiManager("add");
}

run("Select None");

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.