Skip to content

Instantly share code, notes, and snippets.

@mutterer
Created January 31, 2016 17:54
Show Gist options
  • Select an option

  • Save mutterer/ebb204ee61e001e25797 to your computer and use it in GitHub Desktop.

Select an option

Save mutterer/ebb204ee61e001e25797 to your computer and use it in GitHub Desktop.
A tool that allows drawing multiple freehand regions and adds them as overlay objects. In response to http://forum.imagej.net/t/test-if-roi-selection-is-closed-finished/723/3
macro "MultiFreehand Tool - C00cT0f18M" {
xs = newArray(1);
ys = newArray(1);
getCursorLoc(x, y, z, flags);
xs[0]=x; ys[0]=y;
lastx=x;lasty=y;
leftclick=16;
while (flags&leftclick>0) {
getCursorLoc(x, y, z, flags);
if ((x!=lastx)||(y!=lasty)) {
xs = Array.concat(xs,x);
ys = Array.concat(ys,y);
makeSelection ("freehand",xs,ys);
lastx=x;lasty=y;
}
wait(50);
}
run("Add Selection...","");
run("Select None");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment