ImageJ base code to get access to all the classes and their methods to test new Plugins. https://imagejdocu.tudor.lu/howto/plugins/the_imagej_eclipse_howto
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

88 lines
3.0 KiB

var rCmds = newMenu("ROI Menu Tool",
newArray("Set Default Group...", "Set Default Stroke Width...", "-",
"Set Group of Selected ROIs", "Select Group", "-", "Properties..." , "Install Keypad Shortcuts") );
macro "ROI Menu Tool - C037T0d15RT8c12oTfc12i" {
cmd = getArgument();
if (cmd=="Set Default Group...")
setDefaultRoiGroup();
else if (cmd=="Set Default Stroke Width...")
setDefaultRoiStrokeWidth();
else if (cmd=="Set Group of Selected ROIs")
setRoiGroup();
else if (cmd=="Select Group")
selectRoiGroup();
else if (cmd=="Properties...")
properties();
else if (cmd=="Install Keypad Shortcuts")
call("ij.plugin.MacroInstaller.installFromJar", "/macros/RoiMenuTool.txt+");
}
// Numeric keypad shortcuts used to set the default ROI group
macro "Keypad shortcuts for setting default group" { }
macro "Group 0 (none) [n0]" { npad(0); }
macro "Group 1 [n1]" { npad(1); }
macro "Group 2 [n2]" { npad(2); }
macro "Group 3 [n3]" { npad(3); }
macro "Group 4 [n4]" { npad(4); }
macro "Group 5 [n5]" { npad(5); }
macro "Group 6 [n6]" { npad(6); }
macro "Group 7 [n7]" { npad(7); }
macro "Group 8 [n8]" { npad(8); }
macro "Group 9 [n9]" { npad(9); }
function npad(digit) {
Roi.setDefaultGroup(digit);
}
function properties() {
if (selectionType==-1) {
showMessage("Selection required");
exit;
}
run("Properties... ");
}
function setDefaultRoiGroup() {
group = Roi.getDefaultGroup;
Dialog.create("Set Default Group");
Dialog.addNumber("Default group", group);
Dialog.show;
group = Dialog.getNumber();
Roi.setDefaultGroup(group);
call("ij.plugin.frame.Recorder.recordString", "Roi.setDefaultGroup("+group+");\n");
}
function setDefaultRoiStrokeWidth() {
width = Roi.getDefaultStrokeWidth;
Dialog.create("Set Default Stroke Width");
Dialog.addNumber("Default stroke width", width);
Dialog.show;
width = Dialog.getNumber();
Roi.setDefaultStrokeWidth(width);
call("ij.plugin.frame.Recorder.recordString", "Roi.setDefaultStrokeWidth("+width+");\n");
}
function setRoiGroup() {
Dialog.create("Set Group");
Dialog.addString("Group", "1");
Dialog.show;
group = Dialog.getString();
RoiManager.setGroup(group);
if (call("ij.plugin.frame.Recorder.scriptMode")=="true")
call("ij.plugin.frame.Recorder.recordString", "rm.setGroup("+group+");\n");
else
call("ij.plugin.frame.Recorder.recordString", "RoiManager.setGroup("+group+");\n");
}
function selectRoiGroup() {
Dialog.create("Select group");
Dialog.addString("Group", "0");
Dialog.show;
group = Dialog.getString();
RoiManager.selectGroup(group);
if (call("ij.plugin.frame.Recorder.scriptMode")=="true")
call("ij.plugin.frame.Recorder.recordString", "rm.selectGroup("+group+");\n");
else
call("ij.plugin.frame.Recorder.recordString", "RoiManager.selectGroup("+group+");\n");
}