MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / roiManager

Method roiManager

ij/src/main/java/ij/macro/Functions.java:3201–3276  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3199 }
3200
3201 double roiManager() {
3202 String cmd = getFirstString();
3203 cmd = cmd.toLowerCase();
3204 String path = null;
3205 String color = null;
3206 double lineWidth = 1.0;
3207 int index=0;
3208 double dx=0.0, dy=0.0;
3209 double countOrIndex=Double.NaN;
3210 boolean twoArgCommand = cmd.equals("open")||cmd.equals("save")||cmd.equals("rename")
3211 ||cmd.equals("set color")||cmd.equals("set fill color")||cmd.equals("set line width")
3212 ||cmd.equals("associate")||cmd.equals("centered")||cmd.equals("usenames")
3213 ||cmd.equals("save selected");
3214 boolean select = cmd.equals("select");
3215 boolean multiSelect = false;
3216 boolean add = cmd.equals("add");
3217 if (twoArgCommand)
3218 path = getLastString();
3219 else if (add) {
3220 if (interp.nextToken()==',') {
3221 interp.getComma();
3222 color = interp.getString();
3223 }
3224 if (interp.nextToken()==',') {
3225 interp.getComma();
3226 lineWidth = interp.getExpression();
3227 }
3228 interp.getRightParen();
3229 } else if (select) {
3230 interp.getComma();
3231 multiSelect = isArrayArg();
3232 if (!multiSelect) {
3233 index = (int)interp.getExpression();
3234 interp.getRightParen();
3235 }
3236 } else if (cmd.equals("translate")) {
3237 dx = getNextArg();
3238 dy = getLastArg();
3239 } else
3240 interp.getRightParen();
3241 if (RoiManager.getInstance()==null&&roiManager==null) {
3242 if (Interpreter.isBatchMode())
3243 roiManager = new RoiManager(true);
3244 else
3245 IJ.run("ROI Manager...");
3246 }
3247 RoiManager rm = roiManager!=null?roiManager:RoiManager.getInstance();
3248 if (rm==null)
3249 interp.error("ROI Manager not found");
3250 if (multiSelect)
3251 return setMultipleIndexes(rm);
3252 if (twoArgCommand)
3253 rm.runCommand(cmd, path);
3254 else if (add)
3255 rm.runCommand("Add", color, lineWidth);
3256 else if (select) {
3257 int n = rm.getCount();
3258 checkIndex(index, 0, n-1);

Callers 1

getFunctionValueMethod · 0.95

Calls 15

getFirstStringMethod · 0.95
getLastStringMethod · 0.95
isArrayArgMethod · 0.95
getNextArgMethod · 0.95
getLastArgMethod · 0.95
getInstanceMethod · 0.95
isBatchModeMethod · 0.95
runMethod · 0.95
setMultipleIndexesMethod · 0.95
runCommandMethod · 0.95
getCountMethod · 0.95
checkIndexMethod · 0.95

Tested by

no test coverage detected