Skip to content

Commit

Permalink
2020.08.23 (1.53e4; Add to Manager recording)
Browse files Browse the repository at this point in the history
  • Loading branch information
rasband committed Aug 23, 2020
1 parent 85e6b2d commit ffa061f
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 19 deletions.
2 changes: 1 addition & 1 deletion ij/ImageJ.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public class ImageJ extends Frame implements ActionListener,

/** Plugins should call IJ.getVersion() or IJ.getFullVersion() to get the version string. */
public static final String VERSION = "1.53e";
public static final String BUILD = "2";
public static final String BUILD = "4";
public static Color backgroundColor = new Color(237,237,237);
/** SansSerif, 12-point, plain font. */
public static final Font SansSerif12 = new Font("SansSerif", Font.PLAIN, 12);
Expand Down
40 changes: 28 additions & 12 deletions ij/macro/Functions.java
Original file line number Diff line number Diff line change
Expand Up @@ -7922,18 +7922,34 @@ private String getPropertiesAsString(Properties props) {
return sb.toString();
}

boolean isStringFunction(String name, int type) {
if (name.equals("getStrokeColor") || name.equals("getDefaultColor")
|| name.equals("getFillColor") || name.equals("getName")
|| name.equals("getProperty") || name.equals("getProperties")
|| name.equals("getType") || name.equals("getString") || name.equals("title")
|| name.equals("headings") || name.equals("allHeadings")
|| (name.equals("get")&&type!=TABLE) || name.equals("getInfo") || name.equals("getSliceLabel")
|| name.equals("getDicomTag") || name.equals("getList")
|| name.equals("getGroupNames"))
return true;
else
return false;
static boolean isStringFunction(String name, int type) {
boolean isString = false;
switch (type) {
case TABLE:
if (name.equals("getString") || name.equals("title") || name.equals("headings")
|| name.equals("allHeadings"))
isString = true;
break;
case ROI:
if (name.equals("getStrokeColor") || name.equals("getDefaultColor")
|| name.equals("getFillColor") || name.equals("getName")
|| name.equals("getProperty") || name.equals("getProperties")
|| name.equals("getGroupNames") || name.equals("getType"))
isString = true;
break;
case PROPERTY:
if (name.equals("getProperty") || name.equals("getProperties")
|| (name.equals("get")&&type!=TABLE) || name.equals("getInfo")
|| name.equals("getList") || name.equals("setSliceLabel")
|| name.equals("getDicomTag"))
isString = true;
break;
case ROI_MANAGER2:
if (name.equals("getName"))
isString = true;
break;
}
return isString;
}

} // class Functions
Expand Down
8 changes: 4 additions & 4 deletions ij/macro/Interpreter.java
Original file line number Diff line number Diff line change
Expand Up @@ -926,8 +926,8 @@ final void doArrayElementAssignment() {
{putTokenBack(); getFactor(); return;}
int index = getIndex();
int expressionType = getExpressionType();
//if (expressionType==Variable.ARRAY)
// error("Arrays of arrays not supported");
if (expressionType==Variable.ARRAY)
error("Arrays of arrays not supported");
getToken();
int op = token;
if (!(op=='='||op==PLUS_EQUAL||op==MINUS_EQUAL||op==MUL_EQUAL||op==DIV_EQUAL))
Expand Down Expand Up @@ -1185,8 +1185,8 @@ boolean isString(int pcLoc) {
if (type==TABLE || type==ROI || type==PROPERTY || type==ROI_MANAGER2) {
int token2 = pgm.code[pcLoc+2];
String name = pgm.table[token2>>TOK_SHIFT].str;
if (func.isStringFunction(name,type))
return true;
if (Functions.isStringFunction(name,type))
return true;
}
}
if ((tok&TOK_MASK)!=WORD)
Expand Down
19 changes: 19 additions & 0 deletions ij/plugin/Selection.java
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,25 @@ void addToRoiManager(ImagePlus imp) {
}
}
}
if (Recorder.record && imp.getStackSize()>1) {
if (imp.isHyperStack()) {
int C = imp.getChannel();
int Z = imp.getSlice();
int T = imp.getFrame();
if (Recorder.scriptMode()) {
Recorder.recordCall("roi = imp.getRoi();");
Recorder.recordCall("roi.setPosition("+C+", "+Z+", "+T+");");
} else
Recorder.record("Roi.setPosition", C, Z, T);
} else {
int position = imp.getCurrentSlice();
if (Recorder.scriptMode()) {
Recorder.recordCall("roi = imp.getRoi();");
Recorder.recordCall("roi.setPosition("+position+");");
} else
Recorder.record("Roi.setPosition", position);
}
}
rm.allowRecording(true);
rm.runCommand("add");
rm.allowRecording(false);
Expand Down
2 changes: 1 addition & 1 deletion ij/plugin/frame/RoiManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ else if (color==null && defaultColor!=null)

void recordAdd(Color color, int lineWidth) {
if (Recorder.scriptMode())
Recorder.recordCall("rm.addRoi(imp.getRoi());");
Recorder.recordCall("rm.addRoi(roi);");
else if (color!=null && lineWidth==1)
Recorder.recordString("roiManager(\"Add\", \""+getHex(color)+"\");\n");
else if (lineWidth>1)
Expand Down
4 changes: 3 additions & 1 deletion release-notes.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
</head>
<body>x

<li> <u>1.53e2 22 August 2020</u>
<li> <u>1.53e4 23 August 2020</u>
<ul>
<li> Thanks to Kees Straatman, improved recording of the
<i>Edit&gt;Selection&gt;Add to Manager</i> command.
<li> Thanks to Philippe Carl, fixed a bug that allowed multiple copies
of the Color Picker to be opened.
<li> Thanks to 'Ben', fixed a bug that caused the Table.get()
Expand Down

0 comments on commit ffa061f

Please sign in to comment.