Skip to content

Instantly share code, notes, and snippets.

@mutterer
Created March 14, 2021 18:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mutterer/7901a5444920e4da568adeafb58338f1 to your computer and use it in GitHub Desktop.
Save mutterer/7901a5444920e4da568adeafb58338f1 to your computer and use it in GitHub Desktop.
An ImageJ tool macro to move several ROIs
macro "MultiRoiMove Tool - C00cT0f16M" {
if (RoiManager.selected<2) exit();
indexes=split(call("ij.plugin.frame.RoiManager.getIndexesAsString"));
roiManager("Combine");
getCursorLoc(x, y, z, modifiers);
Roi.getBounds(x0, y0, width, height);
while(modifiers&16>0) {
getCursorLoc(x1, y1, z, modifiers);
Roi.move(x0+x1-x, y0+y1-y);
}
roiManager("select", indexes);
roiManager("translate", x1-x, y1-y);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment